src/MainWindow.h

Wed, 05 Mar 2014 17:12:22 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 05 Mar 2014 17:12:22 +0200
changeset 646
1ccb092cebed
parent 642
751a8df42842
child 650
db7146a87ae4
permissions
-rw-r--r--

- added doxygen support for MainWindow.h

629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013, 2014 Santeri Piippo
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
641
425b169a82aa - changed header guards into #pragma once
Santeri Piippo <crimsondusk64@gmail.com>
parents: 639
diff changeset
19 #pragma once
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QMainWindow>
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QAction>
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QListWidget>
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QRadioButton>
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "Configuration.h"
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "LDObject.h"
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "ui_ldforge.h"
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 class MessageManager;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 class MainWindow;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 class LDColor;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 class QToolButton;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 class QDialogButtonBox;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 class GLRenderer;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 class QComboBox;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 class QProgressBar;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 class Ui_LDForgeUI;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 // Stuff for dialogs
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 #define IMPLEMENT_DIALOG_BUTTONS \
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); \
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 connect (bbx_buttons, SIGNAL (accepted()), this, SLOT (accept())); \
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 connect (bbx_buttons, SIGNAL (rejected()), this, SLOT (reject())); \
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 // =============================================================================
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 // =============================================================================
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 #define DEFINE_ACTION(NAME, DEFSHORTCUT) \
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 cfg (KeySequence, key_action##NAME, DEFSHORTCUT); \
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49 void MainWindow::slot_action##NAME()
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 // Convenience macros for key sequences.
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 #define KEY(N) (Qt::Key_##N)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 #define CTRL(N) (Qt::CTRL | Qt::Key_##N)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 #define SHIFT(N) (Qt::SHIFT | Qt::Key_##N)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 #define CTRL_SHIFT(N) (Qt::CTRL | Qt::SHIFT | Qt::Key_##N)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 // =============================================================================
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 class LDQuickColor
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 {
642
751a8df42842 - migrated the codebase to use a simpler PROPERTY macro, arrrrrrrrrrrrrrrrrrrrrgh
Santeri Piippo <crimsondusk64@gmail.com>
parents: 641
diff changeset
60 PROPERTY (public, LDColor*, color, setColor, STOCK_WRITE)
751a8df42842 - migrated the codebase to use a simpler PROPERTY macro, arrrrrrrrrrrrrrrrrrrrrgh
Santeri Piippo <crimsondusk64@gmail.com>
parents: 641
diff changeset
61 PROPERTY (public, QToolButton*, toolButton, setToolButton, STOCK_WRITE)
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 public:
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 LDQuickColor (LDColor* color, QToolButton* toolButton);
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 bool isSeparator() const;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 static LDQuickColor getSeparator();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 };
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
70 //!
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
71 //! Object list class for MainWindow
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
72 //!
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 class ObjectList : public QListWidget
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
75 Q_OBJECT
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77 protected:
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 void contextMenuEvent (QContextMenuEvent* ev);
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 };
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
81 //!
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
82 //! @brief The main window class.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
83 //!
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
84 //! The MainWindow is LDForge's main GUI. It hosts the renderer, the object list,
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
85 //! the message log, etc. Contains @c slot_action(), which is what all actions
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
86 //! connect to.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
87 //!
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 class MainWindow : public QMainWindow
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90 Q_OBJECT
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 public:
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
93 //! Constructs the main window
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
94 explicit MainWindow (QWidget* parent = null, Qt::WindowFlags flags = 0);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
95
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
96 //! Rebuilds the object list, located to the right of the GUI.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 void buildObjList();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
98
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
99 //! Updates the window title.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 void updateTitle();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
101
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
102 //! Builds the object list and tells the GL renderer to init a full
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
103 //! refresh.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 void doFullRefresh();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
105
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
106 //! Builds the object list and tells the GL renderer to do a soft update.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 void refresh();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
108
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
109 //! @returns the suggested position to place a new object at.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 int getInsertionPoint();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
111
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
112 //! Updates the quick color toolbar
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
113 void updateColorToolbar();
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
114
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
115 //! Rebuilds the recent files submenu
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 void updateRecentFilesMenu();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
117
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
118 //! Sets the selection based on what's selected in the object list.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 void updateSelection();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
120
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
121 //! Updates the grids, selects the selected grid and deselects others.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 void updateGridToolBar();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
123
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
124 //! Updates the edit modes, current one is selected and others are deselected.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 void updateEditModeActions();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
126
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
127 //! Rebuilds the document tab list.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128 void updateDocumentList();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
129
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
130 //! Updates the document tab for @c doc. If no such tab exists, the
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
131 //! document list is rebuilt instead.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
132 void updateDocumentListItem (LDDocument* doc);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
133
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
134 //! @returns the uniform selected color (i.e. 4 if everything selected is
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
135 //! red), -1 if there is no such consensus.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136 int getSelectedColor();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
137
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
138 //! @returns the uniform selected type (i.e. @c LDObject::ELine if everything
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
139 //! selected is a line), @c LDObject::EUnidentified if there is no such
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
140 //! consensus.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 LDObject::Type getUniformSelectedType();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
142
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
143 //! Automatically scrolls the object list so that it points to the first
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
144 //! selected object.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 void scrollToSelection();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
146
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
147 //! Spawns the context menu at the given position.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 void spawnContextMenu (const QPoint pos);
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
149
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
150 //! Deletes all selected objects.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
151 //! @returns the count of deleted objects.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 int deleteSelection();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
153
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
154 //! Deletes all objects by the given color number.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
155 void deleteByColor (int colnum);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
156
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
157 //! Tries to save the given document.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
158 //! @param doc the document to save
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
159 //! @param saveAs if true, always ask for a file path
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
160 //! @returns whether the save was successful
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
161 bool save (LDDocument* doc, bool saveAs);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
162
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
163 //! Updates various actions, undo/redo are set enabled/disabled where
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
164 //! appropriate, togglable actions are updated based on configuration,
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
165 //! etc.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
166 void updateActions();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
168 //! @returns a pointer to the renderer
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
169 inline GLRenderer* R()
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171 return m_renderer;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172 }
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
174 //! Sets the quick color list to the given list of colors.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
175 inline void setQuickColors (const QList<LDQuickColor>& colors)
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
176 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177 m_quickColors = colors;
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
178 updateColorToolbar();
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
179 }
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
181 //! Adds a message to the renderer's message manager.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182 void addMessage (QString msg);
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
183
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
184 //! Updates the object list. Right now this just rebuilds it.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 void refreshObjectList();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
186
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
187 //! Updates all actions to ensure they have the correct shortcut as
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
188 //! defined in the configuration entries.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
189 void updateActionShortcuts();
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
190
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
191 //! Gets the shortcut configuration for the given @c action
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
192 KeySequenceConfig* shortcutForAction (QAction* action);
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
193
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
194 public slots:
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195 void changeCurrentFile();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
196 void slot_action();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 void slot_actionNew();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198 void slot_actionNewFile();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 void slot_actionOpen();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
200 void slot_actionDownloadFrom();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
201 void slot_actionSave();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202 void slot_actionSaveAs();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 void slot_actionSaveAll();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204 void slot_actionClose();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
205 void slot_actionCloseAll();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
206 void slot_actionInsertFrom();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
207 void slot_actionExportTo();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
208 void slot_actionSettings();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
209 void slot_actionSetLDrawPath();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
210 void slot_actionScanPrimitives();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211 void slot_actionExit();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
212 void slot_actionResetView();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
213 void slot_actionAxes();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
214 void slot_actionWireframe();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
215 void slot_actionBFCView();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
216 void slot_actionSetOverlay();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
217 void slot_actionClearOverlay();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
218 void slot_actionScreenshot();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
219 void slot_actionInsertRaw();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
220 void slot_actionNewSubfile();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221 void slot_actionNewLine();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
222 void slot_actionNewTriangle();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
223 void slot_actionNewQuad();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
224 void slot_actionNewCLine();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
225 void slot_actionNewComment();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
226 void slot_actionNewBFC();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
227 void slot_actionNewVertex();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
228 void slot_actionUndo();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
229 void slot_actionRedo();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
230 void slot_actionCut();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
231 void slot_actionCopy();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
232 void slot_actionPaste();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
233 void slot_actionDelete();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
234 void slot_actionSelectAll();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235 void slot_actionSelectByColor();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
236 void slot_actionSelectByType();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
237 void slot_actionModeDraw();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
238 void slot_actionModeSelect();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
239 void slot_actionModeCircle();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
240 void slot_actionSetDrawDepth();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241 void slot_actionSetColor();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
242 void slot_actionAutocolor();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
243 void slot_actionUncolorize();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
244 void slot_actionInline();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
245 void slot_actionInlineDeep();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
246 void slot_actionInvert();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
247 void slot_actionMakePrimitive();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
248 void slot_actionSplitQuads();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
249 void slot_actionEditRaw();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 void slot_actionBorders();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251 void slot_actionCornerVerts();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
252 void slot_actionRoundCoordinates();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
253 void slot_actionVisibilityHide();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
254 void slot_actionVisibilityReveal();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
255 void slot_actionVisibilityToggle();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
256 void slot_actionReplaceCoords();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
257 void slot_actionFlip();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
258 void slot_actionDemote();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
259 void slot_actionYtruder();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
260 void slot_actionRectifier();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
261 void slot_actionIntersector();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
262 void slot_actionIsecalc();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
263 void slot_actionCoverer();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
264 void slot_actionEdger2();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
265 void slot_actionHelp();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
266 void slot_actionAbout();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
267 void slot_actionAboutQt();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
268 void slot_actionGridCoarse();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
269 void slot_actionGridMedium();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
270 void slot_actionGridFine();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
271 void slot_actionEdit();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
272 void slot_actionMoveUp();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
273 void slot_actionMoveDown();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
274 void slot_actionMoveXNeg();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
275 void slot_actionMoveXPos();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
276 void slot_actionMoveYNeg();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
277 void slot_actionMoveYPos();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
278 void slot_actionMoveZNeg();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
279 void slot_actionMoveZPos();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
280 void slot_actionRotateXNeg();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
281 void slot_actionRotateXPos();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
282 void slot_actionRotateYNeg();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
283 void slot_actionRotateYPos();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
284 void slot_actionRotateZNeg();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
285 void slot_actionRotateZPos();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
286 void slot_actionRotationPoint();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
287 void slot_actionAddHistoryLine();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
288 void slot_actionJumpTo();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
289 void slot_actionSubfileSelection();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
290 void slot_actionDrawAngles();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
291
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
292 protected:
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
293 void closeEvent (QCloseEvent* ev);
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
294
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
295 private:
636
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
296 GLRenderer* m_renderer;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
297 LDObjectList m_sel;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
298 QList<LDQuickColor> m_quickColors;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
299 QList<QToolButton*> m_colorButtons;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
300 QList<QAction*> m_recentFiles;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
301 MessageManager* m_msglog;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
302 Ui_LDForgeUI* ui;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
303 QTabBar* m_tabs;
387b5e11c825 - replaced the left-hand document list with a tab bar
Santeri Piippo <crimsondusk64@gmail.com>
parents: 629
diff changeset
304 bool m_updatingTabs;
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
305
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
306 void endAction();
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
307
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
308 private slots:
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
309 void slot_selectionChanged();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
310 void slot_recentFile();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
311 void slot_quickColor();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312 void slot_lastSecondCleanup();
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313 void slot_editObject (QListWidgetItem* listitem);
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
314 };
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
315
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
316 //! Pointer to the instance of MainWindow.
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
317 extern MainWindow* g_win;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
318
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
319 //! Get an icon by name from the resources directory.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
320 QPixmap getIcon (QString iconName);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
321
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
322 //! @returns a list of quick colors based on the configuration entry.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
323 QList<LDQuickColor> quickColorsFromConfig();
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
324
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
325 //! Asks the user a yes/no question with the given @c message and the given
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
326 //! window @c title.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
327 //! @returns true if the user answered yes, false if no.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
328 bool confirm (QString title, QString message); // Generic confirm prompt
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
329
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
330 //! An overload of @c confirm(), this asks the user a yes/no question with the
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
331 //! given @c message.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
332 //! @returns true if the user answered yes, false if no.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
333 bool confirm (QString message);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
334
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
335 //! Displays an error prompt with the given @c message
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
336 void critical (QString message);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
337
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
338 //! Makes an icon of @c size x @c size pixels to represent @c colinfo
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
339 QIcon makeColorIcon (LDColor* colinfo, const int size);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
340
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
341 //! Fills the given combo-box with color information
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
342 void makeColorComboBox (QComboBox* box);
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
343
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
344 //! @returns a QImage from the given raw GL @c data
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 QImage imageFromScreencap (uchar* data, int w, int h);
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
346
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
347 //!
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
348 //! Takes in pairs of radio buttons and respective values and finds the first
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
349 //! selected one.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
350 //! @returns returns the value of the first found radio button that was checked
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
351 //! @returns by the user.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
352 //!
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353 template<class T>
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
354 T radioSwitch (const T& defval, QList<pair<QRadioButton*, T>> haystack)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
355 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
356 for (pair<QRadioButton*, const T&> i : haystack)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357 if (i.first->isChecked())
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
358 return i.second;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
360 return defval;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
361 }
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
362
646
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
363 //!
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
364 //! Takes in pairs of radio buttons and respective values and checks the first
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
365 //! found radio button whose respsective value matches @c expr have the given value.
1ccb092cebed - added doxygen support for MainWindow.h
Santeri Piippo <crimsondusk64@gmail.com>
parents: 642
diff changeset
366 //!
629
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
367 template<class T>
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
368 void radioDefault (const T& expr, QList<pair<QRadioButton*, T>> haystack)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
369 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
370 for (pair<QRadioButton*, const T&> i : haystack)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
372 if (i.second == expr)
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
373 {
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
374 i.first->setChecked (true);
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
375 return;
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
376 }
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
377 }
b75c6cce02e2 - refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
378 }

mercurial