Wed, 08 May 2013 14:57:48 +0300
Viewport no longer offsets stuff based on bbox size, that was stupid. Only use bbox size for initial zoom.
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 | 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> |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
31 | #include <qgroupbox.h> |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
32 | |
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
|
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); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
42 | extern_cfg (bool, edit_schemanticinline); |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
43 | extern_cfg (bool, gl_blackedges); |
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
|
44 | |
104 | 45 | ConfigDialog* g_ConfigDialog = null; |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
47 | #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
|
48 | 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
|
49 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
50 | #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
|
51 | 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
|
52 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | // ============================================================================= |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
56 | ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) { |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
57 | g_ConfigDialog = this; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
58 | tabs = new QTabWidget; |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
59 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
60 | initMainTab (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
61 | initShortcutsTab (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
62 | initQuickColorTab (); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
63 | initGridTab (); |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
64 | initExtProgTab (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
65 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
66 | IMPLEMENT_DIALOG_BUTTONS |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
67 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
68 | QVBoxLayout* layout = new QVBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
69 | layout->addWidget (tabs); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
70 | layout->addWidget (bbx_buttons); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
71 | setLayout (layout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
72 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
73 | setWindowTitle ("Settings"); |
158
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
156
diff
changeset
|
74 | setWindowIcon (getIcon ("settings")); |
78
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 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
77 | // ============================================================================= |
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 | void ConfigDialog::initMainTab () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
81 | mainTab = new QWidget; |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
82 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
83 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
84 | // Background and foreground colors |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
85 | lb_viewBg = new QLabel ("Background color:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
86 | pb_viewBg = new QPushButton; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
87 | setButtonBackground (pb_viewBg, gl_bgcolor.value); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
88 | connect (pb_viewBg, SIGNAL (clicked ()), |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
89 | this, SLOT (slot_setGLBackground ())); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
90 | pb_viewBg->setWhatsThis ("This is the background color for the viewport."); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
91 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
92 | lb_viewFg = new QLabel ("Foreground color:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
93 | pb_viewFg = new QPushButton; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
94 | setButtonBackground (pb_viewFg, gl_maincolor.value); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
95 | connect (pb_viewFg, SIGNAL (clicked ()), |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
96 | this, SLOT (slot_setGLForeground ())); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
97 | pb_viewFg->setWhatsThis ("This color is used for the main color."); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
98 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
99 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
100 | // Alpha and line thickness sliders |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
101 | lb_viewFgAlpha = new QLabel ("Alpha:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
102 | makeSlider (sl_viewFgAlpha, 1, 10, (gl_maincolor_alpha * 10.0f)); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
103 | sl_viewFgAlpha->setWhatsThis ("Opacity of main color in the viewport."); |
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
|
104 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
105 | lb_lineThickness = new QLabel ("Line thickness:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
106 | makeSlider (sl_lineThickness, 1, 8, gl_linethickness); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
107 | sl_lineThickness->setWhatsThis ("How thick lines should be drawn in the viewport."); |
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
|
108 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
109 | // ========================================================================= |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
110 | // Tool bar icon size slider |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
111 | lb_iconSize = new QLabel ("Toolbar icon size:"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
112 | makeSlider (sl_iconSize, 1, 5, (gui_toolbar_iconsize - 12) / 4); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
113 | |
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
114 | // ========================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
115 | // List view colorizer and BFC red/green view checkboxes |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
116 | cb_colorize = new QCheckBox ("Colorize polygons in object list"); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
117 | cb_colorize->setChecked (lv_colorize); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
118 | cb_colorize->setWhatsThis ("Makes colored objects (non-16 and 24) appear " |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
119 | "colored in the object list. A red polygon will have its description " |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
120 | "written in red text."); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
121 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
122 | cb_colorBFC = new QCheckBox ("Red/green BFC view"); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
123 | cb_colorBFC->setChecked (gl_colorbfc); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
124 | cb_colorBFC->setWhatsThis ("Polygons' front sides become green and back " |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
125 | "sides red. Not implemented yet."); |
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
|
126 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
127 | cb_selFlash = new QCheckBox ("Selection flash"); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
128 | cb_selFlash->setChecked (gl_selflash); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
129 | cb_colorBFC->setWhatsThis ("A pulse effect for clearer selection view."); |
106
46e4202a44fc
Added additive selection blending, with a toggable flash effect. :P
Santeri Piippo <crimsondusk64@gmail.com>
parents:
104
diff
changeset
|
130 | |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
131 | cb_blackEdges = new QCheckBox ("Black edges"); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
132 | cb_blackEdges->setWhatsThis ("Makes all edgelines appear black. If this is " |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
133 | "not set, edge lines take their color as defined in LDConfig.ldr"); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
134 | cb_blackEdges->setChecked (gl_blackedges); |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
135 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
136 | cb_schemanticInline = new QCheckBox ("Schemantic insertion only"); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
137 | cb_schemanticInline->setChecked (edit_schemanticinline); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
138 | cb_colorBFC->setWhatsThis ("When inserting objects through inlining, file " |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
139 | "inserting or through external programs, all non-schemantics (those without " |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
140 | "actual meaning in the part file like comments and such) are filtered out."); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
141 | |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
142 | cb_schemanticInline->setEnabled (false); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
143 | cb_colorBFC->setEnabled (false); |
141
184d117e1b12
corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
135
diff
changeset
|
144 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | QGridLayout* layout = new QGridLayout; |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
146 | layout->addWidget (lb_viewBg, 0, 0); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
147 | layout->addWidget (pb_viewBg, 0, 1); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
148 | layout->addWidget (lb_viewFg, 0, 2); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
149 | layout->addWidget (pb_viewFg, 0, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
150 | |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
151 | layout->addWidget (lb_lineThickness, 1, 0); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
152 | layout->addWidget (sl_lineThickness, 1, 1); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
153 | layout->addWidget (lb_viewFgAlpha, 1, 2); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
154 | layout->addWidget (sl_viewFgAlpha, 1, 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
|
155 | |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
156 | layout->addWidget (lb_iconSize, 2, 0); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
157 | layout->addWidget (sl_iconSize, 2, 1); |
88
652028158792
Allow the user to alter the tool bar icon size
Santeri Piippo <crimsondusk64@gmail.com>
parents:
83
diff
changeset
|
158 | |
180
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
159 | layout->addWidget (cb_colorize, 3, 0, 1, 4); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
160 | layout->addWidget (cb_colorBFC, 4, 0, 1, 4); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
161 | layout->addWidget (cb_selFlash, 5, 0, 1, 4); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
162 | layout->addWidget (cb_blackEdges, 6, 0, 1, 4); |
16306e69a895
Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
175
diff
changeset
|
163 | layout->addWidget (cb_schemanticInline, 7, 0, 1, 4); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
164 | mainTab->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
|
165 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
166 | // Add the tab to the manager |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
167 | tabs->addTab (mainTab, "Main settings"); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
168 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
169 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
170 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
171 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
172 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
173 | void ConfigDialog::initShortcutsTab () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
174 | shortcutsTab = new QWidget; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
175 | lw_shortcutList = new QListWidget; |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
176 | lw_shortcutList->setAlternatingRowColors (true); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | |
156
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
178 | shortcutsTab->setWhatsThis ("Here you can alter keyboard shortcuts for " |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
179 | "almost all LDForge actions. Only exceptions are the controls for the " |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
180 | "viewport. Use the set button to set a key shortcut, clear to remove it " |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
181 | "and reset to restore the shortcut to its default value.\n" |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
182 | "\tShortcut changes apply immediately after closing this dialog." ); |
d35b7e440585
Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents:
141
diff
changeset
|
183 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
184 | // Init table items |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
185 | ulong i = 0; |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
186 | for (actionmeta& info : g_ActionMeta) { |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
187 | QAction* const act = *info.qAct; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
188 | |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
189 | ShortcutListItem* item = new ShortcutListItem; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
190 | setShortcutText (item, info); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
191 | item->setIcon (act->icon ()); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
192 | item->setActionInfo (&info); |
119 | 193 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
194 | // If the action doesn't have a valid icon, use an empty one |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
195 | // so that the list is kept aligned. |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
196 | if (act->icon ().isNull ()) |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
197 | item->setIcon (getIcon ("empty")); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
198 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
199 | lw_shortcutList->insertItem (i++, item); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
200 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
201 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
202 | lw_shortcutList->setSortingEnabled (true); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
203 | lw_shortcutList->sortItems (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
204 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
205 | pb_setShortcut = new QPushButton ("Set"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
206 | pb_resetShortcut = new QPushButton ("Reset"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
207 | pb_clearShortcut = new QPushButton ("Clear"); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
208 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
209 | connect (pb_setShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
210 | connect (pb_resetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
211 | connect (pb_clearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ())); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
212 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
213 | QVBoxLayout* buttonLayout = new QVBoxLayout; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
214 | buttonLayout->addWidget (pb_setShortcut); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
215 | buttonLayout->addWidget (pb_resetShortcut); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
216 | buttonLayout->addWidget (pb_clearShortcut); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
217 | buttonLayout->addStretch (10); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
218 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
219 | QGridLayout* layout = new QGridLayout; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
220 | layout->addWidget (lw_shortcutList, 0, 0); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
221 | layout->addLayout (buttonLayout, 0, 1); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
222 | shortcutsTab->setLayout (layout); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
223 | tabs->addTab (shortcutsTab, "Shortcuts"); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
229 | void ConfigDialog::initQuickColorTab () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
230 | quickColorTab = new QWidget; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
231 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
232 | pb_addColor = new QPushButton (getIcon ("palette"), "Add"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
233 | pb_delColor = new QPushButton (getIcon ("delete"), "Remove"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
234 | pb_changeColor = new QPushButton (getIcon ("palette"), "Set"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
235 | pb_addColorSeparator = new QPushButton ("Add Separator"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
236 | pb_moveColorUp = new QPushButton (getIcon ("arrow-up"), "Move Up"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
237 | pb_moveColorDown = new QPushButton (getIcon ("arrow-down"), "Move Down"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
238 | pb_clearColors = new QPushButton (getIcon ("delete-all"), "Clear"); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
239 | lw_quickColors = new QListWidget; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
240 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
241 | quickColorMeta = parseQuickColorMeta (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
242 | updateQuickColorList (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
243 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
244 | QVBoxLayout* buttonLayout = new QVBoxLayout; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
245 | buttonLayout->addWidget (pb_addColor); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
246 | buttonLayout->addWidget (pb_delColor); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
247 | buttonLayout->addWidget (pb_changeColor); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
248 | buttonLayout->addWidget (pb_addColorSeparator); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
249 | buttonLayout->addWidget (pb_moveColorUp); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
250 | buttonLayout->addWidget (pb_moveColorDown); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
251 | buttonLayout->addWidget (pb_clearColors); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
252 | buttonLayout->addStretch (1); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
253 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
254 | connect (pb_addColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
255 | connect (pb_delColor, SIGNAL (clicked ()), this, SLOT (slot_delColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
256 | connect (pb_changeColor, SIGNAL (clicked ()), this, SLOT (slot_setColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
257 | connect (pb_addColorSeparator, SIGNAL (clicked ()), this, SLOT (slot_addColorSeparator ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
258 | connect (pb_moveColorUp, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
259 | connect (pb_moveColorDown, SIGNAL (clicked ()), this, SLOT (slot_moveColor ())); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
260 | connect (pb_clearColors, SIGNAL (clicked ()), this, SLOT (slot_clearColors ())); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
261 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
262 | QGridLayout* layout = new QGridLayout; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
263 | layout->addWidget (lw_quickColors, 0, 0); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
264 | layout->addLayout (buttonLayout, 0, 1); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
265 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
266 | quickColorTab->setLayout (layout); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
267 | tabs->addTab (quickColorTab, "Quick Colors"); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
268 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
269 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
270 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
271 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
272 | // ============================================================================= |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
273 | void ConfigDialog::initGridTab () { |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
274 | QWidget* tab = new QWidget; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
275 | QGridLayout* layout = new QGridLayout; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
276 | QVBoxLayout* l2 = new QVBoxLayout; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
277 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
278 | QLabel* xlabel = new QLabel ("X"), |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
279 | *ylabel = new QLabel ("Y"), |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
280 | *zlabel = new QLabel ("Z"), |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
281 | *anglabel = new QLabel ("Angle"); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
282 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
283 | short i = 1; |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
284 | for (QLabel* label : std::initializer_list<QLabel*> ({xlabel, ylabel, zlabel, anglabel})) { |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
285 | label->setAlignment (Qt::AlignCenter); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
286 | layout->addWidget (label, 0, i++); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
287 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
288 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
289 | for (int i = 0; i < g_NumGrids; ++i) { |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
290 | // Icon |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
291 | lb_gridIcons[i] = new QLabel; |
161 | 292 | lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%s", str (g_GridInfo[i].name).tolower ().chars ()))); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
293 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
294 | // Text label |
161 | 295 | lb_gridLabels[i] = new QLabel (fmt ("%s:", g_GridInfo[i].name)); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
296 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
297 | QHBoxLayout* labellayout = new QHBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
298 | labellayout->addWidget (lb_gridIcons[i]); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
299 | labellayout->addWidget (lb_gridLabels[i]); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
300 | layout->addLayout (labellayout, i + 1, 0); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
301 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
302 | // Add the widgets |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
303 | for (int j = 0; j < 4; ++j) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
304 | dsb_gridData[i][j] = new QDoubleSpinBox; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
305 | dsb_gridData[i][j]->setValue (g_GridInfo[i].confs[j]->value); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
306 | layout->addWidget (dsb_gridData[i][j], i + 1, j + 1); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
307 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
308 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
309 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
310 | l2->addLayout (layout); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
311 | l2->addStretch (1); |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
312 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
313 | tab->setLayout (l2); |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
314 | tabs->addTab (tab, "Grids"); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
315 | } |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
316 | |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
317 | // ============================================================================= |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
318 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
319 | // ============================================================================= |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
320 | extern_cfg (str, prog_ytruder); |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
321 | extern_cfg (str, prog_rectifier); |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
322 | extern_cfg (str, prog_intersector); |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
323 | extern_cfg (str, prog_isecalc); |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
324 | static const struct extProgInfo { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
325 | const char* const name, *iconname; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
326 | strconfig* const path; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
327 | mutable QLineEdit* input; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
328 | mutable QPushButton* setPathButton; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
329 | } g_extProgInfo[] = { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
330 | { "Ytruder", "ytruder", &prog_ytruder, null, null }, |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
331 | { "Rectifier", "rectifier", &prog_rectifier, null, null }, |
175
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
332 | { "Intersector", "intersector", &prog_intersector, null, null }, |
b094d5e9d6e0
Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
174
diff
changeset
|
333 | { "Isecalc", "isecalc", &prog_isecalc, null, null }, |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
334 | }; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
335 | |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
336 | void ConfigDialog::initExtProgTab () { |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
337 | QWidget* tab = new QWidget; |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
338 | QGridLayout* pathsLayout = new QGridLayout; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
339 | QGroupBox* pathsBox = new QGroupBox ("Paths", this); |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
340 | QVBoxLayout* layout = new QVBoxLayout (this); |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
341 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
342 | ulong row = 0; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
343 | for (const extProgInfo& info : g_extProgInfo) { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
344 | QLabel* icon = new QLabel, |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
345 | *progLabel = new QLabel (info.name); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
346 | QLineEdit* input = new QLineEdit; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
347 | QPushButton* setPathButton = new QPushButton (); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
348 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
349 | icon->setPixmap (getIcon (info.iconname)); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
350 | input->setText (info.path->value); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
351 | setPathButton->setIcon (getIcon ("folder")); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
352 | info.input = input; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
353 | info.setPathButton = setPathButton; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
354 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
355 | connect (setPathButton, SIGNAL (clicked ()), this, SLOT (slot_setExtProgPath ())); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
356 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
357 | pathsLayout->addWidget (icon, row, 0); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
358 | pathsLayout->addWidget (progLabel, row, 1); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
359 | pathsLayout->addWidget (input, row, 2); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
360 | pathsLayout->addWidget (setPathButton, row, 3); |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
361 | ++row; |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
362 | } |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
363 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
364 | pathsBox->setLayout (pathsLayout); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
365 | layout->addWidget (pathsBox); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
366 | layout->addSpacing (10); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
367 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
368 | tab->setLayout (layout); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
369 | tabs->addTab (tab, "Ext. Programs"); |
165
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
370 | } |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
371 | |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
372 | // ============================================================================= |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
373 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
88a03c1a52d9
Begin work on external program support (Ytruder partially supported)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
161
diff
changeset
|
374 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
375 | void ConfigDialog::updateQuickColorList (quickColorMetaEntry* pSel) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
376 | for (QListWidgetItem* qItem : quickColorItems) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
377 | delete qItem; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
378 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
379 | quickColorItems.clear (); |
100
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 | // Init table items |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
382 | for (quickColorMetaEntry& entry : quickColorMeta) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
383 | QListWidgetItem* qItem = new QListWidgetItem; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
384 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
385 | if (entry.bSeparator) { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
386 | qItem->setText ("--------"); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
387 | qItem->setIcon (getIcon ("empty")); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
388 | } else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
389 | color* col = entry.col; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
390 | |
104 | 391 | if (col == null) { |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
392 | qItem->setText ("[[unknown color]]"); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
393 | qItem->setIcon (getIcon ("error")); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
394 | } else { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
395 | qItem->setText (col->zName); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
396 | qItem->setIcon (getIcon ("palette")); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
397 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
398 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
399 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
400 | lw_quickColors->addItem (qItem); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
401 | quickColorItems.push_back (qItem); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
402 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
403 | if (pSel && &entry == pSel) { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
404 | lw_quickColors->setCurrentItem (qItem); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
405 | lw_quickColors->scrollToItem (qItem); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
406 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
407 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
408 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
409 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
410 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
411 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
412 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
413 | void ConfigDialog::slot_setColor () { |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
414 | quickColorMetaEntry* entry = null; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
415 | QListWidgetItem* item = null; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
416 | const bool isNew = static_cast<QPushButton*> (sender ()) == pb_addColor; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
417 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
418 | if (isNew == false) { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
419 | item = getSelectedQuickColor (); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
420 | if (!item) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
421 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
422 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
423 | ulong ulIdx = getItemRow (item, quickColorItems); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
424 | entry = &quickColorMeta[ulIdx]; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
425 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
426 | if (entry->bSeparator == true) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
427 | return; // don't color separators |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
428 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
429 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
430 | short dDefault = entry ? entry->col->index () : -1; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
431 | short dValue; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
432 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
433 | 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
|
434 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
435 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
436 | if (entry) |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
437 | entry->col = getColor (dValue); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
438 | else { |
104 | 439 | 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
|
440 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
441 | item = getSelectedQuickColor (); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
442 | ulong idx; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
443 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
444 | if (item) |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
445 | idx = getItemRow (item, quickColorItems) + 1; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
446 | else |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
447 | idx = quickColorItems.size(); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
448 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
449 | quickColorMeta.insert (quickColorMeta.begin() + idx, entry); |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
450 | entry = quickColorMeta[idx]; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
451 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
452 | |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
453 | updateQuickColorList (entry); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
454 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
455 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
456 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
457 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
458 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
459 | void ConfigDialog::slot_delColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
460 | if (lw_quickColors->selectedItems().size() == 0) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
461 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
462 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
463 | QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0]; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
464 | ulong ulIdx = getItemRow (qItem, quickColorItems); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
465 | quickColorMeta.erase (quickColorMeta.begin () + ulIdx); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
466 | updateQuickColorList (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
467 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
468 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
469 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
470 | void ConfigDialog::slot_moveColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
471 | const bool bUp = (static_cast<QPushButton*> (sender()) == pb_moveColorUp); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
472 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
473 | if (lw_quickColors->selectedItems().size() == 0) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
474 | return; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
475 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
476 | QListWidgetItem* qItem = lw_quickColors->selectedItems ()[0]; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
477 | ulong ulIdx = getItemRow (qItem, quickColorItems); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
478 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
479 | 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
|
480 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
481 | if (lDest < 0 || (ulong)lDest >= quickColorItems.size ()) |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
482 | return; // destination out of bounds |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
483 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
484 | quickColorMetaEntry tmp = quickColorMeta[lDest]; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
485 | quickColorMeta[lDest] = quickColorMeta[ulIdx]; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
486 | quickColorMeta[ulIdx] = tmp; |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
487 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
488 | updateQuickColorList (&quickColorMeta[lDest]); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
489 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
490 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
491 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
492 | void ConfigDialog::slot_addColorSeparator() { |
104 | 493 | 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
|
494 | updateQuickColorList (&quickColorMeta[quickColorMeta.size () - 1]); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
495 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
496 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
497 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
498 | void ConfigDialog::slot_clearColors () { |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
499 | quickColorMeta.clear (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
500 | updateQuickColorList (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
501 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
502 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
503 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
504 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
505 | // ============================================================================= |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
506 | void ConfigDialog::makeSlider (QSlider*& slider, short min, short max, short defval) { |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
507 | slider = new QSlider (Qt::Horizontal); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
508 | slider->setRange (min, max); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
509 | slider->setSliderPosition (defval); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
510 | slider->setTickPosition (QSlider::TicksAbove); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
511 | slider->setTickInterval (1); |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
512 | } |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
513 | |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
514 | // ============================================================================= |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
515 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
516 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
517 | ConfigDialog::~ConfigDialog () { |
104 | 518 | g_ConfigDialog = null; |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
519 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
520 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
521 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
522 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
523 | // ============================================================================= |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
524 | 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
|
525 | QColorDialog dlg (QColor (cfg.value.chars())); |
158
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
156
diff
changeset
|
526 | dlg.setWindowIcon (getIcon ("colorselect")); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
527 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
528 | if (dlg.exec ()) { |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
529 | uchar r = dlg.currentColor ().red (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
530 | g = dlg.currentColor ().green (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
531 | b = dlg.currentColor ().blue (); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
532 | 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
|
533 | setButtonBackground (qButton, cfg.value); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
534 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
535 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
536 | |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
537 | void ConfigDialog::slot_setGLBackground () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
538 | pickColor (gl_bgcolor, pb_viewBg); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
539 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
540 | |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
541 | void ConfigDialog::slot_setGLForeground () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
542 | pickColor (gl_maincolor, pb_viewFg); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
543 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
544 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
545 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
546 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
547 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
548 | void ConfigDialog::setButtonBackground (QPushButton* qButton, str zValue) { |
158
499286fcbf37
Compile the icon resources to a QRC file, so that they are embedded in the application
Santeri Piippo <crimsondusk64@gmail.com>
parents:
156
diff
changeset
|
549 | qButton->setIcon (getIcon ("colorselect")); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
550 | qButton->setAutoFillBackground (true); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
551 | qButton->setStyleSheet ( |
161 | 552 | fmt ("background-color: %s", zValue.chars()).chars() |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
553 | ); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
554 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
555 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
556 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
557 | 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
|
558 | long i = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
559 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
560 | for (QListWidgetItem* it : haystack) { |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
561 | if (it == qItem) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
562 | return i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
563 | ++i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
564 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
565 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
566 | return -1; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
567 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
568 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
569 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
570 | QListWidgetItem* ConfigDialog::getSelectedQuickColor () { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
571 | if (lw_quickColors->selectedItems().size() == 0) |
104 | 572 | return null; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
573 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
574 | return lw_quickColors->selectedItems ()[0]; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
575 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
576 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
577 | // ============================================================================= |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
578 | QList<ShortcutListItem*> ConfigDialog::getShortcutSelection () { |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
579 | QList<ShortcutListItem*> out; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
580 | |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
581 | for (QListWidgetItem* entry : lw_shortcutList->selectedItems ()) |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
582 | out << static_cast<ShortcutListItem*> (entry); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
583 | |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
584 | return out; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
585 | } |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
586 | |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
587 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
588 | void ConfigDialog::slot_setShortcut () { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
589 | QList<ShortcutListItem*> sel = getShortcutSelection (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
590 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
591 | if (sel.size() < 1) |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
592 | return; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
593 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
594 | ShortcutListItem* item = sel[0]; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
595 | if (KeySequenceDialog::staticDialog (*(item->getActionInfo ()), this)) |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
596 | setShortcutText (item, *(item->getActionInfo ())); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
597 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
598 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
599 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
600 | void ConfigDialog::slot_resetShortcut () { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
601 | QList<ShortcutListItem*> sel = getShortcutSelection (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
602 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
603 | for (ShortcutListItem* item : sel) { |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
604 | actionmeta* info = item->getActionInfo (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
605 | keyseqconfig* conf = info->conf; |
78
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 | conf->reset (); |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
608 | (*info->qAct)->setShortcut (*conf); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
609 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
610 | setShortcutText (item, *info); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
611 | } |
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 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
614 | // ============================================================================= |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
615 | void ConfigDialog::slot_clearShortcut () { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
616 | QList<ShortcutListItem*> sel = getShortcutSelection (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
617 | QKeySequence dummy; |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
618 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
619 | for (ShortcutListItem* item : sel) { |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
620 | actionmeta* info = item->getActionInfo (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
621 | keyseqconfig* conf = info->conf; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
622 | conf->value = dummy; |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
623 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
624 | (*info->qAct)->setShortcut (*conf); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
625 | setShortcutText (item, *info); |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
626 | } |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
627 | } |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
628 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
629 | // ============================================================================= |
173
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
630 | void ConfigDialog::slot_setExtProgPath () { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
631 | const extProgInfo* info = null; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
632 | for (const extProgInfo& it : g_extProgInfo) { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
633 | if (it.setPathButton == sender ()) { |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
634 | info = ⁢ |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
635 | break; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
636 | } |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
637 | } |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
638 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
639 | assert (info != null); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
640 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
641 | str filter; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
642 | #ifdef _WIN32 |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
643 | filter = "Applications (*.exe)(*.exe);;All files (*.*)(*.*)"; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
644 | #endif // WIN32 |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
645 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
646 | str fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %s", info->name), "", filter); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
647 | if (!~fpath) |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
648 | return; |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
649 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
650 | info->input->setText (fpath); |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
651 | } |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
652 | |
2368e3c23ef3
Add functionality for setting paths to ext progs in config dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
172
diff
changeset
|
653 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
654 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
655 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
656 | void ConfigDialog::setShortcutText (QListWidgetItem* qItem, actionmeta meta) { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
657 | QAction* const act = *meta.qAct; |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
658 | str zLabel = act->iconText (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
659 | str zKeybind = act->shortcut ().toString (); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
660 | |
161 | 661 | qItem->setText (fmt ("%s (%s)", zLabel.chars () ,zKeybind.chars ()).chars()); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
662 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
663 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
664 | // ============================================================================= |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
665 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
666 | // ============================================================================= |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
667 | str ConfigDialog::makeColorToolBarString () { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
668 | str val; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
669 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
670 | for (quickColorMetaEntry entry : quickColorMeta) { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
671 | if (~val > 0) |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
672 | val += ':'; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
673 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
674 | if (entry.bSeparator) |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
675 | val += '|'; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
676 | else |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
677 | val.appendformat ("%d", entry.col->index ()); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
678 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
679 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
680 | return val; |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
681 | } |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
682 | |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
683 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
684 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
685 | // ============================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
686 | void ConfigDialog::staticDialog () { |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
687 | ConfigDialog dlg (g_win); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
688 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
689 | if (dlg.exec ()) { |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
690 | lv_colorize = dlg.cb_colorize->isChecked (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
691 | gl_colorbfc = dlg.cb_colorBFC->isChecked (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
692 | gl_selflash = dlg.cb_selFlash->isChecked (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
693 | edit_schemanticinline = dlg.cb_schemanticInline->isChecked (); |
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
694 | gl_blackedges = dlg.cb_blackEdges->isChecked (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
695 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
696 | gl_maincolor_alpha = ((double)dlg.sl_viewFgAlpha->value ()) / 10.0f; |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
697 | gl_linethickness = dlg.sl_lineThickness->value (); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
698 | gui_toolbar_iconsize = (dlg.sl_iconSize->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
|
699 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
700 | // Manage the quick color toolbar |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
701 | g_win->setQuickColorMeta (dlg.quickColorMeta); |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
702 | gui_colortoolbar = dlg.makeColorToolBarString (); |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
703 | |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
704 | // Set the grid settings |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
705 | for (int i = 0; i < g_NumGrids; ++i) |
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
706 | for (int j = 0; j < 4; ++j) |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
707 | g_GridInfo[i].confs[j]->value = dlg.dsb_gridData[i][j]->value (); |
124
7962744759ad
Added three configurable grid layouts, coarse, medium and fine grids, like those of MLCad. The grids are considerably finer by default simply because part editing works at a lower scale than model editing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
708 | |
174
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
709 | // Ext program settings |
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
710 | for (const extProgInfo& info : g_extProgInfo) |
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
711 | *info.path = info.input->text (); |
963697b36118
Added rectifier interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
173
diff
changeset
|
712 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
713 | // Save the config |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
714 | config::save (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
715 | |
172
a65547b84ef8
Restructured the shortcut configuration tab a little, allowing it to be sorted.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
165
diff
changeset
|
716 | // Reload all subfiles as the ldraw path potentially changed. |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
717 | reloadAllSubfiles (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
718 | |
160
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
719 | g_win->R ()->setBackground (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
720 | g_win->refresh (); |
edcb03f3ef75
Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
158
diff
changeset
|
721 | g_win->updateToolBars (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
722 | } |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
723 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
724 | |
100
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
725 | // ========================================================================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
726 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
727 | // ========================================================================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
728 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
729 | // ========================================================================================================================= |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
730 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e40358266290
Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
88
diff
changeset
|
731 | // ========================================================================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
732 | KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
733 | Qt::WindowFlags f) : QDialog (parent, f), seq (seq) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
734 | { |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
735 | lb_output = new QLabel; |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
736 | IMPLEMENT_DIALOG_BUTTONS |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
737 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
738 | 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
|
739 | "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
|
740 | "dismiss."); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
741 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
742 | QVBoxLayout* layout = new QVBoxLayout; |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
743 | layout->addWidget (lb_output); |
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
744 | layout->addWidget (bbx_buttons); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
745 | setLayout (layout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
746 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
747 | updateOutput (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
748 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
749 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
750 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
751 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
752 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
753 | bool KeySequenceDialog::staticDialog (actionmeta& meta, QWidget* parent) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
754 | KeySequenceDialog dlg (*meta.conf, parent); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
755 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
756 | if (dlg.exec () == false) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
757 | return false; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
758 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
759 | *meta.conf = dlg.seq; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
760 | (*meta.qAct)->setShortcut (*meta.conf); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
761 | return true; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
762 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
763 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
764 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
765 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
766 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
767 | void KeySequenceDialog::updateOutput () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
768 | str zShortcut = seq.toString (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
769 | |
161 | 770 | str zText = fmt ("<center><b>%s</b></center>", zShortcut.chars ()); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
771 | |
135
c243df39913e
Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents:
124
diff
changeset
|
772 | lb_output->setText (zText); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
773 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
774 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
775 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
776 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
777 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
778 | void KeySequenceDialog::keyPressEvent (QKeyEvent* ev) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
779 | seq = ev->key (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
780 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
781 | switch (seq) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
782 | case Qt::Key_Shift: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
783 | case Qt::Key_Control: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
784 | case Qt::Key_Alt: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
785 | case Qt::Key_Meta: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
786 | seq = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
787 | break; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
788 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
789 | default: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
790 | break; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
791 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
792 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
793 | seq = (seq | ev->modifiers ()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
794 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
795 | updateOutput (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
796 | } |