Wed, 10 Apr 2013 01:51:35 +0300
Split some stuff out of the edit tool bar into move and object tool bars. The object tool bar is now located on the left side of the screen as the top one is running out of space.
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 |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
3 | * Copyright (C) 2013 Santeri `arezey` Piippo |
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" |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include <qgridlayout.h> |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include <qfiledialog.h> |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
26 | #include <qcolordialog.h> |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
27 | #include <qboxlayout.h> |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
28 | #include <qevent.h> |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
29 | |
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
|
30 | extern_cfg (str, io_ldpath); |
6790dea720a8
Simplified configuration code. Use a std::vector object to contain config pointers and have config objects register themselves upon creation instead of relying on a cfgdefs.h. Removed sections, all configurations are just simply written one after another now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
68
diff
changeset
|
31 | 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
|
32 | 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
|
33 | 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
|
34 | 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
|
35 | 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
|
36 | extern_cfg (int, gl_linethickness); |
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 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
38 | ConfigDialog* g_ConfigDialog = nullptr; |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
40 | #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
|
41 | 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
|
42 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
43 | #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
|
44 | 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
|
45 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | // ============================================================================= |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
49 | ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) { |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
50 | g_ConfigDialog = this; |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
51 | qTabs = new QTabWidget; |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
52 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
53 | initMainTab (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
54 | initShortcutsTab (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
55 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
56 | IMPLEMENT_DIALOG_BUTTONS |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
57 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
58 | QVBoxLayout* layout = new QVBoxLayout; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
59 | layout->addWidget (qTabs); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
60 | layout->addWidget (qButtons); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
61 | setLayout (layout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
62 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
63 | setWindowTitle (APPNAME_DISPLAY " - editing settings"); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
64 | setWindowIcon (QIcon ("icons/settings.png")); |
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 | |
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 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
69 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
70 | void ConfigDialog::initMainTab () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
71 | qMainTab = new QWidget; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
72 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
73 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
74 | // LDraw path |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | qLDrawPath = new QLineEdit; |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | qLDrawPath->setText (io_ldpath.value.chars()); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | qLDrawPathLabel = new QLabel ("LDraw path:"); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | qLDrawPathFindButton = new QPushButton; |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | qLDrawPathFindButton->setIcon (QIcon ("icons/folder.png")); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | connect (qLDrawPathFindButton, SIGNAL (clicked ()), |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | this, SLOT (slot_findLDrawPath ())); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
85 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
86 | // Background and foreground colors |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
87 | qGLBackgroundLabel = new QLabel ("Background color:"); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
88 | qGLBackgroundButton = new QPushButton; |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
89 | setButtonBackground (qGLBackgroundButton, gl_bgcolor.value); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
90 | connect (qGLBackgroundButton, SIGNAL (clicked ()), |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
91 | this, SLOT (slot_setGLBackground ())); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
92 | |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
93 | qGLForegroundLabel = new QLabel ("Foreground color:"); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
94 | qGLForegroundButton = new QPushButton; |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
95 | setButtonBackground (qGLForegroundButton, gl_maincolor.value); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
96 | connect (qGLForegroundButton, SIGNAL (clicked ()), |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
97 | this, SLOT (slot_setGLForeground ())); |
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 |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
101 | qGLForegroundAlphaLabel = new QLabel ("Alpha:"); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
102 | makeSlider (qGLForegroundAlpha, 1, 10, (gl_maincolor_alpha * 10.0f)); |
68
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
54
diff
changeset
|
103 | |
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
|
104 | qGLLineThicknessLabel = new QLabel ("Line thickness:"); |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
105 | makeSlider (qGLLineThickness, 1, 8, gl_linethickness); |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
106 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
107 | // ========================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
108 | // List view colorizer and BFC red/green view checkboxes |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
109 | qLVColorize = new QCheckBox ("Colorize polygons in list view"); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
110 | INIT_CHECKBOX (qLVColorize, lv_colorize) |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
111 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
112 | qGLColorBFC = new QCheckBox ("Red/green BFC view"); |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
113 | INIT_CHECKBOX (qGLColorBFC, gl_colorbfc) |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
114 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | QGridLayout* layout = new QGridLayout; |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | layout->addWidget (qLDrawPathLabel, 0, 0); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
117 | layout->addWidget (qLDrawPath, 0, 1, 1, 2); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
118 | layout->addWidget (qLDrawPathFindButton, 0, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
119 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
120 | layout->addWidget (qGLBackgroundLabel, 1, 0); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
121 | layout->addWidget (qGLBackgroundButton, 1, 1); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
122 | layout->addWidget (qGLForegroundLabel, 1, 2); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
123 | layout->addWidget (qGLForegroundButton, 1, 3); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
124 | |
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
|
125 | layout->addWidget (qGLLineThicknessLabel, 2, 0); |
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
126 | layout->addWidget (qGLLineThickness, 2, 1); |
68
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
54
diff
changeset
|
127 | layout->addWidget (qGLForegroundAlphaLabel, 2, 2); |
c637b172d565
Further fixes to bad color handling. Allow main color be represented with arbitrary transparency.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
54
diff
changeset
|
128 | layout->addWidget (qGLForegroundAlpha, 2, 3); |
52
d71226763607
Colorized polygons now appear colorized in the list view (unless disabled). GL rendered now draws transparent polygons properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
47
diff
changeset
|
129 | |
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
|
130 | layout->addWidget (qLVColorize, 3, 0, 1, 2); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
131 | layout->addWidget (qGLColorBFC, 3, 2, 1, 2); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
132 | qMainTab->setLayout (layout); |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
133 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
134 | // Add the tab to the manager |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
135 | qTabs->addTab (qMainTab, "Main settings"); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
136 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
137 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
138 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
140 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
141 | void ConfigDialog::initShortcutsTab () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
142 | QGridLayout* qLayout; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
143 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
144 | qShortcutsTab = new QWidget; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
145 | qShortcutList = new QListWidget; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
146 | qLayout = new QGridLayout; |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
148 | // Init table items |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
149 | ulong i = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
150 | for (actionmeta meta : g_ActionMeta) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
151 | QAction* const qAct = *meta.qAct; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
152 | QListWidgetItem* qItem = new QListWidgetItem; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
153 | setShortcutText (qItem, meta); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
154 | qItem->setIcon (qAct->icon ()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
155 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
156 | qaShortcutItems.push_back (qItem); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
157 | qShortcutList->insertItem (i, qItem); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
158 | ++i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
159 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
160 | |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
161 | qSetShortcut = new QPushButton ("Set"); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
162 | qResetShortcut = new QPushButton ("Reset"); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
163 | qClearShortcut = new QPushButton ("Clear"); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
164 | |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
165 | connect (qSetShortcut, SIGNAL (clicked ()), this, SLOT (slot_setShortcut ())); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
166 | connect (qResetShortcut, SIGNAL (clicked ()), this, SLOT (slot_resetShortcut ())); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
167 | connect (qClearShortcut, SIGNAL (clicked ()), this, SLOT (slot_clearShortcut ())); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
168 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
169 | QVBoxLayout* qButtonLayout = new QVBoxLayout; |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
170 | qButtonLayout->addWidget (qSetShortcut); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
171 | qButtonLayout->addWidget (qResetShortcut); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
172 | qButtonLayout->addWidget (qClearShortcut); |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
173 | qButtonLayout->addStretch (10); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
174 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
175 | qLayout->addWidget (qShortcutList, 0, 0); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
176 | qLayout->addLayout (qButtonLayout, 0, 1); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
177 | qShortcutsTab->setLayout (qLayout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
178 | qTabs->addTab (qShortcutsTab, "Shortcuts"); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | // ============================================================================= |
70
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
184 | void ConfigDialog::makeSlider (QSlider*& qSlider, short int dMin, short int dMax, |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
185 | short dDefault) |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
186 | { |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
187 | qSlider = new QSlider (Qt::Horizontal); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
188 | qSlider->setRange (dMin, dMax); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
189 | qSlider->setSliderPosition (dDefault); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
190 | qSlider->setTickPosition (QSlider::TicksAbove); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
191 | qSlider->setTickInterval (1); |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
192 | } |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
193 | |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
194 | // ============================================================================= |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
195 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
e6b8dab8f81a
Phased out FOREACH macro in favor of C++11-style for iteration.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
69
diff
changeset
|
196 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
197 | ConfigDialog::~ConfigDialog () { |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
198 | g_ConfigDialog = nullptr; |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
199 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
200 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
201 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
202 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
203 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | void ConfigDialog::slot_findLDrawPath () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | str zDir = QFileDialog::getExistingDirectory (this, "Choose LDraw directory", |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | qLDrawPath->text()); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | if (~zDir) |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | qLDrawPath->setText (zDir.chars()); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | // ============================================================================= |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
215 | 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
|
216 | QColorDialog dlg (QColor (cfg.value.chars())); |
33
3e0cca764fd6
Added color selection icon
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
217 | dlg.setWindowIcon (QIcon ("icons/colorselect.png")); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
218 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
219 | if (dlg.exec ()) { |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
220 | uchar r = dlg.currentColor ().red (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
221 | g = dlg.currentColor ().green (), |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
222 | b = dlg.currentColor ().blue (); |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
223 | 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
|
224 | setButtonBackground (qButton, cfg.value); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
225 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
226 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
227 | |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
228 | void ConfigDialog::slot_setGLBackground () { |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
229 | pickColor (gl_bgcolor, qGLBackgroundButton); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
230 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
231 | |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
232 | void ConfigDialog::slot_setGLForeground () { |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
233 | pickColor (gl_maincolor, qGLForegroundButton); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
234 | } |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
235 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
236 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
237 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
238 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
239 | void ConfigDialog::setButtonBackground (QPushButton* qButton, str zValue) { |
34
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
240 | qButton->setIcon (QIcon ("icons/colorselect.png")); |
d99006de6261
Added main color configuration option, not implemented yet
Santeri Piippo <crimsondusk64@gmail.com>
parents:
33
diff
changeset
|
241 | qButton->setAutoFillBackground (true); |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
242 | qButton->setStyleSheet ( |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
243 | str::mkfmt ("background-color: %s", zValue.chars()).chars() |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
244 | ); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
245 | } |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
246 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
247 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
248 | long ConfigDialog::getItemRow (QListWidgetItem* qItem) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
249 | long i = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
250 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
251 | for (QListWidgetItem* it : qaShortcutItems) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
252 | if (it == qItem) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
253 | return i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
254 | ++i; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
255 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
256 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
257 | return -1; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
258 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
259 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
260 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
261 | void ConfigDialog::slot_setShortcut () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
262 | QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
263 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
264 | if (qaSel.size() < 1) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
265 | return; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
266 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
267 | QListWidgetItem* qItem = qaSel[0]; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
268 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
269 | // Find the row this object is on. |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
270 | long idx = getItemRow (qItem); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
271 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
272 | if (KeySequenceDialog::staticDialog (g_ActionMeta[idx], this)) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
273 | setShortcutText (qItem, g_ActionMeta[idx]); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
274 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
275 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
276 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
277 | void ConfigDialog::slot_resetShortcut () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
278 | QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
279 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
280 | for (QListWidgetItem* qItem : qaSel) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
281 | long idx = getItemRow (qItem); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
282 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
283 | actionmeta meta = g_ActionMeta[idx]; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
284 | keyseqconfig* conf = g_ActionMeta[idx].conf; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
285 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
286 | conf->reset (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
287 | (*meta.qAct)->setShortcut (*conf); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
288 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
289 | setShortcutText (qItem, meta); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
290 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
291 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
292 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
293 | // ============================================================================= |
83
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
294 | void ConfigDialog::slot_clearShortcut () { |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
295 | QList<QListWidgetItem*> qaSel = qShortcutList->selectedItems (); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
296 | QKeySequence qDummySeq; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
297 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
298 | for (QListWidgetItem* qItem : qaSel) { |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
299 | long idx = getItemRow (qItem); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
300 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
301 | actionmeta meta = g_ActionMeta[idx]; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
302 | keyseqconfig* conf = g_ActionMeta[idx].conf; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
303 | conf->value = qDummySeq; |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
304 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
305 | (*meta.qAct)->setShortcut (*conf); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
306 | setShortcutText (qItem, meta); |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
307 | } |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
308 | } |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
309 | |
614ec2640e40
Added a button to clear a keyboard shortcut.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
78
diff
changeset
|
310 | // ============================================================================= |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
311 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
312 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
313 | void ConfigDialog::setShortcutText (QListWidgetItem* qItem, actionmeta meta) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
314 | QAction* const qAct = *meta.qAct; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
315 | str zLabel = qAct->iconText (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
316 | str zKeybind = qAct->shortcut ().toString (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
317 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
318 | qItem->setText (str::mkfmt ("%s (%s)", zLabel.chars () ,zKeybind.chars ()).chars()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
319 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
320 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
321 | // ============================================================================= |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
322 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
323 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | void ConfigDialog::staticDialog (ForgeWindow* window) { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | ConfigDialog dlg (window); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
326 | |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | if (dlg.exec ()) { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
328 | io_ldpath = dlg.qLDrawPath->text(); |
54
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
329 | |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
330 | APPLY_CHECKBOX (dlg.qLVColorize, lv_colorize) |
60f328f352c9
Done the rendering end of the red/green BFC view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
53
diff
changeset
|
331 | APPLY_CHECKBOX (dlg.qGLColorBFC, gl_colorbfc) |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | |
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
|
333 | gl_maincolor_alpha = ((double)dlg.qGLForegroundAlpha->value ()) / 10.0f; |
53
170cdffe1056
Make line thickness user-configurable, draw conditional lines dashed, use the bounding box to offset the model so that it is centered properly.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
52
diff
changeset
|
334 | gl_linethickness = dlg.qGLLineThickness->value (); |
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
|
335 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
336 | // Save the config |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
337 | config::save (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
339 | // Reload all subfiles |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
340 | reloadAllSubfiles (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | |
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
|
342 | window->R->setBackground (); |
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
|
343 | window->refresh (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | } |
78
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
345 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
346 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
347 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
348 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
349 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
350 | KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
351 | Qt::WindowFlags f) : QDialog (parent, f), seq (seq) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
352 | { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
353 | qOutput = new QLabel; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
354 | IMPLEMENT_DIALOG_BUTTONS |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
355 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
356 | 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
|
357 | "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
|
358 | "dismiss."); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
359 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
360 | QVBoxLayout* layout = new QVBoxLayout; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
361 | layout->addWidget (qOutput); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
362 | layout->addWidget (qButtons); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
363 | setLayout (layout); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
364 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
365 | updateOutput (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
366 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
367 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
368 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
369 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
370 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
371 | bool KeySequenceDialog::staticDialog (actionmeta& meta, QWidget* parent) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
372 | KeySequenceDialog dlg (*meta.conf, parent); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
373 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
374 | if (dlg.exec () == false) |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
375 | return false; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
376 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
377 | *meta.conf = dlg.seq; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
378 | (*meta.qAct)->setShortcut (*meta.conf); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
379 | return true; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
380 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
381 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
382 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
383 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
384 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
385 | void KeySequenceDialog::updateOutput () { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
386 | str zShortcut = seq.toString (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
387 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
388 | str zText = str::mkfmt ("<center><b>%s</b></center>", zShortcut.chars ()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
389 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
390 | qOutput->setText (zText); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
391 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
392 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
393 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
394 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
395 | // ============================================================================= |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
396 | void KeySequenceDialog::keyPressEvent (QKeyEvent* ev) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
397 | seq = ev->key (); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
398 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
399 | switch (seq) { |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
400 | case Qt::Key_Shift: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
401 | case Qt::Key_Control: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
402 | case Qt::Key_Alt: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
403 | case Qt::Key_Meta: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
404 | seq = 0; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
405 | break; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
406 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
407 | default: |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
408 | break; |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
409 | } |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
410 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
411 | seq = (seq | ev->modifiers ()); |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
412 | |
c190fe218506
Keyboard shortcuts can now be configured.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
70
diff
changeset
|
413 | updateOutput (); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
414 | } |