src/gui.h

Wed, 16 Oct 2013 16:47:40 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 16 Oct 2013 16:47:40 +0300
changeset 504
6a1fa662bfc1
parent 498
791c831c8020
child 522
afa691788bdb
permissions
-rw-r--r--

Removed the List -> QList alias, use QList directly

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef GUI_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define GUI_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QMainWindow>
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QAction>
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
24 #include <QListWidget>
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
25 #include <QRadioButton>
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "config.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
27 #include "ldtypes.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28
322
5e701c3c3d8e Re-added the message log, now draws into the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
29 class MessageManager;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 class ForgeWindow;
364
7c3af0a6f8ab Renamed the color class to LDColor for clarity
Santeri Piippo <crimsondusk64@gmail.com>
parents: 360
diff changeset
31 class LDColor;
186
a130960bb220 Make quick color toolbar use QToolButtons, make color selector's process of making color icons a method and use that for generic color icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
32 class QToolButton;
190
82f784cf2ce5 Added tool for replacing coordinate values
Santeri Piippo <crimsondusk64@gmail.com>
parents: 189
diff changeset
33 class QDialogButtonBox;
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 194
diff changeset
34 class GLRenderer;
290
be0c367e7420 Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
35 class QComboBox;
be0c367e7420 Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
36 class QProgressBar;
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
37 class Ui_LDForgeUI;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 // Stuff for dialogs
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 #define IMPLEMENT_DIALOG_BUTTONS \
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \
383
10e60ae9ed58 File list is populated now..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 382
diff changeset
42 connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); \
10e60ae9ed58 File list is populated now..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 382
diff changeset
43 connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); \
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
44
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 // =============================================================================
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
48 #define DEFINE_ACTION(NAME, DEFSHORTCUT) \
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
49 cfg (KeySequence, key_##NAME, DEFSHORTCUT); \
383
10e60ae9ed58 File list is populated now..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 382
diff changeset
50 void actiondef_##NAME()
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
52 #define ACTION(N) g_win->action##N()
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 // Convenience macros for key sequences.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 #define KEY(N) (Qt::Key_##N)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 #define CTRL(N) (Qt::CTRL | Qt::Key_##N)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N)
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
61 class LDQuickColor
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
62 { PROPERTY (LDColor*, color, setColor)
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
63 PROPERTY (QToolButton*, toolButton, setToolButton)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
64
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
65 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
66 LDQuickColor (LDColor* color, QToolButton* toolButton);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
67 bool isSeparator() const;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
68
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
69 static LDQuickColor getSeparator();
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
70 };
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 // ObjectList
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
74 //
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 // Object list class for ForgeWindow
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
77 class ObjectList : public QListWidget
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
78 { Q_OBJECT
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
79
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
80 protected:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
81 void contextMenuEvent (QContextMenuEvent* ev);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 // ForgeWindow
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
86 //
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 // The one main GUI class. Hosts the renderer, object list, message log. Contains
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 // slot_action, which is what all actions connect to. Manages menus and toolbars.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 // Large and in charge.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 // =============================================================================
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
91 class ForgeWindow : public QMainWindow
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
92 { Q_OBJECT
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
93
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
94 public:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
95 ForgeWindow();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
96 void buildObjList();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
97 void updateTitle();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
98 void fullRefresh();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
99 void refresh();
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
100 int getInsertionPoint();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
101 void updateToolBars();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
102 void updateRecentFilesMenu();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
103 void updateSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
104 void updateGridToolBar();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
105 void updateEditModeActions();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
106 void updateFileList();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
107 void updateFileListItem (LDFile* f);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
108 bool isSelected (LDObject* obj);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
109 short getSelectedColor();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
110 LDObject::Type uniformSelectedType();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
111 void scrollToSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
112 void spawnContextMenu (const QPoint pos);
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
113 void deleteObjVector (QList< LDObject* > objs);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
114 int deleteSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
115 void deleteByColor (const short int colnum);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
116 void save (LDFile* f, bool saveAs);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
117
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
118 inline GLRenderer* R()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
119 { return m_renderer;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
120 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
121
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
122 inline QList<LDObject*>& sel()
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
123 { return m_sel;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
124 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
125
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
126 inline void setQuickColors (QList<LDQuickColor>& colors)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
127 { m_quickColors = colors;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
128 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
129
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
130 void setStatusBarText (str text);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
131 void addMessage (str msg);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
132 Ui_LDForgeUI* interface() const;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
133 void refreshObjectList();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
134 void beginAction (QAction* act);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
135 void endAction();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
136
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
137 #define act(N) QAction* action##N();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
138 #include "actions.h"
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
139
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
140 public slots:
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
141 void primitiveLoaderStart (int max);
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
142 void primitiveLoaderUpdate (int prog);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
143 void primitiveLoaderEnd();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
144 void clearSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
145 void slot_action();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
146 void changeCurrentFile();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
147
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
148 protected:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
149 void closeEvent (QCloseEvent* ev);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
151 private:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
152 GLRenderer* m_renderer;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
153 QProgressBar* m_primLoaderBar;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
154 QWidget* m_primLoaderWidget;
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
155 QList<LDObject*> m_sel;
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
156 QList<LDQuickColor> m_quickColors;
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
157 QList<QToolButton*> m_colorButtons;
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
158 QList<QAction*> m_recentFiles;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
159 MessageManager* m_msglog;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
160 Ui_LDForgeUI* ui;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
161
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
162 void invokeAction (QAction* act, void (*func) ());
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
163
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
164
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
165 private slots:
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
166 void slot_selectionChanged();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
167 void slot_recentFile();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
168 void slot_quickColor();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
169 void slot_lastSecondCleanup();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
170 void slot_editObject (QListWidgetItem* listitem);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
173 #define INVOKE_ACTION(N) actiondef_##N();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
174 #define act(N) void actiondef_##N();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
175 #include "actions.h"
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
176
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177 // -----------------------------------------------------------------------------
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
178 // Pointer to the instance of ForgeWindow.
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
179 extern ForgeWindow* g_win;
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
180
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
181 // -----------------------------------------------------------------------------
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182 // Other GUI-related stuff not directly part of ForgeWindow:
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
183 QPixmap getIcon (str iconName); // Get an icon from the resource dir
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
184 QList<LDQuickColor> quickColorsFromConfig(); // Make a list of quick colors based on config
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
185 bool confirm (str title, str msg); // Generic confirm prompt
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
186 bool confirm (str msg); // Generic confirm prompt
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
187 void critical (str msg); // Generic error prompt
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
188 QIcon makeColorIcon (LDColor* colinfo, const int size); // Makes an icon for the given color
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
189 void makeColorSelector (QComboBox* box); // Fills the given combo-box with color information
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
190 QImage imageFromScreencap (uchar* data, int w, int h);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
191
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
192 // =============================================================================
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
193 // -----------------------------------------------------------------------------
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
194 // Takes in pairs of radio buttons and respective values and returns the value of
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
195 // the first found radio button that was checked.
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
196 // =============================================================================
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
197 template<class T> T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
198 { for (pair<QRadioButton*, const T&> i : haystack)
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 364
diff changeset
199 if (i.first->isChecked())
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
200 return i.second;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
201
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
202 return defval;
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
203 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
204
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
205 // =============================================================================
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
206 // -----------------------------------------------------------------------------
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
207 // Takes in pairs of radio buttons and respective values and checks the first
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
208 // found radio button to have the given value.
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
209 // =============================================================================
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
210 template<class T> void radioDefault (const T& expr, QList<pair<QRadioButton*, T>> haystack)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
211 { for (pair<QRadioButton*, const T&> i : haystack)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
212 { if (i.second == expr)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
213 { i.first->setChecked (true);
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
214 return;
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
215 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
216 }
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
217 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
218
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 480
diff changeset
219 #endif // GUI_H

mercurial