zz_configDialog.cpp

Sun, 21 Apr 2013 04:17:05 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 21 Apr 2013 04:17:05 +0300
changeset 120
607301744394
parent 119
b93a64f5ee67
child 124
7962744759ad
permissions
-rw-r--r--

Rotation and rounding. Rotation needs work to get proper origin stuff

30
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
1 /*
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
2 * LDForge: LDraw parts authoring CAD
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
30
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
4 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
5 * This program is free software: you can redistribute it and/or modify
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
6 * it under the terms of the GNU General Public License as published by
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
8 * (at your option) any later version.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
9 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
10 * This program is distributed in the hope that it will be useful,
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
13 * GNU General Public License for more details.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
14 *
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
15 * You should have received a copy of the GNU General Public License
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
17 */
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
18
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include "common.h"
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include "zz_configDialog.h"
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "file.h"
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
22 #include "config.h"
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
23 #include "misc.h"
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
24 #include "colors.h"
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
25 #include "zz_colorSelectDialog.h"
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include <qgridlayout.h>
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include <qfiledialog.h>
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
28 #include <qcolordialog.h>
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
29 #include <qboxlayout.h>
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
30 #include <qevent.h>
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
31
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
32 extern_cfg (str, io_ldpath);
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
33 extern_cfg (str, gl_bgcolor);
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
34 extern_cfg (str, gl_maincolor);
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
35 extern_cfg (bool, lv_colorize);
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
36 extern_cfg (bool, gl_colorbfc);
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
37 extern_cfg (float, gl_maincolor_alpha);
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
38 extern_cfg (int, gl_linethickness);
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
39 extern_cfg (int, gui_toolbar_iconsize);
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
40 extern_cfg (str, gui_colortoolbar);
106
46e4202a44fc Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
41 extern_cfg (bool, gl_selflash);
69
6790dea720a8 Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 68
diff changeset
42
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
43 ConfigDialog* g_ConfigDialog = null;
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44
54
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
45 #define INIT_CHECKBOX(BOX, CFG) \
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
46 BOX->setCheckState (CFG ? Qt::Checked : Qt::Unchecked);
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
47
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
48 #define APPLY_CHECKBOX(BTN, CFG) \
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
49 CFG = BTN->checkState() == Qt::Checked;
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
50
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 // =============================================================================
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 // =============================================================================
30
31ff9aabd506 Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 29
diff changeset
54 ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) {
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
55 g_ConfigDialog = this;
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
56 qTabs = new QTabWidget;
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
57
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
58 initMainTab ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
59 initShortcutsTab ();
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
60 initQuickColorTab ();
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
61
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
62 IMPLEMENT_DIALOG_BUTTONS
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
63
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
64 QVBoxLayout* layout = new QVBoxLayout;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
65 layout->addWidget (qTabs);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
66 layout->addWidget (qButtons);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
67 setLayout (layout);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
68
119
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
69 setWindowTitle (APPNAME_DISPLAY " - Settings");
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
70 setWindowIcon (QIcon ("icons/settings.png"));
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
71 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
72
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
73 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
74 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
75 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
76 void ConfigDialog::initMainTab () {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
77 qMainTab = new QWidget;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
79 // =========================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
80 // LDraw path
119
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
81 qLDrawPathLabel = new QLabel ("LDraw path:");
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
82
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 qLDrawPath = new QLineEdit;
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84 qLDrawPath->setText (io_ldpath.value.chars());
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 qLDrawPathFindButton = new QPushButton;
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
87 qLDrawPathFindButton->setIcon (QIcon ("icons/folder.png"));
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
88 connect (qLDrawPathFindButton, SIGNAL (clicked ()),
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 this, SLOT (slot_findLDrawPath ()));
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
119
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
91 QHBoxLayout* qLDrawPathLayout = new QHBoxLayout;
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
92 qLDrawPathLayout->addWidget (qLDrawPath);
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
93 qLDrawPathLayout->addWidget (qLDrawPathFindButton);
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
94
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
95 // =========================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
96 // Background and foreground colors
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
97 qGLBackgroundLabel = new QLabel ("Background color:");
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
98 qGLBackgroundButton = new QPushButton;
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
99 setButtonBackground (qGLBackgroundButton, gl_bgcolor.value);
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
100 connect (qGLBackgroundButton, SIGNAL (clicked ()),
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
101 this, SLOT (slot_setGLBackground ()));
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
102
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
103 qGLForegroundLabel = new QLabel ("Foreground color:");
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
104 qGLForegroundButton = new QPushButton;
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
105 setButtonBackground (qGLForegroundButton, gl_maincolor.value);
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
106 connect (qGLForegroundButton, SIGNAL (clicked ()),
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
107 this, SLOT (slot_setGLForeground ()));
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
108
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
109 // =========================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
110 // Alpha and line thickness sliders
70
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
111 qGLForegroundAlphaLabel = new QLabel ("Alpha:");
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
112 makeSlider (qGLForegroundAlpha, 1, 10, (gl_maincolor_alpha * 10.0f));
68
c637b172d565 Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 54
diff changeset
113
53
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
114 qGLLineThicknessLabel = new QLabel ("Line thickness:");
70
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
115 makeSlider (qGLLineThickness, 1, 8, gl_linethickness);
53
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
116
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
117 // =========================================================================
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
118 // Tool bar icon size slider
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
119 qToolBarIconSizeLabel = new QLabel ("Toolbar icon size:");
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
120 makeSlider (qToolBarIconSize, 1, 5, (gui_toolbar_iconsize - 12) / 4);
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
121
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
122 // =========================================================================
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
123 // List view colorizer and BFC red/green view checkboxes
52
d71226763607 Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 47
diff changeset
124 qLVColorize = new QCheckBox ("Colorize polygons in list view");
54
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
125 INIT_CHECKBOX (qLVColorize, lv_colorize)
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
126
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
127 qGLColorBFC = new QCheckBox ("Red/green BFC view");
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
128 INIT_CHECKBOX (qGLColorBFC, gl_colorbfc)
52
d71226763607 Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 47
diff changeset
129
106
46e4202a44fc Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
130 qGLSelFlash = new QCheckBox ("Selection flash");
46e4202a44fc Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
131 INIT_CHECKBOX (qGLSelFlash, gl_selflash)
46e4202a44fc Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
132
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 QGridLayout* layout = new QGridLayout;
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 layout->addWidget (qLDrawPathLabel, 0, 0);
119
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
135 layout->addLayout (qLDrawPathLayout, 0, 1, 1, 3);
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
136
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
137 layout->addWidget (qGLBackgroundLabel, 1, 0);
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
138 layout->addWidget (qGLBackgroundButton, 1, 1);
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
139 layout->addWidget (qGLForegroundLabel, 1, 2);
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
140 layout->addWidget (qGLForegroundButton, 1, 3);
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
141
53
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
142 layout->addWidget (qGLLineThicknessLabel, 2, 0);
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
143 layout->addWidget (qGLLineThickness, 2, 1);
68
c637b172d565 Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 54
diff changeset
144 layout->addWidget (qGLForegroundAlphaLabel, 2, 2);
c637b172d565 Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 54
diff changeset
145 layout->addWidget (qGLForegroundAlpha, 2, 3);
52
d71226763607 Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 47
diff changeset
146
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
147 layout->addWidget (qToolBarIconSizeLabel, 3, 0);
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
148 layout->addWidget (qToolBarIconSize, 3, 1);
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
149
119
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
150 layout->addWidget (qLVColorize, 4, 0, 1, 4);
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
151 layout->addWidget (qGLColorBFC, 5, 0, 1, 4);
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
152 layout->addWidget (qGLSelFlash, 6, 0, 1, 4);
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
153 qMainTab->setLayout (layout);
53
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
154
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
155 // Add the tab to the manager
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
156 qTabs->addTab (qMainTab, "Main settings");
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
157 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
158
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
159 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
161 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
162 void ConfigDialog::initShortcutsTab () {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
163 QGridLayout* qLayout;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
164
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
165 qShortcutsTab = new QWidget;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
166 qShortcutList = new QListWidget;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
167 qLayout = new QGridLayout;
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
168
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
169 // Init table items
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
170 ulong i = 0;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
171 for (actionmeta meta : g_ActionMeta) {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
172 QAction* const qAct = *meta.qAct;
119
b93a64f5ee67 some GUI tweaks
Santeri Piippo <crimsondusk64@gmail.com>
parents: 116
diff changeset
173
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
174 QListWidgetItem* qItem = new QListWidgetItem;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
175 setShortcutText (qItem, meta);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
176 qItem->setIcon (qAct->icon ());
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
177
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
178 qaShortcutItems.push_back (qItem);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
179 qShortcutList->insertItem (i, qItem);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
180 ++i;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
181 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
182
83
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
183 qSetShortcut = new QPushButton ("Set");
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
184 qResetShortcut = new QPushButton ("Reset");
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
185 qClearShortcut = new QPushButton ("Clear");
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
186
83
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
187 connect (qSetShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ()));
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
188 connect (qResetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ()));
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
189 connect (qClearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ()));
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
190
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
191 QVBoxLayout* qButtonLayout = new QVBoxLayout;
83
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
192 qButtonLayout->addWidget (qSetShortcut);
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
193 qButtonLayout->addWidget (qResetShortcut);
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
194 qButtonLayout->addWidget (qClearShortcut);
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
195 qButtonLayout->addStretch (10);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
196
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
197 qLayout->addWidget (qShortcutList, 0, 0);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
198 qLayout->addLayout (qButtonLayout, 0, 1);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
199 qShortcutsTab->setLayout (qLayout);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
200 qTabs->addTab (qShortcutsTab, "Shortcuts");
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
201 }
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 // =============================================================================
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
205 // =============================================================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
206 void ConfigDialog::initQuickColorTab () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
207 qQuickColorTab = new QWidget;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
208
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
209 qAddColor = new QPushButton (getIcon ("palette"), "Add");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
210 qDelColor = new QPushButton (getIcon ("delete"), "Remove");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
211 qChangeColor = new QPushButton (getIcon ("palette"), "Set");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
212 qAddColorSeparator = new QPushButton ("Add Separator");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
213 qMoveColorUp = new QPushButton (getIcon ("arrow-up"), "Move Up");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
214 qMoveColorDown = new QPushButton (getIcon ("arrow-down"), "Move Down");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
215 qClearColors = new QPushButton (getIcon ("delete-all"), "Clear");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
216
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
217 qQuickColorList = new QListWidget;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
218
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
219 quickColorMeta = parseQuickColorMeta ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
220 updateQuickColorList ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
221
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
222 QVBoxLayout* qButtonLayout = new QVBoxLayout;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
223 qButtonLayout->addWidget (qAddColor);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
224 qButtonLayout->addWidget (qDelColor);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
225 qButtonLayout->addWidget (qChangeColor);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
226 qButtonLayout->addWidget (qAddColorSeparator);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
227 qButtonLayout->addWidget (qMoveColorUp);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
228 qButtonLayout->addWidget (qMoveColorDown);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
229 qButtonLayout->addWidget (qClearColors);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
230 qButtonLayout->addStretch (1);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
231
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
232 connect (qAddColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
233 connect (qDelColor, SIGNAL (clicked ()), this, SLOT (slot_delColor ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
234 connect (qChangeColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
235 connect (qAddColorSeparator, SIGNAL (clicked ()), this, SLOT (slot_addColorSeparator ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
236 connect (qMoveColorUp, SIGNAL (clicked ()), this, SLOT (slot_moveColor ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
237 connect (qMoveColorDown, SIGNAL (clicked ()), this, SLOT (slot_moveColor ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
238 connect (qClearColors, SIGNAL (clicked ()), this, SLOT (slot_clearColors ()));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
239
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
240 QGridLayout* qLayout = new QGridLayout;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
241 qLayout->addWidget (qQuickColorList, 0, 0);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
242 qLayout->addLayout (qButtonLayout, 0, 1);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
243
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
244 qQuickColorTab->setLayout (qLayout);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
245 qTabs->addTab (qQuickColorTab, "Quick Colors");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
246 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
247
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
248 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
249 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
250 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
251 void ConfigDialog::updateQuickColorList (quickColorMetaEntry* pSel) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
252 for (QListWidgetItem* qItem : qaQuickColorItems)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
253 delete qItem;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
254
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
255 qaQuickColorItems.clear ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
256
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
257 // Init table items
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
258 for (quickColorMetaEntry& entry : quickColorMeta) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
259 QListWidgetItem* qItem = new QListWidgetItem;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
260
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
261 if (entry.bSeparator) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
262 qItem->setText ("--------");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
263 qItem->setIcon (getIcon ("empty"));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
264 } else {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
265 color* col = entry.col;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
266
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
267 if (col == null) {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
268 qItem->setText ("[[unknown color]]");
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
269 qItem->setIcon (getIcon ("error"));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
270 } else {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
271 qItem->setText (col->zName);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
272 qItem->setIcon (getIcon ("palette"));
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
273 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
274 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
275
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
276 qQuickColorList->addItem (qItem);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
277 qaQuickColorItems.push_back (qItem);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
278
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
279 if (pSel && &entry == pSel) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
280 qQuickColorList->setCurrentItem (qItem);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
281 qQuickColorList->scrollToItem (qItem);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
282 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
283 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
284 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
285
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
286 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
287 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
288 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
289 void ConfigDialog::slot_setColor () {
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
290 quickColorMetaEntry* pEntry = null;
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
291 QListWidgetItem* qItem = null;
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
292 const bool bNew = static_cast<QPushButton*> (sender ()) == qAddColor;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
293
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
294 if (bNew == false) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
295 qItem = getSelectedQuickColor ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
296 if (!qItem)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
297 return;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
298
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
299 ulong ulIdx = getItemRow (qItem, qaQuickColorItems);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
300 pEntry = &quickColorMeta[ulIdx];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
301
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
302 if (pEntry->bSeparator == true)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
303 return; // don't color separators
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
304 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
305
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
306 short dDefault = pEntry ? pEntry->col->index () : -1;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
307 short dValue;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
308
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
309 if (ColorSelectDialog::staticDialog (dValue, dDefault, this) == false)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
310 return;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
311
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
312 if (pEntry)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
313 pEntry->col = getColor (dValue);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
314 else {
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
315 quickColorMetaEntry entry = {getColor (dValue), null, false};
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
316
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
317 qItem = getSelectedQuickColor ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
318 ulong idx;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
319
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
320 if (qItem)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
321 idx = getItemRow (qItem, qaQuickColorItems) + 1;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
322 else
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
323 idx = qaQuickColorItems.size();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
324
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
325 quickColorMeta.insert (quickColorMeta.begin() + idx, entry);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
326 pEntry = &quickColorMeta[idx];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
327 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
328
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
329 updateQuickColorList (pEntry);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
330 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
331
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
332 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
333 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
334 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
335 void ConfigDialog::slot_delColor () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
336 if (qQuickColorList->selectedItems().size() == 0)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
337 return;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
338
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
339 QListWidgetItem* qItem = qQuickColorList->selectedItems ()[0];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
340 ulong ulIdx = getItemRow (qItem, qaQuickColorItems);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
341 quickColorMeta.erase (quickColorMeta.begin () + ulIdx);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
342 updateQuickColorList ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
343 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
344
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
345 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
346 void ConfigDialog::slot_moveColor () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
347 const bool bUp = (static_cast<QPushButton*> (sender()) == qMoveColorUp);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
348
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
349 if (qQuickColorList->selectedItems().size() == 0)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
350 return;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
351
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
352 QListWidgetItem* qItem = qQuickColorList->selectedItems ()[0];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
353 ulong ulIdx = getItemRow (qItem, qaQuickColorItems);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
354
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
355 long lDest = bUp ? (ulIdx - 1) : (ulIdx + 1);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
356
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
357 if (lDest < 0 || (ulong)lDest >= qaQuickColorItems.size ())
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
358 return; // destination out of bounds
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
359
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
360 quickColorMetaEntry tmp = quickColorMeta[lDest];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
361 quickColorMeta[lDest] = quickColorMeta[ulIdx];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
362 quickColorMeta[ulIdx] = tmp;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
363
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
364 updateQuickColorList (&quickColorMeta[lDest]);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
365 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
366
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
367 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
368 void ConfigDialog::slot_addColorSeparator() {
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
369 quickColorMeta.push_back ({null, null, true});
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
370 updateQuickColorList (&quickColorMeta[quickColorMeta.size () - 1]);
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
371 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
372
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
373 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
374 void ConfigDialog::slot_clearColors () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
375 quickColorMeta.clear ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
376 updateQuickColorList ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
377 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
378
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
379 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
380 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
381 // =============================================================================
70
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
382 void ConfigDialog::makeSlider (QSlider*& qSlider, short int dMin, short int dMax,
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
383 short dDefault)
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
384 {
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
385 qSlider = new QSlider (Qt::Horizontal);
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
386 qSlider->setRange (dMin, dMax);
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
387 qSlider->setSliderPosition (dDefault);
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
388 qSlider->setTickPosition (QSlider::TicksAbove);
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
389 qSlider->setTickInterval (1);
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
390 }
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
391
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
392 // =============================================================================
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
393 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e6b8dab8f81a Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 69
diff changeset
394 // =============================================================================
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
395 ConfigDialog::~ConfigDialog () {
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
396 g_ConfigDialog = null;
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
397 }
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
398
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
399 // =============================================================================
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
400 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
401 // =============================================================================
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
402 void ConfigDialog::slot_findLDrawPath () {
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
403 str zDir = QFileDialog::getExistingDirectory (this, "Choose LDraw directory",
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
404 qLDrawPath->text());
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
405
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
406 if (~zDir)
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
407 qLDrawPath->setText (zDir.chars());
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
408 }
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
409
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410 // =============================================================================
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
411 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
412 // =============================================================================
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
413 void ConfigDialog::pickColor (strconfig& cfg, QPushButton* qButton) {
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
414 QColorDialog dlg (QColor (cfg.value.chars()));
33
3e0cca764fd6 Added color selection icon
Santeri Piippo <crimsondusk64@gmail.com>
parents: 32
diff changeset
415 dlg.setWindowIcon (QIcon ("icons/colorselect.png"));
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
416
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
417 if (dlg.exec ()) {
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
418 uchar r = dlg.currentColor ().red (),
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
419 g = dlg.currentColor ().green (),
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
420 b = dlg.currentColor ().blue ();
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
421 cfg.value.format ("#%.2X%.2X%.2X", r, g, b);
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
422 setButtonBackground (qButton, cfg.value);
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
423 }
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
424 }
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
425
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
426 void ConfigDialog::slot_setGLBackground () {
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
427 pickColor (gl_bgcolor, qGLBackgroundButton);
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
428 }
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
429
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
430 void ConfigDialog::slot_setGLForeground () {
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
431 pickColor (gl_maincolor, qGLForegroundButton);
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
432 }
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
433
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
434 // =============================================================================
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
435 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
436 // =============================================================================
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
437 void ConfigDialog::setButtonBackground (QPushButton* qButton, str zValue) {
34
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
438 qButton->setIcon (QIcon ("icons/colorselect.png"));
d99006de6261 Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents: 33
diff changeset
439 qButton->setAutoFillBackground (true);
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
440 qButton->setStyleSheet (
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
441 format ("background-color: %s", zValue.chars()).chars()
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
442 );
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
443 }
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
444
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
445 // =============================================================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
446 long ConfigDialog::getItemRow (QListWidgetItem* qItem, std::vector<QListWidgetItem*>& haystack) {
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
447 long i = 0;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
448
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
449 for (QListWidgetItem* it : haystack) {
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
450 if (it == qItem)
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
451 return i;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
452 ++i;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
453 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
454
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
455 return -1;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
456 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
457
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
458 // =============================================================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
459 QListWidgetItem* ConfigDialog::getSelectedQuickColor () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
460 if (qQuickColorList->selectedItems().size() == 0)
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
461 return null;
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
462
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
463 return qQuickColorList->selectedItems ()[0];
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
464 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
465
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
466 // =============================================================================
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
467 void ConfigDialog::slot_setShortcut () {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
468 QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
469
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
470 if (qaSel.size() < 1)
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
471 return;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
472
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
473 QListWidgetItem* qItem = qaSel[0];
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
474
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
475 // Find the row this object is on.
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
476 long idx = getItemRow (qItem, qaShortcutItems);
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
477
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
478 if (KeySequenceDialog::staticDialog (g_ActionMeta[idx], this))
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
479 setShortcutText (qItem, g_ActionMeta[idx]);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
480 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
481
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
482 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
483 void ConfigDialog::slot_resetShortcut () {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
484 QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
485
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
486 for (QListWidgetItem* qItem : qaSel) {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
487 long idx = getItemRow (qItem, qaShortcutItems);
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
488
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
489 actionmeta meta = g_ActionMeta[idx];
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
490 keyseqconfig* conf = g_ActionMeta[idx].conf;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
491
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
492 conf->reset ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
493 (*meta.qAct)->setShortcut (*conf);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
494
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
495 setShortcutText (qItem, meta);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
496 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
497 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
498
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
499 // =============================================================================
83
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
500 void ConfigDialog::slot_clearShortcut () {
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
501 QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems ();
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
502 QKeySequence qDummySeq;
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
503
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
504 for (QListWidgetItem* qItem : qaSel) {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
505 long idx = getItemRow (qItem, qaShortcutItems);
83
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
506
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
507 actionmeta meta = g_ActionMeta[idx];
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
508 keyseqconfig* conf = g_ActionMeta[idx].conf;
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
509 conf->value = qDummySeq;
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
510
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
511 (*meta.qAct)->setShortcut (*conf);
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
512 setShortcutText (qItem, meta);
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
513 }
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
514 }
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
515
614ec2640e40 Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 78
diff changeset
516 // =============================================================================
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
517 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
518 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
519 void ConfigDialog::setShortcutText (QListWidgetItem* qItem, actionmeta meta) {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
520 QAction* const qAct = *meta.qAct;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
521 str zLabel = qAct->iconText ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
522 str zKeybind = qAct->shortcut ().toString ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
523
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
524 qItem->setText (format ("%s (%s)", zLabel.chars () ,zKeybind.chars ()).chars());
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
525 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
526
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
527 // =============================================================================
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
528 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
529 // =============================================================================
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
530 str ConfigDialog::makeColorToolBarString () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
531 str zVal;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
532
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
533 for (quickColorMetaEntry entry : quickColorMeta) {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
534 if (~zVal > 0)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
535 zVal += ':';
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
536
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
537 if (entry.bSeparator)
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
538 zVal += '|';
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
539 else
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
540 zVal.appendformat ("%d", entry.col->index ());
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
541 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
542
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
543 return zVal;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
544 }
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
545
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
546 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
547 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
548 // =============================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
549 void ConfigDialog::staticDialog () {
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
550 ConfigDialog dlg (g_ForgeWindow);
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
551
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
552 if (dlg.exec ()) {
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
553 io_ldpath = dlg.qLDrawPath->text();
54
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
554
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
555 APPLY_CHECKBOX (dlg.qLVColorize, lv_colorize)
60f328f352c9 Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents: 53
diff changeset
556 APPLY_CHECKBOX (dlg.qGLColorBFC, gl_colorbfc)
106
46e4202a44fc Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
557 APPLY_CHECKBOX (dlg.qGLSelFlash, gl_selflash)
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
558
68
c637b172d565 Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 54
diff changeset
559 gl_maincolor_alpha = ((double)dlg.qGLForegroundAlpha->value ()) / 10.0f;
53
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
560 gl_linethickness = dlg.qGLLineThickness->value ();
88
652028158792 Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents: 83
diff changeset
561 gui_toolbar_iconsize = (dlg.qToolBarIconSize->value () * 4) + 12;
53
170cdffe1056 Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 52
diff changeset
562
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
563 // Manage the quick color toolbar
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
564 g_ForgeWindow->quickColorMeta = dlg.quickColorMeta;
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
565 gui_colortoolbar = dlg.makeColorToolBarString ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
566
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
567 // Save the config
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
568 config::save ();
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
569
32
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
570 // Reload all subfiles
5d22b7ecf110 Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents: 30
diff changeset
571 reloadAllSubfiles ();
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
572
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
573 g_ForgeWindow->R->setBackground ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
574 g_ForgeWindow->refresh ();
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
575 g_ForgeWindow->updateToolBars ();
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
576 }
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
577 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
578
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
579 // =========================================================================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
580 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
581 // =========================================================================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
582 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
583 // =========================================================================================================================
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
584 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 88
diff changeset
585 // =========================================================================================================================
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
586 KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent,
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
587 Qt::WindowFlags f) : QDialog (parent, f), seq (seq)
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
588 {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
589 qOutput = new QLabel;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
590 IMPLEMENT_DIALOG_BUTTONS
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
591
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
592 setWhatsThis ("Into this dialog you can input a key sequence for use as a "
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
593 "shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to "
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
594 "dismiss.");
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
595
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
596 QVBoxLayout* layout = new QVBoxLayout;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
597 layout->addWidget (qOutput);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
598 layout->addWidget (qButtons);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
599 setLayout (layout);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
600
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
601 updateOutput ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
602 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
603
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
604 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
605 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
606 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
607 bool KeySequenceDialog::staticDialog (actionmeta& meta, QWidget* parent) {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
608 KeySequenceDialog dlg (*meta.conf, parent);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
609
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
610 if (dlg.exec () == false)
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
611 return false;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
612
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
613 *meta.conf = dlg.seq;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
614 (*meta.qAct)->setShortcut (*meta.conf);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
615 return true;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
616 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
617
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
618 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
619 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
620 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
621 void KeySequenceDialog::updateOutput () {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
622 str zShortcut = seq.toString ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
623
116
4fde8fdf258a Some renaming
Santeri Piippo <crimsondusk64@gmail.com>
parents: 106
diff changeset
624 str zText = format ("<center><b>%s</b></center>", zShortcut.chars ());
78
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
625
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
626 qOutput->setText (zText);
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
627 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
628
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
629 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
630 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
631 // =============================================================================
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
632 void KeySequenceDialog::keyPressEvent (QKeyEvent* ev) {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
633 seq = ev->key ();
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
634
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
635 switch (seq) {
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
636 case Qt::Key_Shift:
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
637 case Qt::Key_Control:
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
638 case Qt::Key_Alt:
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
639 case Qt::Key_Meta:
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
640 seq = 0;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
641 break;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
642
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
643 default:
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
644 break;
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
645 }
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
646
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
647 seq = (seq | ev->modifiers ());
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
648
c190fe218506 Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 70
diff changeset
649 updateOutput ();
29
55406ce7446e Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
650 }

mercurial