src/gui.h

changeset 504
6a1fa662bfc1
parent 498
791c831c8020
child 522
afa691788bdb
equal deleted inserted replaced
503:bebe09014dd6 504:6a1fa662bfc1
108 bool isSelected (LDObject* obj); 108 bool isSelected (LDObject* obj);
109 short getSelectedColor(); 109 short getSelectedColor();
110 LDObject::Type uniformSelectedType(); 110 LDObject::Type uniformSelectedType();
111 void scrollToSelection(); 111 void scrollToSelection();
112 void spawnContextMenu (const QPoint pos); 112 void spawnContextMenu (const QPoint pos);
113 void deleteObjVector (List< LDObject* > objs); 113 void deleteObjVector (QList< LDObject* > objs);
114 int deleteSelection(); 114 int deleteSelection();
115 void deleteByColor (const short int colnum); 115 void deleteByColor (const short int colnum);
116 void save (LDFile* f, bool saveAs); 116 void save (LDFile* f, bool saveAs);
117 117
118 inline GLRenderer* R() 118 inline GLRenderer* R()
119 { return m_renderer; 119 { return m_renderer;
120 } 120 }
121 121
122 inline List<LDObject*>& sel() 122 inline QList<LDObject*>& sel()
123 { return m_sel; 123 { return m_sel;
124 } 124 }
125 125
126 inline void setQuickColors (List<LDQuickColor>& colors) 126 inline void setQuickColors (QList<LDQuickColor>& colors)
127 { m_quickColors = colors; 127 { m_quickColors = colors;
128 } 128 }
129 129
130 void setStatusBarText (str text); 130 void setStatusBarText (str text);
131 void addMessage (str msg); 131 void addMessage (str msg);
150 150
151 private: 151 private:
152 GLRenderer* m_renderer; 152 GLRenderer* m_renderer;
153 QProgressBar* m_primLoaderBar; 153 QProgressBar* m_primLoaderBar;
154 QWidget* m_primLoaderWidget; 154 QWidget* m_primLoaderWidget;
155 List<LDObject*> m_sel; 155 QList<LDObject*> m_sel;
156 List<LDQuickColor> m_quickColors; 156 QList<LDQuickColor> m_quickColors;
157 List<QToolButton*> m_colorButtons; 157 QList<QToolButton*> m_colorButtons;
158 List<QAction*> m_recentFiles; 158 QList<QAction*> m_recentFiles;
159 MessageManager* m_msglog; 159 MessageManager* m_msglog;
160 Ui_LDForgeUI* ui; 160 Ui_LDForgeUI* ui;
161 161
162 void invokeAction (QAction* act, void (*func) ()); 162 void invokeAction (QAction* act, void (*func) ());
163 163
179 extern ForgeWindow* g_win; 179 extern ForgeWindow* g_win;
180 180
181 // ----------------------------------------------------------------------------- 181 // -----------------------------------------------------------------------------
182 // Other GUI-related stuff not directly part of ForgeWindow: 182 // Other GUI-related stuff not directly part of ForgeWindow:
183 QPixmap getIcon (str iconName); // Get an icon from the resource dir 183 QPixmap getIcon (str iconName); // Get an icon from the resource dir
184 List<LDQuickColor> quickColorsFromConfig(); // Make a list of quick colors based on config 184 QList<LDQuickColor> quickColorsFromConfig(); // Make a list of quick colors based on config
185 bool confirm (str title, str msg); // Generic confirm prompt 185 bool confirm (str title, str msg); // Generic confirm prompt
186 bool confirm (str msg); // Generic confirm prompt 186 bool confirm (str msg); // Generic confirm prompt
187 void critical (str msg); // Generic error prompt 187 void critical (str msg); // Generic error prompt
188 QIcon makeColorIcon (LDColor* colinfo, const int size); // Makes an icon for the given color 188 QIcon makeColorIcon (LDColor* colinfo, const int size); // Makes an icon for the given color
189 void makeColorSelector (QComboBox* box); // Fills the given combo-box with color information 189 void makeColorSelector (QComboBox* box); // Fills the given combo-box with color information
192 // ============================================================================= 192 // =============================================================================
193 // ----------------------------------------------------------------------------- 193 // -----------------------------------------------------------------------------
194 // Takes in pairs of radio buttons and respective values and returns the value of 194 // Takes in pairs of radio buttons and respective values and returns the value of
195 // the first found radio button that was checked. 195 // the first found radio button that was checked.
196 // ============================================================================= 196 // =============================================================================
197 template<class T> T radioSwitch (const T& defval, List<pair<QRadioButton*, T>> haystack) 197 template<class T> T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack)
198 { for (pair<QRadioButton*, const T&> i : haystack) 198 { for (pair<QRadioButton*, const T&> i : haystack)
199 if (i.first->isChecked()) 199 if (i.first->isChecked())
200 return i.second; 200 return i.second;
201 201
202 return defval; 202 return defval;
205 // ============================================================================= 205 // =============================================================================
206 // ----------------------------------------------------------------------------- 206 // -----------------------------------------------------------------------------
207 // Takes in pairs of radio buttons and respective values and checks the first 207 // Takes in pairs of radio buttons and respective values and checks the first
208 // found radio button to have the given value. 208 // found radio button to have the given value.
209 // ============================================================================= 209 // =============================================================================
210 template<class T> void radioDefault (const T& expr, List<pair<QRadioButton*, T>> haystack) 210 template<class T> void radioDefault (const T& expr, QList<pair<QRadioButton*, T>> haystack)
211 { for (pair<QRadioButton*, const T&> i : haystack) 211 { for (pair<QRadioButton*, const T&> i : haystack)
212 { if (i.second == expr) 212 { if (i.second == expr)
213 { i.first->setChecked (true); 213 { i.first->setChecked (true);
214 return; 214 return;
215 } 215 }

mercurial