src/mainWindow.h

Tue, 07 Jul 2015 21:35:20 +0300

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Tue, 07 Jul 2015 21:35:20 +0300
changeset 941
f895379d7fab
parent 929
66e8453e1768
permissions
-rw-r--r--

Refactoring update.
Removed all asserts.

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
927
409b82a4765e - bump copyright year
Teemu Piippo <crimsondusk64@gmail.com>
parents: 882
diff changeset
3 * Copyright (C) 2013 - 2015 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
806
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
20 #include <functional>
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QMainWindow>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QAction>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QListWidget>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <QRadioButton>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "configuration.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "ldObject.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include "ui_ldforge.h"
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 794
diff changeset
28 #include "colors.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 class MessageManager;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 class MainWindow;
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 794
diff changeset
32 class LDColorData;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 class QToolButton;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 class QDialogButtonBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 class GLRenderer;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 class QComboBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 class QProgressBar;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 class Ui_LDForgeUI;
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
39 class Primitive;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
41 class ColorToolbarEntry
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 {
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 794
diff changeset
43 PROPERTY (public, LDColor, color, setColor, STOCK_WRITE)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 PROPERTY (public, QToolButton*, toolButton, setToolButton, STOCK_WRITE)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
46 public:
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
47 ColorToolbarEntry (LDColor color, QToolButton* toolButton);
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
48 bool isSeparator() const;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
50 static ColorToolbarEntry getSeparator();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
53 //
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
54 // Object list class for MainWindow
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
55 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 class ObjectList : public QListWidget
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 Q_OBJECT
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 protected:
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 void contextMenuEvent (QContextMenuEvent* ev);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
64 //
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
65 // LDForge's main GUI class.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
66 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 class MainWindow : public QMainWindow
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 {
806
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
69 Q_OBJECT
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
71 public:
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
72 explicit MainWindow (QWidget* parent = nullptr, Qt::WindowFlags flags = 0);
857
e62983881460 - fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
73 ~MainWindow();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
75 // Rebuilds the object list.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
76 void buildObjList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
78 // Updates the window title.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
79 void updateTitle();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
81 // Builds the object list and tells the GL renderer to init a full
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
82 // refresh.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
83 void doFullRefresh();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
85 // Builds the object list and tells the GL renderer to do a soft update.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
86 void refresh();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
88 // Returns the suggested position to place a new object at.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
89 int getInsertionPoint();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
91 // Updates the quick color toolbar
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
92 void updateColorToolbar();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
94 // Rebuilds the recent files submenu
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
95 void updateRecentFilesMenu();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
97 // Sets the selection based on what's selected in the object list.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
98 void updateSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
100 // Updates the grids, selects the selected grid and deselects others.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
101 void updateGridToolBar();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
103 // Updates the edit modes, current one is selected and others are deselected.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
104 void updateEditModeActions();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
106 // Rebuilds the document tab list.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
107 void updateDocumentList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
109 // Updates the document tab for \c doc. If no such tab exists, the
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
110 // document list is rebuilt instead.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
111 void updateDocumentListItem (LDDocumentPtr doc);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
113 // Returns the uniform selected color (i.e. 4 if everything selected is
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
114 // red), -1 if there is no such consensus.
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 794
diff changeset
115 LDColor getSelectedColor();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
117 // Automatically scrolls the object list so that it points to the first
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
118 // selected object.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
119 void scrollToSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
121 // Spawns the context menu at the given position.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
122 void spawnContextMenu (const QPoint pos);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
124 // Deletes all selected objects, returns the count of deleted objects.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
125 int deleteSelection();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
126
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
127 // Deletes all objects by the given color number.
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 794
diff changeset
128 void deleteByColor (LDColor color);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
130 // Tries to save the given document.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
131 bool save (LDDocumentPtr doc, bool saveAs);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
133 // Updates various actions, undo/redo are set enabled/disabled where
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
134 // appropriate, togglable actions are updated based on configuration,
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
135 // etc.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
136 void updateActions();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
138 // Returns a pointer to the renderer
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
139 inline GLRenderer* R()
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
140 {
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
141 return m_renderer;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
142 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
143
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
144 // Sets the quick color list to the given list of colors.
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
145 inline void setQuickColors (const QList<ColorToolbarEntry>& colors)
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
146 {
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
147 m_quickColors = colors;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
148 updateColorToolbar();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
149 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
151 // Adds a message to the renderer's message manager.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
152 void addMessage (QString msg);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
154 // Updates the object list. Right now this just rebuilds it.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
155 void refreshObjectList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
157 void endAction();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
159 inline QTreeWidget* getPrimitivesTree() const
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
160 {
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
161 return ui->primitives;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
162 }
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
163
806
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
164 static QKeySequence defaultShortcut (QAction* act);
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
165 void loadShortcuts (QSettings const* settings);
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
166 void saveShortcuts (QSettings* settings);
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
167 void applyToActions (std::function<void(QAction*)> function);
4240f47aa2d4 - moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents: 804
diff changeset
168
866
4951b737f8cb - now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents: 865
diff changeset
169 bool ringToolHiRes() const;
4951b737f8cb - now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents: 865
diff changeset
170 int ringToolSegments() const;
865
6d68840fcb26 - circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
171
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
172 public slots:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
173 void updatePrimitives();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
174 void changeCurrentFile();
798
88d4973cfe1a - added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents: 795
diff changeset
175 void closeTab (int tabindex);
866
4951b737f8cb - now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents: 865
diff changeset
176 void ringToolHiResClicked (bool clicked);
871
a860edb4210b - display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents: 866
diff changeset
177 void circleToolSegmentsChanged();
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
178 void settingsApplied();
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
179 void actionTriggered();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
180 void actionNew();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
181 void actionNewFile();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
182 void actionOpen();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
183 void actionDownloadFrom();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
184 void actionSave();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
185 void actionSaveAs();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
186 void actionSaveAll();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
187 void actionClose();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
188 void actionCloseAll();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
189 void actionInsertFrom();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
190 void actionExportTo();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
191 void actionSettings();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
192 void actionSetLDrawPath();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
193 void actionScanPrimitives();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
194 void actionExit();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
195 void actionResetView();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
196 void actionAxes();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
197 void actionWireframe();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
198 void actionBFCView();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
199 void actionSetOverlay();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
200 void actionClearOverlay();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
201 void actionScreenshot();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
202 void actionInsertRaw();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
203 void actionNewSubfile();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
204 void actionNewLine();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
205 void actionNewTriangle();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
206 void actionNewQuad();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
207 void actionNewCLine();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
208 void actionNewComment();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
209 void actionNewBFC();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
210 void actionUndo();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
211 void actionRedo();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
212 void actionCut();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
213 void actionCopy();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
214 void actionPaste();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
215 void actionDelete();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
216 void actionSelectAll();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
217 void actionSelectByColor();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
218 void actionSelectByType();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
219 void actionModeDraw();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
220 void actionModeSelect();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
221 void actionModeRectangle();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
222 void actionModeCircle();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
223 void actionModeMagicWand();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
224 void actionModeLinePath();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
225 void actionSetDrawDepth();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
226 void actionSetColor();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
227 void actionAutocolor();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
228 void actionUncolor();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
229 void actionInline();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
230 void actionInlineDeep();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
231 void actionInvert();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
232 void actionMakePrimitive();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
233 void actionSplitQuads();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
234 void actionEditRaw();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
235 void actionBorders();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
236 void actionRoundCoordinates();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
237 void actionVisibilityHide();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
238 void actionVisibilityReveal();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
239 void actionVisibilityToggle();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
240 void actionReplaceCoords();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
241 void actionFlip();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
242 void actionDemote();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
243 void actionYtruder();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
244 void actionRectifier();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
245 void actionIntersector();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
246 void actionIsecalc();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
247 void actionCoverer();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
248 void actionEdger2();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
249 void actionHelp();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
250 void actionAbout();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
251 void actionAboutQt();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
252 void actionGridCoarse();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
253 void actionGridMedium();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
254 void actionGridFine();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
255 void actionEdit();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
256 void actionMoveUp();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
257 void actionMoveDown();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
258 void actionMoveXNeg();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
259 void actionMoveXPos();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
260 void actionMoveYNeg();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
261 void actionMoveYPos();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
262 void actionMoveZNeg();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
263 void actionMoveZPos();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
264 void actionRotateXNeg();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
265 void actionRotateXPos();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
266 void actionRotateYNeg();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
267 void actionRotateYPos();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
268 void actionRotateZNeg();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
269 void actionRotateZPos();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
270 void actionRotationPoint();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
271 void actionAddHistoryLine();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
272 void actionJumpTo();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
273 void actionSubfileSelection();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
274 void actionDrawAngles();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
275 void actionRandomColors();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
276 void actionOpenSubfiles();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
277 void actionSplitLines();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
278 void actionDrawSurfaces();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
279 void actionDrawEdgeLines();
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
280 void actionDrawConditionalLines();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
281
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
282 protected:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
283 void closeEvent (QCloseEvent* ev);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
284
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
285 private:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
286 GLRenderer* m_renderer;
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
287 LDObjectList m_selection;
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
288 QList<ColorToolbarEntry> m_quickColors;
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
289 QList<QToolButton*> m_colorButtons;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
290 QList<QAction*> m_recentFiles;
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
291 MessageManager* m_messageLog;
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
292 Ui_LDForgeUI* ui;
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
293 QTabBar* m_tabBar;
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
294 bool m_isUpdatingTabs;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
295
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
296 private slots:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
297 void slot_selectionChanged();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
298 void slot_recentFile();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
299 void slot_quickColor();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
300 void slot_lastSecondCleanup();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
301 void slot_editObject (QListWidgetItem* listitem);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
302 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
303
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
304 //! Pointer to the instance of MainWindow.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
305 extern MainWindow* g_win;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
306
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
307 //! Get an icon by name from the resources directory.
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
308 QPixmap GetIcon (QString iconName);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
309
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
310 //! \returns a list of quick colors based on the configuration entry.
941
f895379d7fab Refactoring update.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 929
diff changeset
311 QList<ColorToolbarEntry> LoadQuickColorList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313 //! Asks the user a yes/no question with the given \c message and the given
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
314 //! window \c title.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
315 //! \returns true if the user answered yes, false if no.
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
316 bool Confirm (const QString& title, const QString& message); // Generic confirm prompt
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
317
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
318 //! An overload of \c confirm(), this asks the user a yes/no question with the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
319 //! given \c message.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
320 //! \returns true if the user answered yes, false if no.
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
321 bool Confirm (const QString& message);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
322
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
323 //! Displays an error prompt with the given \c message
882
2f3cc8e045d5 - fixed compilation on windows
Teemu Piippo <crimsondusk64@gmail.com>
parents: 876
diff changeset
324 void Critical (const QString& message);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
325
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
326 //! Makes an icon of \c size x \c size pixels to represent \c colinfo
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
327 QIcon MakeColorIcon (LDColor colinfo, const int size);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
328
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
329 //! Fills the given combo-box with color information
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
330 void MakeColorComboBox (QComboBox* box);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
331
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
332 //! \returns a QImage from the given raw GL \c data
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
333 QImage GetImageFromScreencap (uchar* data, int w, int h);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
334
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
335 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
336 //! Takes in pairs of radio buttons and respective values and finds the first
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
337 //! selected one.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
338 //! \returns returns the value of the first found radio button that was checked
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
339 //! \returns by the user.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
340 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
341 template<class T>
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
342 T RadioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
343 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
344 for (Pair<QRadioButton*, const T&> i : haystack)
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
345 {
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
346 if (i.first->isChecked())
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
347 return i.second;
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
348 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
349
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
350 return defval;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
351 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
352
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
354 //! Takes in pairs of radio buttons and respective values and checks the first
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
355 //! found radio button whose respsective value matches \c expr have the given value.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
356 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357 template<class T>
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
358 void RadioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
360 for (Pair<QRadioButton*, const T&> i : haystack)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
361 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
362 if (i.second == expr)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
363 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 i.first->setChecked (true);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
366 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
367 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
368 }
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
369
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
370 // =============================================================================
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
371 //
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
372 class SubfileListItem : public QTreeWidgetItem
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
373 {
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
374 PROPERTY (public, Primitive*, primitive, setPrimitive, STOCK_WRITE)
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
375
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
376 public:
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
377 SubfileListItem (QTreeWidgetItem* parent, Primitive* info) :
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
378 QTreeWidgetItem (parent),
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
379 m_primitive (info) {}
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
380
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
381 SubfileListItem (QTreeWidget* parent, Primitive* info) :
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
382 QTreeWidgetItem (parent),
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
383 m_primitive (info) {}
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
384 };
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
385
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
386 void PopulatePrimitives (QTreeWidget* tw, const QString& selectByDefault = QString());

mercurial