src/mainWindow.h

Thu, 05 Jun 2014 23:18:13 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 05 Jun 2014 23:18:13 +0300
changeset 794
c254ddc6618b
parent 790
fe1b83f6ba82
child 795
195fa1fff9c3
permissions
-rw-r--r--

- source reformat

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
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
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
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QMainWindow>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QAction>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QListWidget>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QRadioButton>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "configuration.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "ldObject.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "ui_ldforge.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 class MessageManager;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 class MainWindow;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 class LDColor;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 class QToolButton;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 class QDialogButtonBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 class GLRenderer;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 class QComboBox;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 class QProgressBar;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 class Ui_LDForgeUI;
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
37 class Primitive;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 // Stuff for dialogs
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 #define IMPLEMENT_DIALOG_BUTTONS \
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); \
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); \
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 #define DEFINE_ACTION(NAME, DEFSHORTCUT) \
757
8ab9fa53142b - overhauled configuration setup a bit: configuration entries renamed and are now in a cfg:: namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 739
diff changeset
49 CFGENTRY (KeySequence, action##NAME##Shortcut, DEFSHORTCUT); \
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 void MainWindow::slot_action##NAME()
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 // Convenience macros for key sequences.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 #define KEY(N) (Qt::Key_##N)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 #define CTRL(N) (Qt::CTRL | Qt::Key_##N)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N)
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 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 class LDQuickColor
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61 PROPERTY (public, LDColor*, color, setColor, STOCK_WRITE)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62 PROPERTY (public, QToolButton*, toolButton, setToolButton, STOCK_WRITE)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 public:
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 LDQuickColor (LDColor* color, QToolButton* toolButton);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 bool isSeparator() const;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 static LDQuickColor getSeparator();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69 };
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 //
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
72 // Object list class for MainWindow
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
73 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 class ObjectList : public QListWidget
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 Q_OBJECT
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 protected:
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 void contextMenuEvent (QContextMenuEvent* ev);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 };
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
82 //
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
83 // LDForge's main GUI class.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
84 //
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 class MainWindow : public QMainWindow
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 {
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
87 Q_OBJECT
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
89 public:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
90 explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
92 // Rebuilds the object list.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
93 void buildObjList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
95 // Updates the window title.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
96 void updateTitle();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
98 // 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
99 // refresh.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
100 void doFullRefresh();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
102 // 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
103 void refresh();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
105 // Returns the suggested position to place a new object at.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
106 int getInsertionPoint();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
108 // Updates the quick color toolbar
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
109 void updateColorToolbar();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
111 // Rebuilds the recent files submenu
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
112 void updateRecentFilesMenu();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
114 // Sets the selection based on what's selected in the object list.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
115 void updateSelection();
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 // Updates the grids, selects the selected grid and deselects others.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
118 void updateGridToolBar();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
120 // Updates the edit modes, current one is selected and others are deselected.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
121 void updateEditModeActions();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
123 // Rebuilds the document tab list.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
124 void updateDocumentList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
126 // 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
127 // document list is rebuilt instead.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
128 void updateDocumentListItem (LDDocumentPtr doc);
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 // Returns the uniform selected color (i.e. 4 if everything selected is
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
131 // red), -1 if there is no such consensus.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
132 int getSelectedColor();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
134 // Automatically scrolls the object list so that it points to the first
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
135 // selected object.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
136 void scrollToSelection();
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 // Spawns the context menu at the given position.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
139 void spawnContextMenu (const QPoint pos);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
141 // Deletes all selected objects, returns the count of deleted objects.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
142 int deleteSelection();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
143
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
144 // Deletes all objects by the given color number.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
145 void deleteByColor (int colnum);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
147 // Tries to save the given document.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
148 bool save (LDDocumentPtr doc, bool saveAs);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
150 // Updates various actions, undo/redo are set enabled/disabled where
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
151 // appropriate, togglable actions are updated based on configuration,
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
152 // etc.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
153 void updateActions();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
154
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
155 // Returns a pointer to the renderer
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
156 inline GLRenderer* R()
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
157 {
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
158 return m_renderer;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
159 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
160
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
161 // Sets the quick color list to the given list of colors.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
162 inline void setQuickColors (const QList<LDQuickColor>& colors)
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
163 {
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
164 m_quickColors = colors;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
165 updateColorToolbar();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
166 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
168 // Adds a message to the renderer's message manager.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
169 void addMessage (QString msg);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
171 // Updates the object list. Right now this just rebuilds it.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
172 void refreshObjectList();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
174 // Updates all actions to ensure they have the correct shortcut as
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
175 // defined in the configuration entries.
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
176 void updateActionShortcuts();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
178 // Gets the shortcut configuration for the given \c action
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
179 KeySequenceConfigEntry* shortcutForAction (QAction* action);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
181 void endAction();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
183 inline QTreeWidget* getPrimitivesTree() const
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
184 {
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
185 return ui->primitives;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
186 }
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
187
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
188 public slots:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
189 void updatePrimitives();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
190 void changeCurrentFile();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
191 void slot_action();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
192 void slot_actionNew();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
193 void slot_actionNewFile();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
194 void slot_actionOpen();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
195 void slot_actionDownloadFrom();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
196 void slot_actionSave();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
197 void slot_actionSaveAs();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
198 void slot_actionSaveAll();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
199 void slot_actionClose();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
200 void slot_actionCloseAll();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
201 void slot_actionInsertFrom();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
202 void slot_actionExportTo();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
203 void slot_actionSettings();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
204 void slot_actionSetLDrawPath();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
205 void slot_actionScanPrimitives();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
206 void slot_actionExit();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
207 void slot_actionResetView();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
208 void slot_actionAxes();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
209 void slot_actionWireframe();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
210 void slot_actionBFCView();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
211 void slot_actionSetOverlay();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
212 void slot_actionClearOverlay();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
213 void slot_actionScreenshot();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
214 void slot_actionInsertRaw();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
215 void slot_actionNewSubfile();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
216 void slot_actionNewLine();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
217 void slot_actionNewTriangle();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
218 void slot_actionNewQuad();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
219 void slot_actionNewCLine();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
220 void slot_actionNewComment();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
221 void slot_actionNewBFC();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
222 void slot_actionNewVertex();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
223 void slot_actionUndo();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
224 void slot_actionRedo();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
225 void slot_actionCut();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
226 void slot_actionCopy();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
227 void slot_actionPaste();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
228 void slot_actionDelete();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
229 void slot_actionSelectAll();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
230 void slot_actionSelectByColor();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
231 void slot_actionSelectByType();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
232 void slot_actionModeDraw();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
233 void slot_actionModeSelect();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
234 void slot_actionModeCircle();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
235 void slot_actionSetDrawDepth();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
236 void slot_actionSetColor();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
237 void slot_actionAutocolor();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
238 void slot_actionUncolor();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
239 void slot_actionInline();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
240 void slot_actionInlineDeep();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
241 void slot_actionInvert();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
242 void slot_actionMakePrimitive();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
243 void slot_actionSplitQuads();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
244 void slot_actionEditRaw();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
245 void slot_actionBorders();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
246 void slot_actionCornerVerts();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
247 void slot_actionRoundCoordinates();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
248 void slot_actionVisibilityHide();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
249 void slot_actionVisibilityReveal();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
250 void slot_actionVisibilityToggle();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
251 void slot_actionReplaceCoords();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
252 void slot_actionFlip();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
253 void slot_actionDemote();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
254 void slot_actionYtruder();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
255 void slot_actionRectifier();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
256 void slot_actionIntersector();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
257 void slot_actionIsecalc();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
258 void slot_actionCoverer();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
259 void slot_actionEdger2();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
260 void slot_actionHelp();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
261 void slot_actionAbout();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
262 void slot_actionAboutQt();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
263 void slot_actionGridCoarse();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
264 void slot_actionGridMedium();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
265 void slot_actionGridFine();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
266 void slot_actionEdit();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
267 void slot_actionMoveUp();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
268 void slot_actionMoveDown();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
269 void slot_actionMoveXNeg();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
270 void slot_actionMoveXPos();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
271 void slot_actionMoveYNeg();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
272 void slot_actionMoveYPos();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
273 void slot_actionMoveZNeg();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
274 void slot_actionMoveZPos();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
275 void slot_actionRotateXNeg();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
276 void slot_actionRotateXPos();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
277 void slot_actionRotateYNeg();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
278 void slot_actionRotateYPos();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
279 void slot_actionRotateZNeg();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
280 void slot_actionRotateZPos();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
281 void slot_actionRotationPoint();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
282 void slot_actionAddHistoryLine();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
283 void slot_actionJumpTo();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
284 void slot_actionSubfileSelection();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
285 void slot_actionDrawAngles();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
286 void slot_actionRandomColors();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
287 void slot_actionOpenSubfiles();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
288
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
289 protected:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
290 void closeEvent (QCloseEvent* ev);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
291
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
292 private:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
293 GLRenderer* m_renderer;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
294 LDObjectList m_sel;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
295 QList<LDQuickColor> m_quickColors;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
296 QList<QToolButton*> m_colorButtons;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
297 QList<QAction*> m_recentFiles;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
298 MessageManager* m_msglog;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
299 Ui_LDForgeUI* ui;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
300 QTabBar* m_tabs;
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
301 bool m_updatingTabs;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
302
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
303 private slots:
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
304 void slot_selectionChanged();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
305 void slot_recentFile();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
306 void slot_quickColor();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
307 void slot_lastSecondCleanup();
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 790
diff changeset
308 void slot_editObject (QListWidgetItem* listitem);
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
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
311 //! Pointer to the instance of MainWindow.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312 extern MainWindow* g_win;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
314 //! Get an icon by name from the resources directory.
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
315 QPixmap getIcon (QString iconName);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
316
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
317 //! \returns a list of quick colors based on the configuration entry.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
318 QList<LDQuickColor> quickColorsFromConfig();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
319
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
320 //! 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
321 //! window \c title.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
322 //! \returns true if the user answered yes, false if no.
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
323 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
324
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
325 //! 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
326 //! given \c message.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
327 //! \returns true if the user answered yes, false if no.
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
328 bool confirm (const QString& message);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
329
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
330 //! Displays an error prompt with the given \c message
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
331 void critical (const QString& message);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
332
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
333 //! Makes an icon of \c size x \c size pixels to represent \c colinfo
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
334 QIcon makeColorIcon (LDColor* colinfo, const int size);
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 //! Fills the given combo-box with color information
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
337 void makeColorComboBox (QComboBox* box);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
338
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
339 //! \returns a QImage from the given raw GL \c data
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
340 QImage imageFromScreencap (uchar* data, int w, int h);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
341
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
342 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
343 //! 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
344 //! selected one.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 //! \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
346 //! \returns by the user.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
347 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
348 template<class T>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
349 T radioSwitch (const T& defval, QList<Pair<QRadioButton*, T>> haystack)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
350 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
351 for (Pair<QRadioButton*, const T&> i : haystack)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
352 if (i.first->isChecked())
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353 return i.second;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
354
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
355 return defval;
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
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
358 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359 //! 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
360 //! 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
361 //!
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
362 template<class T>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
363 void radioDefault (const T& expr, QList<Pair<QRadioButton*, T>> haystack)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365 for (Pair<QRadioButton*, const T&> i : haystack)
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 if (i.second == expr)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
368 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
369 i.first->setChecked (true);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
370 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
372 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
373 }
790
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
374
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
375 // =============================================================================
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
376 //
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
377 class SubfileListItem : public QTreeWidgetItem
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
378 {
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
379 PROPERTY (public, Primitive*, primitive, setPrimitive, STOCK_WRITE)
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
380
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
381 public:
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
382 SubfileListItem (QTreeWidgetItem* parent, Primitive* info) :
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
383 QTreeWidgetItem (parent),
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
384 m_primitive (info) {}
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
385
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
386 SubfileListItem (QTreeWidget* parent, Primitive* info) :
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
387 QTreeWidgetItem (parent),
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
388 m_primitive (info) {}
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
389 };
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
390
fe1b83f6ba82 - added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
391 void populatePrimitives (QTreeWidget* tw, const QString& selectByDefault = QString());

mercurial