Thu, 06 Feb 2014 20:43:22 +0200
- migrated to CMake again
- added public domain updaterevision for git information
629
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013, 2014 Santeri Piippo |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | * ===================================================================== |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | * |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
629
diff
changeset
|
19 | * configDialog.cxx: Settings dialog and everything related to it. |
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
629
diff
changeset
|
20 | * Actual configuration core is in config.cxx. |
629
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | */ |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <QGridLayout> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include <QFileDialog> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include <QColorDialog> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include <QBoxLayout> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include <QKeyEvent> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | #include <QGroupBox> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | #include <QDoubleSpinBox> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #include <QLineEdit> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | #include <QCheckBox> |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | #include "Main.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include "ConfigurationDialog.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | #include "Document.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | #include "Configuration.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | #include "Misc.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | #include "Colors.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | #include "ColorSelector.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | #include "GLRenderer.h" |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | #include "ui_config.h" |
632
63e6243b880c
- migrated to CMake again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
629
diff
changeset
|
41 | #include "moc_ConfigurationDialog.cxx" |
629
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | extern_cfg (String, gl_bgcolor); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | extern_cfg (String, gl_maincolor); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | extern_cfg (Bool, lv_colorize); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | extern_cfg (Bool, gl_colorbfc); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | extern_cfg (Float, gl_maincolor_alpha); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | extern_cfg (Int, gl_linethickness); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | extern_cfg (String, gui_colortoolbar); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | extern_cfg (Bool, edit_schemanticinline); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | extern_cfg (Bool, gl_blackedges); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | extern_cfg (Bool, gl_aa); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | extern_cfg (Bool, gui_implicitfiles); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | extern_cfg (String, net_downloadpath); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | extern_cfg (Bool, net_guesspaths); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | extern_cfg (Bool, net_autoclose); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | extern_cfg (Bool, gl_logostuds); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | extern_cfg (Bool, gl_linelengths); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | extern_cfg (String, ld_defaultname); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | extern_cfg (String, ld_defaultuser); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | extern_cfg (Int, ld_defaultlicense); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | extern_cfg (String, gl_selectcolor); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | extern_cfg (String, prog_ytruder); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | extern_cfg (String, prog_rectifier); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | extern_cfg (String, prog_intersector); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | extern_cfg (String, prog_coverer); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | extern_cfg (String, prog_isecalc); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | extern_cfg (String, prog_edger2); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | extern_cfg (Bool, prog_ytruder_wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | extern_cfg (Bool, prog_rectifier_wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | extern_cfg (Bool, prog_intersector_wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | extern_cfg (Bool, prog_coverer_wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | extern_cfg (Bool, prog_isecalc_wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | extern_cfg (Bool, prog_edger2_wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | const char* g_extProgPathFilter = |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | #ifdef _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | "Applications (*.exe)(*.exe);;All files (*.*)(*.*)"; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | #else |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | ""; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | #endif |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | ConfigDialog::ConfigDialog (ConfigDialog::Tab deftab, QWidget* parent, Qt::WindowFlags f) : |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | QDialog (parent, f) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | assert (g_win != null); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | ui = new Ui_ConfigUI; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | ui->setupUi (this); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | // Interface tab |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | setButtonBackground (ui->backgroundColorButton, gl_bgcolor); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | connect (ui->backgroundColorButton, SIGNAL (clicked()), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | this, SLOT (slot_setGLBackground())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | setButtonBackground (ui->mainColorButton, gl_maincolor); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | connect (ui->mainColorButton, SIGNAL (clicked()), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | this, SLOT (slot_setGLForeground())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | setButtonBackground (ui->selColorButton, gl_selectcolor); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | connect (ui->selColorButton, SIGNAL (clicked()), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | this, SLOT (slot_setGLSelectColor())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | ui->mainColorAlpha->setValue (gl_maincolor_alpha * 10.0f); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | ui->lineThickness->setValue (gl_linethickness); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | ui->colorizeObjects->setChecked (lv_colorize); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | ui->colorBFC->setChecked (gl_colorbfc); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | ui->blackEdges->setChecked (gl_blackedges); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
110 | ui->m_aa->setChecked (gl_aa); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | ui->implicitFiles->setChecked (gui_implicitfiles); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | ui->m_logostuds->setChecked (gl_logostuds); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | ui->linelengths->setChecked (gl_linelengths); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | int i = 0; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | for (QAction* act : g_win->findChildren<QAction*>()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | KeySequenceConfig* cfg = g_win->shortcutForAction (act); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | if (cfg) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | addShortcut (*cfg, act, i); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | ui->shortcutsList->setSortingEnabled (true); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | ui->shortcutsList->sortItems(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | connect (ui->shortcut_set, SIGNAL (clicked()), this, SLOT (slot_setShortcut())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | connect (ui->shortcut_reset, SIGNAL (clicked()), this, SLOT (slot_resetShortcut())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | connect (ui->shortcut_clear, SIGNAL (clicked()), this, SLOT (slot_clearShortcut())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | quickColors = quickColorsFromConfig(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | updateQuickColorList(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | connect (ui->quickColor_add, SIGNAL (clicked()), this, SLOT (slot_setColor())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | connect (ui->quickColor_remove, SIGNAL (clicked()), this, SLOT (slot_delColor())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | connect (ui->quickColor_edit, SIGNAL (clicked()), this, SLOT (slot_setColor())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | connect (ui->quickColor_addSep, SIGNAL (clicked()), this, SLOT (slot_addColorSeparator())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | connect (ui->quickColor_moveUp, SIGNAL (clicked()), this, SLOT (slot_moveColor())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | connect (ui->quickColor_moveDown, SIGNAL (clicked()), this, SLOT (slot_moveColor())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | connect (ui->quickColor_clear, SIGNAL (clicked()), this, SLOT (slot_clearColors())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | ui->downloadPath->setText (net_downloadpath); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | ui->guessNetPaths->setChecked (net_guesspaths); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | ui->autoCloseNetPrompt->setChecked (net_autoclose); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | connect (ui->findDownloadPath, SIGNAL (clicked (bool)), this, SLOT (slot_findDownloadFolder())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | ui->m_profileName->setText (ld_defaultname); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | ui->m_profileUsername->setText (ld_defaultuser); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | ui->m_profileLicense->setCurrentIndex (ld_defaultlicense); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | initGrids(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | initExtProgs(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | selectPage (deftab); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | connect (ui->buttonBox, SIGNAL (clicked (QAbstractButton*)), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | this, SLOT (buttonClicked (QAbstractButton*))); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | connect (ui->m_pages, SIGNAL (currentChanged (int)), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | this, SLOT (selectPage (int))); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | connect (ui->m_pagelist, SIGNAL (currentRowChanged (int)), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | this, SLOT (selectPage (int))); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | ConfigDialog::~ConfigDialog() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | delete ui; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | void ConfigDialog::selectPage (int row) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | ui->m_pagelist->setCurrentRow (row); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | ui->m_pages->setCurrentIndex (row); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | // Adds a shortcut entry to the list of shortcuts. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | void ConfigDialog::addShortcut (KeySequenceConfig& cfg, QAction* act, int& i) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
185 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | ShortcutListItem* item = new ShortcutListItem; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | item->setIcon (act->icon()); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | item->setKeyConfig (&cfg); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
189 | item->setAction (act); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
190 | setShortcutText (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
191 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
192 | // If the action doesn't have a valid icon, use an empty one |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | // so that the list is kept aligned. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | if (act->icon().isNull()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | item->setIcon (getIcon ("empty")); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | ui->shortcutsList->insertItem (i++, item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | // Initializes the table of grid stuff |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | void ConfigDialog::initGrids() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | QGridLayout* gridlayout = new QGridLayout; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | QLabel* xlabel = new QLabel ("X"), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | *ylabel = new QLabel ("Y"), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | *zlabel = new QLabel ("Z"), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | *anglabel = new QLabel ("Angle"); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | int i = 1; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | for (QLabel* label : initlist<QLabel*> ({xlabel, ylabel, zlabel, anglabel})) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | label->setAlignment (Qt::AlignCenter); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
215 | gridlayout->addWidget (label, 0, i++); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | for (int i = 0; i < g_NumGrids; ++i) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | // Icon |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | lb_gridIcons[i] = new QLabel; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", QString (g_GridInfo[i].name).toLower()))); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | // Text label |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | lb_gridLabels[i] = new QLabel (fmt ("%1:", g_GridInfo[i].name)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | QHBoxLayout* labellayout = new QHBoxLayout; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | labellayout->addWidget (lb_gridIcons[i]); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | labellayout->addWidget (lb_gridLabels[i]); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | gridlayout->addLayout (labellayout, i + 1, 0); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | // Add the widgets |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | for (int j = 0; j < 4; ++j) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | dsb_gridData[i][j] = new QDoubleSpinBox; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | // Set the maximum angle |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | if (j == 3) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | dsb_gridData[i][j]->setMaximum (360); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
240 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
241 | dsb_gridData[i][j]->setValue (*g_GridInfo[i].confs[j]); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | gridlayout->addWidget (dsb_gridData[i][j], i + 1, j + 1); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
243 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
245 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | ui->grids->setLayout (gridlayout); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
248 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
249 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
250 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
251 | static struct LDExtProgInfo |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
252 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
253 | const QString name, |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
254 | iconname; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
255 | QString* const path; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
256 | QLineEdit* input; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
257 | QPushButton* setPathButton; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
258 | #ifndef _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | bool* const wine; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | QCheckBox* wineBox; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
261 | #endif // _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | } g_LDExtProgInfo[] = |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
263 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
264 | #ifndef _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | # define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null, &prog_##LOWNAME##_wine, null }, |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
266 | #else |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
267 | # define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null }, |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
268 | #endif |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
269 | EXTPROG (Ytruder, ytruder) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | EXTPROG (Rectifier, rectifier) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | EXTPROG (Intersector, intersector) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
272 | EXTPROG (Isecalc, isecalc) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
273 | EXTPROG (Coverer, coverer) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
274 | EXTPROG (Edger2, edger2) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | #undef EXTPROG |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
276 | }; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
277 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
278 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
279 | // Initializes the stuff in the ext programs tab |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
280 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
281 | void ConfigDialog::initExtProgs() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
282 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
283 | QGridLayout* pathsLayout = new QGridLayout; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
284 | int row = 0; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
285 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | for (LDExtProgInfo& info : g_LDExtProgInfo) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
287 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | QLabel* icon = new QLabel, |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | *progLabel = new QLabel (info.name); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
290 | QLineEdit* input = new QLineEdit; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
291 | QPushButton* setPathButton = new QPushButton; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | icon->setPixmap (getIcon (info.iconname)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
294 | input->setText (*info.path); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
295 | setPathButton->setIcon (getIcon ("folder")); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
296 | info.input = input; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
297 | info.setPathButton = setPathButton; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
299 | connect (setPathButton, SIGNAL (clicked()), this, SLOT (slot_setExtProgPath())); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | pathsLayout->addWidget (icon, row, 0); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | pathsLayout->addWidget (progLabel, row, 1); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | pathsLayout->addWidget (input, row, 2); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
304 | pathsLayout->addWidget (setPathButton, row, 3); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
306 | #ifndef _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
307 | QCheckBox* wineBox = new QCheckBox ("Wine"); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
308 | wineBox->setChecked (*info.wine); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | info.wineBox = wineBox; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | pathsLayout->addWidget (wineBox, row, 4); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | #endif |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
312 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
313 | ++row; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
315 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | ui->extProgs->setLayout (pathsLayout); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
320 | // Set the settings based on widget data. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | void ConfigDialog::applySettings() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
323 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | // Apply configuration |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | lv_colorize = ui->colorizeObjects->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
326 | gl_colorbfc = ui->colorBFC->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | gl_blackedges = ui->blackEdges->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
328 | gl_maincolor_alpha = ( (double) ui->mainColorAlpha->value()) / 10.0f; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
329 | gl_linethickness = ui->lineThickness->value(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | gui_implicitfiles = ui->implicitFiles->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | net_downloadpath = ui->downloadPath->text(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | net_guesspaths = ui->guessNetPaths->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
333 | net_autoclose = ui->autoCloseNetPrompt->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
334 | gl_logostuds = ui->m_logostuds->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
335 | gl_linelengths = ui->linelengths->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
336 | ld_defaultuser = ui->m_profileUsername->text(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
337 | ld_defaultname = ui->m_profileName->text(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | ld_defaultlicense = ui->m_profileLicense->currentIndex(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
339 | gl_aa = ui->m_aa->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
340 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | // Rebuild the quick color toolbar |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
342 | g_win->setQuickColors (quickColors); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | gui_colortoolbar = quickColorString(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
345 | // Set the grid settings |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
346 | for (int i = 0; i < g_NumGrids; ++i) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | for (int j = 0; j < 4; ++j) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
348 | *g_GridInfo[i].confs[j] = dsb_gridData[i][j]->value(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
349 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | // Apply key shortcuts |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | g_win->updateActionShortcuts(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
352 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | // Ext program settings |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
354 | for (const LDExtProgInfo& info : g_LDExtProgInfo) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
356 | *info.path = info.input->text(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
357 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
358 | #ifndef _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
359 | *info.wine = info.wineBox->isChecked(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
360 | #endif // _WIN32 |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
361 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
362 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
363 | Config::save(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | reloadAllSubfiles(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
365 | loadLogoedStuds(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
366 | g_win->R()->setBackground(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
367 | g_win->doFullRefresh(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
368 | g_win->updateToolBars(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
369 | g_win->updateDocumentList(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
372 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | // A dialog button was clicked |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
375 | void ConfigDialog::buttonClicked (QAbstractButton* button) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
376 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
377 | typedef QDialogButtonBox QDDB; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
378 | QDialogButtonBox* dbb = ui->buttonBox; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
379 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
380 | if (button == dbb->button (QDDB::Ok)) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
381 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
382 | applySettings(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
383 | accept(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
384 | } elif (button == dbb->button (QDDB::Apply)) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
385 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
386 | applySettings(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
387 | } elif (button == dbb->button (QDDB::Cancel)) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
388 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
389 | reject(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
390 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
391 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
392 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
393 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
394 | // Update the list of color toolbar items in the quick color tab. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
395 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
396 | void ConfigDialog::updateQuickColorList (LDQuickColor* sel) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
397 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
398 | for (QListWidgetItem * item : quickColorItems) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
399 | delete item; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
400 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
401 | quickColorItems.clear(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
402 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
403 | // Init table items |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
404 | for (LDQuickColor& entry : quickColors) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
405 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
406 | QListWidgetItem* item = new QListWidgetItem; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
407 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
408 | if (entry.isSeparator()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
409 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
410 | item->setText ("--------"); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
411 | item->setIcon (getIcon ("empty")); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
412 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
413 | else |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
414 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
415 | LDColor* col = entry.getColor(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
416 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
417 | if (col == null) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
418 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
419 | item->setText ("[[unknown color]]"); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
420 | item->setIcon (getIcon ("error")); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
421 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
422 | else |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
423 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
424 | item->setText (col->name); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
425 | item->setIcon (makeColorIcon (col, 16)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
426 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
427 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
428 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
429 | ui->quickColorList->addItem (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
430 | quickColorItems << item; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
431 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
432 | if (sel && &entry == sel) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
433 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
434 | ui->quickColorList->setCurrentItem (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
435 | ui->quickColorList->scrollToItem (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
436 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
437 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
439 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
440 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
441 | // Quick colors: add or edit button was clicked. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
442 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
443 | void ConfigDialog::slot_setColor() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
444 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
445 | LDQuickColor* entry = null; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
446 | QListWidgetItem* item = null; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
447 | const bool isNew = static_cast<QPushButton*> (sender()) == ui->quickColor_add; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
448 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
449 | if (isNew == false) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
450 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
451 | item = getSelectedQuickColor(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
452 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
453 | if (!item) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
454 | return; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
455 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
456 | int i = getItemRow (item, quickColorItems); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
457 | entry = &quickColors[i]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
458 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
459 | if (entry->isSeparator() == true) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
460 | return; // don't color separators |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
461 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
462 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
463 | int defval = entry ? entry->getColor()->index : -1; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
464 | int val; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
465 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
466 | if (ColorSelector::selectColor (val, defval, this) == false) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
467 | return; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
468 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
469 | if (entry) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
470 | entry->setColor (getColor (val)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
471 | else |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
472 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
473 | LDQuickColor entry (getColor (val), null); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
474 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
475 | item = getSelectedQuickColor(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
476 | int idx = (item) ? getItemRow (item, quickColorItems) + 1 : quickColorItems.size(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
477 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
478 | quickColors.insert (idx, entry); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
479 | entry = quickColors[idx]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
480 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
481 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
482 | updateQuickColorList (entry); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
483 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
484 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
485 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
486 | // Remove a quick color |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
487 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
488 | void ConfigDialog::slot_delColor() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
489 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
490 | if (ui->quickColorList->selectedItems().isEmpty()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
491 | return; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
492 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
493 | QListWidgetItem* item = ui->quickColorList->selectedItems() [0]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
494 | quickColors.removeAt (getItemRow (item, quickColorItems)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
495 | updateQuickColorList(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
496 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
497 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
498 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
499 | // Move a quick color up/down |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
500 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
501 | void ConfigDialog::slot_moveColor() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
502 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
503 | const bool up = (static_cast<QPushButton*> (sender()) == ui->quickColor_moveUp); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
504 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
505 | if (ui->quickColorList->selectedItems().isEmpty()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
506 | return; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
507 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
508 | QListWidgetItem* item = ui->quickColorList->selectedItems() [0]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
509 | int idx = getItemRow (item, quickColorItems); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
510 | int dest = up ? (idx - 1) : (idx + 1); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
511 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
512 | if (dest < 0 || dest >= quickColorItems.size()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
513 | return; // destination out of bounds |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
514 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
515 | LDQuickColor tmp = quickColors[dest]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
516 | quickColors[dest] = quickColors[idx]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
517 | quickColors[idx] = tmp; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
518 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
519 | updateQuickColorList (&quickColors[dest]); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
520 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
521 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
522 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
523 | // Add a separator to quick colors |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
524 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
525 | void ConfigDialog::slot_addColorSeparator() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
526 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
527 | quickColors << LDQuickColor::getSeparator(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
528 | updateQuickColorList (&quickColors[quickColors.size() - 1]); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
529 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
530 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
531 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
532 | // Clear all quick colors |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
533 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
534 | void ConfigDialog::slot_clearColors() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
535 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
536 | quickColors.clear(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
537 | updateQuickColorList(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
538 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
539 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
540 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
541 | // Pick a color and set the appropriate configuration option. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
542 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
543 | void ConfigDialog::pickColor (QString& conf, QPushButton* button) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
544 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
545 | QColor col = QColorDialog::getColor (QColor (conf)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
546 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
547 | if (col.isValid()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
548 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
549 | int r = col.red(), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
550 | g = col.green(), |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
551 | b = col.blue(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
552 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
553 | QString colname; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
554 | colname.sprintf ("#%.2X%.2X%.2X", r, g, b); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
555 | conf = colname; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
556 | setButtonBackground (button, colname); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
557 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
558 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
559 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
560 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
561 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
562 | void ConfigDialog::slot_setGLBackground() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
563 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
564 | pickColor (gl_bgcolor, ui->backgroundColorButton); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
565 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
566 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
567 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
568 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
569 | void ConfigDialog::slot_setGLForeground() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
570 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
571 | pickColor (gl_maincolor, ui->mainColorButton); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
572 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
573 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
574 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
575 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
576 | void ConfigDialog::slot_setGLSelectColor() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
577 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
578 | pickColor (gl_selectcolor, ui->selColorButton); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
579 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
580 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
581 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
582 | // Sets background color of a given button. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
583 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
584 | void ConfigDialog::setButtonBackground (QPushButton* button, QString value) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
585 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
586 | button->setIcon (getIcon ("colorselect")); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
587 | button->setAutoFillBackground (true); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
588 | button->setStyleSheet (fmt ("background-color: %1", value)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
589 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
590 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
591 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
592 | // Finds the given list widget item in the list of widget items given. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
593 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
594 | int ConfigDialog::getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
595 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
596 | int i = 0; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
597 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
598 | for (QListWidgetItem* it : haystack) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
599 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
600 | if (it == item) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
601 | return i; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
602 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
603 | ++i; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
604 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
605 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
606 | return -1; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
607 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
608 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
609 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
610 | // Which quick color is currently selected? |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
611 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
612 | QListWidgetItem* ConfigDialog::getSelectedQuickColor() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
613 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
614 | if (ui->quickColorList->selectedItems().isEmpty()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
615 | return null; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
616 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
617 | return ui->quickColorList->selectedItems() [0]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
618 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
619 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
620 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
621 | // Get the list of shortcuts selected |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
622 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
623 | QList<ShortcutListItem*> ConfigDialog::getShortcutSelection() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
624 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
625 | QList<ShortcutListItem*> out; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
626 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
627 | for (QListWidgetItem* entry : ui->shortcutsList->selectedItems()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
628 | out << static_cast<ShortcutListItem*> (entry); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
629 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
630 | return out; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
631 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
632 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
633 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
634 | // Edit the shortcut of a given action. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
635 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
636 | void ConfigDialog::slot_setShortcut() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
637 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
638 | QList<ShortcutListItem*> sel = getShortcutSelection(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
639 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
640 | if (sel.size() < 1) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
641 | return; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
642 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
643 | ShortcutListItem* item = sel[0]; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
644 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
645 | if (KeySequenceDialog::staticDialog (item->getKeyConfig(), this)) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
646 | setShortcutText (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
647 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
648 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
649 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
650 | // Reset a shortcut to defaults |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
651 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
652 | void ConfigDialog::slot_resetShortcut() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
653 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
654 | QList<ShortcutListItem*> sel = getShortcutSelection(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
655 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
656 | for (ShortcutListItem* item : sel) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
657 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
658 | item->getKeyConfig()->reset(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
659 | setShortcutText (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
660 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
661 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
662 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
663 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
664 | // Remove the shortcut of an action. |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
665 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
666 | void ConfigDialog::slot_clearShortcut() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
667 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
668 | QList<ShortcutListItem*> sel = getShortcutSelection(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
669 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
670 | for (ShortcutListItem* item : sel) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
671 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
672 | item->getKeyConfig()->setValue (QKeySequence()); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
673 | setShortcutText (item); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
674 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
675 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
676 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
677 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
678 | // Set the path of an external program |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
679 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
680 | void ConfigDialog::slot_setExtProgPath() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
681 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
682 | const LDExtProgInfo* info = null; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
683 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
684 | for (const LDExtProgInfo& it : g_LDExtProgInfo) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
685 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
686 | if (it.setPathButton == sender()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
687 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
688 | info = ⁢ |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
689 | break; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
690 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
691 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
692 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
693 | assert (info != null); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
694 | QString fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, g_extProgPathFilter); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
695 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
696 | if (fpath.isEmpty()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
697 | return; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
698 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
699 | info->input->setText (fpath); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
700 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
701 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
702 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
703 | // '...' button pressed for the download path |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
704 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
705 | void ConfigDialog::slot_findDownloadFolder() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
706 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
707 | QString dpath = QFileDialog::getExistingDirectory(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
708 | ui->downloadPath->setText (dpath); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
709 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
710 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
711 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
712 | // Updates the text string for a given shortcut list item |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
713 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
714 | void ConfigDialog::setShortcutText (ShortcutListItem* item) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
715 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
716 | QAction* act = item->getAction(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
717 | QString label = act->iconText(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
718 | QString keybind = item->getKeyConfig()->getValue().toString(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
719 | item->setText (fmt ("%1 (%2)", label, keybind)); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
720 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
721 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
722 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
723 | // Gets the configuration string of the quick color toolbar |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
724 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
725 | QString ConfigDialog::quickColorString() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
726 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
727 | QString val; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
728 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
729 | for (const LDQuickColor& entry : quickColors) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
730 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
731 | if (val.length() > 0) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
732 | val += ':'; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
733 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
734 | if (entry.isSeparator()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
735 | val += '|'; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
736 | else |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
737 | val += fmt ("%1", entry.getColor()->index); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
738 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
739 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
740 | return val; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
741 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
742 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
743 | // =============================================================================================== |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
744 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
745 | // =============================================================================================== |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
746 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
747 | // =============================================================================================== |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
748 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
749 | // =============================================================================================== |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
750 | KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, Qt::WindowFlags f) : |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
751 | QDialog (parent, f), seq (seq) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
752 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
753 | lb_output = new QLabel; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
754 | IMPLEMENT_DIALOG_BUTTONS |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
755 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
756 | setWhatsThis (tr ("Into this dialog you can input a key sequence for use as a " |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
757 | "shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to " |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
758 | "dismiss.")); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
759 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
760 | QVBoxLayout* layout = new QVBoxLayout; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
761 | layout->addWidget (lb_output); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
762 | layout->addWidget (bbx_buttons); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
763 | setLayout (layout); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
764 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
765 | updateOutput(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
766 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
767 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
768 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
769 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
770 | bool KeySequenceDialog::staticDialog (KeySequenceConfig* cfg, QWidget* parent) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
771 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
772 | KeySequenceDialog dlg (cfg->getValue(), parent); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
773 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
774 | if (dlg.exec() == false) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
775 | return false; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
776 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
777 | cfg->setValue (dlg.seq); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
778 | return true; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
779 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
780 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
781 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
782 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
783 | void KeySequenceDialog::updateOutput() |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
784 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
785 | QString shortcut = seq.toString(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
786 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
787 | if (seq == QKeySequence()) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
788 | shortcut = "<empty>"; |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
789 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
790 | QString text = fmt ("<center><b>%1</b></center>", shortcut); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
791 | lb_output->setText (text); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
792 | } |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
793 | |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
794 | // ============================================================================= |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
795 | // ----------------------------------------------------------------------------- |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
796 | void KeySequenceDialog::keyPressEvent (QKeyEvent* ev) |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
797 | { |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
798 | seq = ev->key() + ev->modifiers(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
799 | updateOutput(); |
b75c6cce02e2
- refactored filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
800 | } |