18 |
18 |
19 #ifndef GUI_H |
19 #ifndef GUI_H |
20 #define GUI_H |
20 #define GUI_H |
21 |
21 |
22 #include <QMainWindow> |
22 #include <QMainWindow> |
23 #include <QMenu> |
|
24 #include <QToolBar> |
|
25 #include <QAction> |
23 #include <QAction> |
26 #include <QToolBar> |
24 #include <QListWidget> |
27 #include <QTextEdit> |
|
28 #include <qpushbutton.h> |
|
29 #include <qlistwidget.h> |
|
30 #include <qlabel.h> |
|
31 #include <qboxlayout.h> |
|
32 #include "gldraw.h" |
|
33 #include "config.h" |
25 #include "config.h" |
|
26 #include "ldtypes.h" |
34 |
27 |
35 class QComboBox; |
28 class QComboBox; |
36 class ForgeWindow; |
29 class ForgeWindow; |
37 class color; |
30 class color; |
38 class QSplitter; |
31 class QSplitter; |
39 class DelHistory; |
32 class DelHistory; |
40 class QToolButton; |
33 class QToolButton; |
41 class QDialogButtonBox; |
34 class QDialogButtonBox; |
|
35 class GLRenderer; |
42 |
36 |
43 // Stuff for dialogs |
37 // Stuff for dialogs |
44 #define IMPLEMENT_DIALOG_BUTTONS \ |
38 #define IMPLEMENT_DIALOG_BUTTONS \ |
45 bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
39 bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \ |
46 connect (bbx_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); \ |
40 connect (bbx_buttons, SIGNAL (accepted ()), this, SLOT (accept ())); \ |
185 void slot_recentFile (); |
179 void slot_recentFile (); |
186 void slot_quickColor (); |
180 void slot_quickColor (); |
187 void slot_lastSecondCleanup (); |
181 void slot_lastSecondCleanup (); |
188 }; |
182 }; |
189 |
183 |
190 // ============================================================================= |
|
191 // LabeledWidget |
|
192 // |
|
193 // Convenience class for a widget with a label beside it. |
|
194 // ============================================================================= |
|
195 template<class R> class LabeledWidget : public QWidget { |
|
196 public: |
|
197 explicit LabeledWidget (const char* labelstr, QWidget* parent = null) : QWidget (parent) { |
|
198 m_widget = new R (this); |
|
199 commonInit (labelstr); |
|
200 } |
|
201 |
|
202 explicit LabeledWidget (const char* labelstr, R* widget, QWidget* parent = null) : |
|
203 QWidget (parent), m_widget (widget) |
|
204 { |
|
205 commonInit (labelstr); |
|
206 } |
|
207 |
|
208 explicit LabeledWidget (QWidget* parent = 0, Qt::WindowFlags f = 0) { |
|
209 m_widget = new R (this); |
|
210 commonInit (""); |
|
211 } |
|
212 |
|
213 R* widget () const { return m_widget; } |
|
214 R* w () const { return m_widget; } |
|
215 QLabel* label () const { return m_label; } |
|
216 QLabel* l () const { return m_label; } |
|
217 void setWidget (R* widget) { m_widget = widget; } |
|
218 void setLabel (QLabel* label) { m_label = label; } |
|
219 operator R* () { return m_widget; } |
|
220 |
|
221 private: |
|
222 Q_DISABLE_COPY (LabeledWidget<R>) |
|
223 |
|
224 void commonInit (const char* labelstr) { |
|
225 m_label = new QLabel (labelstr, this); |
|
226 m_layout = new QHBoxLayout; |
|
227 m_layout->addWidget (m_label); |
|
228 m_layout->addWidget (m_widget); |
|
229 setLayout (m_layout); |
|
230 } |
|
231 |
|
232 R* m_widget; |
|
233 QLabel* m_label; |
|
234 QHBoxLayout* m_layout; |
|
235 }; |
|
236 |
|
237 // ----------------------------------------------------------------------------- |
184 // ----------------------------------------------------------------------------- |
238 // Other GUI-related stuff not directly part of ForgeWindow: |
185 // Other GUI-related stuff not directly part of ForgeWindow: |
239 QPixmap getIcon (const char* sIconName); |
186 QPixmap getIcon (const char* sIconName); |
240 std::vector<quickColorMetaEntry> parseQuickColorMeta (); |
187 std::vector<quickColorMetaEntry> parseQuickColorMeta (); |
241 bool confirm (str title, str msg); |
188 bool confirm (str title, str msg); |