src/configDialog.cpp

Sat, 24 Aug 2013 15:00:46 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 24 Aug 2013 15:00:46 +0300
changeset 480
ee5a4c5d4461
parent 475
1f5ab7410e4d
child 481
1db661456fb4
permissions
-rw-r--r--

rework quick color code a tad

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
17 * =====================================================================
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
18 *
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
19 * configDialog.cpp: Settings dialog and everything related to it.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
20 * Actual configuration core is in config.cpp.
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22
202
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
23 #include <QGridLayout>
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
24 #include <QFileDialog>
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
25 #include <QColorDialog>
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
26 #include <QBoxLayout>
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
27 #include <QKeyEvent>
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
28 #include <QGroupBox>
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
29 #include <QDoubleSpinBox>
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
30 #include <QLineEdit>
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
31 #include <QCheckBox>
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 #include "common.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include "configDialog.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "file.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 #include "config.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 #include "misc.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #include "colors.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 #include "colorSelectDialog.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
39 #include "gldraw.h"
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
40 #include "ui_config.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
42 extern_cfg (String, gl_bgcolor);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
43 extern_cfg (String, gl_maincolor);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
44 extern_cfg (Bool, lv_colorize);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
45 extern_cfg (Bool, gl_colorbfc);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
46 extern_cfg (Float, gl_maincolor_alpha);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
47 extern_cfg (Int, gl_linethickness);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
48 extern_cfg (String, gui_colortoolbar);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
49 extern_cfg (Bool, edit_schemanticinline);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
50 extern_cfg (Bool, gl_blackedges);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
51 extern_cfg (Bool, gui_implicitfiles);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
52 extern_cfg (String, net_downloadpath);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
53 extern_cfg (Bool, net_guesspaths);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
54 extern_cfg (Bool, net_autoclose);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
55 extern_cfg (Bool, gl_logostuds);
464
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
56 extern_cfg (String, ld_defaultname);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
57 extern_cfg (String, ld_defaultuser);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
58 extern_cfg (Int, ld_defaultlicense);
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
59 extern_cfg (String, prog_ytruder);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
60 extern_cfg (String, prog_rectifier);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
61 extern_cfg (String, prog_intersector);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
62 extern_cfg (String, prog_coverer);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
63 extern_cfg (String, prog_isecalc);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
64 extern_cfg (String, prog_edger2);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
65 extern_cfg (Bool, prog_ytruder_wine);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
66 extern_cfg (Bool, prog_rectifier_wine);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
67 extern_cfg (Bool, prog_intersector_wine);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
68 extern_cfg (Bool, prog_coverer_wine);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
69 extern_cfg (Bool, prog_isecalc_wine);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
70 extern_cfg (Bool, prog_edger2_wine);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
72 #define act(N) extern_cfg (KeySequence, key_##N);
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
73 #include "actions.h"
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
74
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
75 const char* g_extProgPathFilter =
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
76 #ifdef _WIN32
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
77 "Applications (*.exe)(*.exe);;All files (*.*)(*.*)";
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
78 #else
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
79 "";
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
80 #endif
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
81
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
83 // -----------------------------------------------------------------------------
467
59549731151a Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
84 ConfigDialog::ConfigDialog (ConfigDialog::Tab deftab, QWidget* parent, Qt::WindowFlags f) :
59549731151a Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
85 QDialog (parent, f)
59549731151a Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
86 {
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
87 assert (g_win);
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
88 ui = new Ui_ConfigUI;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
89 ui->setupUi (this);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
91 // Interface tab
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
92 setButtonBackground (ui->backgroundColorButton, gl_bgcolor);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
93 connect (ui->backgroundColorButton, SIGNAL (clicked()),
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
94 this, SLOT (slot_setGLBackground()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
95
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
96 setButtonBackground (ui->mainColorButton, gl_maincolor);
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
97 connect (ui->mainColorButton, SIGNAL (clicked()),
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
98 this, SLOT (slot_setGLForeground()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
99
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
100 ui->mainColorAlpha->setValue (gl_maincolor_alpha * 10.0f);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
101 ui->lineThickness->setValue (gl_linethickness);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
102 ui->colorizeObjects->setChecked (lv_colorize);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
103 ui->colorBFC->setChecked (gl_colorbfc);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
104 ui->blackEdges->setChecked (gl_blackedges);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
105 ui->implicitFiles->setChecked (gui_implicitfiles);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
106 ui->m_logostuds->setChecked (gl_logostuds);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
107
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
108 ulong i = 0;
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
109 #define act(N) addShortcut (key_##N, ACTION(N), i);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
110 #include "actions.h"
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
111
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
112 ui->shortcutsList->setSortingEnabled (true);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
113 ui->shortcutsList->sortItems();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
114
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
115 connect (ui->shortcut_set, SIGNAL (clicked()), this, SLOT (slot_setShortcut()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
116 connect (ui->shortcut_reset, SIGNAL (clicked()), this, SLOT (slot_resetShortcut()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
117 connect (ui->shortcut_clear, SIGNAL (clicked()), this, SLOT (slot_clearShortcut()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
118
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
119 quickColors = quickColorsFromConfig();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
120 updateQuickColorList();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
121
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
122 connect (ui->quickColor_add, SIGNAL (clicked()), this, SLOT (slot_setColor()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
123 connect (ui->quickColor_remove, SIGNAL (clicked()), this, SLOT (slot_delColor()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
124 connect (ui->quickColor_edit, SIGNAL (clicked()), this, SLOT (slot_setColor()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
125 connect (ui->quickColor_addSep, SIGNAL (clicked()), this, SLOT (slot_addColorSeparator()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
126 connect (ui->quickColor_moveUp, SIGNAL (clicked()), this, SLOT (slot_moveColor()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
127 connect (ui->quickColor_moveDown, SIGNAL (clicked()), this, SLOT (slot_moveColor()));
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
128 connect (ui->quickColor_clear, SIGNAL (clicked()), this, SLOT (slot_clearColors()));
430
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
129
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
130 ui->downloadPath->setText (net_downloadpath);
431
ec1e2059319b stability to downloading
Santeri Piippo <crimsondusk64@gmail.com>
parents: 430
diff changeset
131 ui->guessNetPaths->setChecked (net_guesspaths);
ec1e2059319b stability to downloading
Santeri Piippo <crimsondusk64@gmail.com>
parents: 430
diff changeset
132 ui->autoCloseNetPrompt->setChecked (net_autoclose);
430
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
133 connect (ui->findDownloadPath, SIGNAL (clicked(bool)), this, SLOT (slot_findDownloadFolder()));
464
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
134
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
135 ui->m_profileName->setText (ld_defaultname);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
136 ui->m_profileUsername->setText (ld_defaultuser);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
137 ui->m_profileLicense->setCurrentIndex (ld_defaultlicense);
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
138 ui->tabs->setCurrentIndex (deftab);
467
59549731151a Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
139
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
140 initGrids();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
141 initExtProgs();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
142
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
143 connect (ui->buttonBox, SIGNAL (clicked (QAbstractButton*)),
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
144 this, SLOT (buttonClicked(QAbstractButton*)));
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
145 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
146
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
147 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
148 // -----------------------------------------------------------------------------
411
fd90677cec8d cleanup
Santeri Piippo <crimsondusk64@gmail.com>
parents: 410
diff changeset
149 ConfigDialog::~ConfigDialog() {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
150 delete ui;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
154 // Adds a shortcut entry to the list of shortcuts.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
155 // -----------------------------------------------------------------------------
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
156 void ConfigDialog::addShortcut (KeySequenceConfig& cfg, QAction* act, ulong& i) {
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
157 ShortcutListItem* item = new ShortcutListItem;
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
158 item->setIcon (act->icon());
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
159 item->setKeyConfig (&cfg);
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
160 item->setAction (act);
386
751d31336f08 fixed config dialog crashing
Santeri Piippo <crimsondusk64@gmail.com>
parents: 382
diff changeset
161 setShortcutText (item);
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
162
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
163 // If the action doesn't have a valid icon, use an empty one
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
164 // so that the list is kept aligned.
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
165 if (act->icon().isNull())
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
166 item->setIcon (getIcon ("empty"));
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
167
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
168 ui->shortcutsList->insertItem (i++, item);
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
169 }
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
170
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
171 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
172 // Initializes the table of grid stuff
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
173 // -----------------------------------------------------------------------------
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
174 void ConfigDialog::initGrids() {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
175 QGridLayout* gridlayout = new QGridLayout;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
176 QLabel* xlabel = new QLabel ("X"),
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
177 *ylabel = new QLabel ("Y"),
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
178 *zlabel = new QLabel ("Z"),
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
179 *anglabel = new QLabel ("Angle");
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
180 short i = 1;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
181
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
182 for (QLabel* label : initlist<QLabel*> ({ xlabel, ylabel, zlabel, anglabel })) {
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
183 label->setAlignment (Qt::AlignCenter);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
184 gridlayout->addWidget (label, 0, i++);
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
185 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
187 for (int i = 0; i < g_NumGrids; ++i) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
188 // Icon
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
189 lb_gridIcons[i] = new QLabel;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
190 lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", str (g_GridInfo[i].name).toLower())));
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
191
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
192 // Text label
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
193 lb_gridLabels[i] = new QLabel (fmt ("%1:", g_GridInfo[i].name));
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
194
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
195 QHBoxLayout* labellayout = new QHBoxLayout;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
196 labellayout->addWidget (lb_gridIcons[i]);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
197 labellayout->addWidget (lb_gridLabels[i]);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
198 gridlayout->addLayout (labellayout, i + 1, 0);
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
199
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
200 // Add the widgets
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
201 for (int j = 0; j < 4; ++j) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
202 dsb_gridData[i][j] = new QDoubleSpinBox;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
203 dsb_gridData[i][j]->setValue (g_GridInfo[i].confs[j]->value);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
204 gridlayout->addWidget (dsb_gridData[i][j], i + 1, j + 1);
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
205 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
206 }
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
207
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
208 ui->grids->setLayout (gridlayout);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
209 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
210
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
212 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
213 static const struct extProgInfo {
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
214 const str name, iconname;
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
215 StringConfig* const path;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
216 mutable QLineEdit* input;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
217 mutable QPushButton* setPathButton;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
218 #ifndef _WIN32
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
219 BoolConfig* const wine;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
220 mutable QCheckBox* wineBox;
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
221 #endif // _WIN32
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
222 } g_extProgInfo[] = {
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
223 #ifndef _WIN32
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
224 # define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null, &prog_##LOWNAME##_wine, null },
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
225 #else
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
226 # define EXTPROG(NAME, LOWNAME) { #NAME, #LOWNAME, &prog_##LOWNAME, null, null },
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
227 #endif
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
228 EXTPROG (Ytruder, ytruder)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
229 EXTPROG (Rectifier, rectifier)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
230 EXTPROG (Intersector, intersector)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
231 EXTPROG (Isecalc, isecalc)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
232 EXTPROG (Coverer, coverer)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
233 EXTPROG (Edger2, edger2)
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
234 #undef EXTPROG
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
236
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
237 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
238 // Initializes the stuff in the ext programs tab
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
239 // -----------------------------------------------------------------------------
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
240 void ConfigDialog::initExtProgs() {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241 QGridLayout* pathsLayout = new QGridLayout;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
242 ulong row = 0;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
243
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
244 for (const extProgInfo & info : g_extProgInfo) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
245 QLabel* icon = new QLabel,
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
246 *progLabel = new QLabel (info.name);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
247 QLineEdit* input = new QLineEdit;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
248 QPushButton* setPathButton = new QPushButton;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
249
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
250 icon->setPixmap (getIcon (info.iconname));
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
251 input->setText (info.path->value);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
252 setPathButton->setIcon (getIcon ("folder"));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
253 info.input = input;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
254 info.setPathButton = setPathButton;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
255
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
256 connect (setPathButton, SIGNAL (clicked()), this, SLOT (slot_setExtProgPath()));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
257
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
258 pathsLayout->addWidget (icon, row, 0);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
259 pathsLayout->addWidget (progLabel, row, 1);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
260 pathsLayout->addWidget (input, row, 2);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
261 pathsLayout->addWidget (setPathButton, row, 3);
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
262
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
263 #ifndef _WIN32
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
264 QCheckBox* wineBox = new QCheckBox ("Wine");
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
265 wineBox->setChecked (*info.wine);
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
266 info.wineBox = wineBox;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
267 pathsLayout->addWidget (wineBox, row, 4);
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
268 #endif
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
269
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
270 ++row;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
271 }
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
272
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
273 ui->extProgs->setLayout (pathsLayout);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
274 }
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
275
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
276 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
277 // Set the settings based on widget data.
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
278 // -----------------------------------------------------------------------------
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
279 void ConfigDialog::applySettings() {
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
280 // Apply configuration
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
281 lv_colorize = ui->colorizeObjects->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
282 gl_colorbfc = ui->colorBFC->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
283 gl_blackedges = ui->blackEdges->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
284 gl_maincolor_alpha = ((double) ui->mainColorAlpha->value()) / 10.0f;
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
285 gl_linethickness = ui->lineThickness->value();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
286 gui_implicitfiles = ui->implicitFiles->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
287 net_downloadpath = ui->downloadPath->text();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
288 net_guesspaths = ui->guessNetPaths->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
289 net_autoclose = ui->autoCloseNetPrompt->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
290 gl_logostuds = ui->m_logostuds->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
291 ld_defaultuser = ui->m_profileUsername->text();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
292 ld_defaultname = ui->m_profileName->text();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
293 ld_defaultlicense = ui->m_profileLicense->currentIndex();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
294
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
295 // Ensure '/' postfix to the download path
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
296 if (net_downloadpath.value.right (1) != DIRSLASH)
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
297 net_downloadpath += DIRSLASH;
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
298
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
299 // Rebuild the quick color toolbar
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
300 g_win->setQuickColors (quickColors);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
301 gui_colortoolbar = quickColorString();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
302
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
303 // Set the grid settings
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
304 for (int i = 0; i < g_NumGrids; ++i)
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
305 for (int j = 0; j < 4; ++j)
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
306 g_GridInfo[i].confs[j]->value = dsb_gridData[i][j]->value();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
307
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
308 // Apply key shortcuts
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
309 #define act(N) ACTION(N)->setShortcut (key_##N);
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
310 #include "actions.h"
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
311
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
312 // Ext program settings
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
313 for (const extProgInfo & info : g_extProgInfo) {
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
314 *info.path = info.input->text();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
315
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
316 #ifndef _WIN32
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
317 *info.wine = info.wineBox->isChecked();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
318 #endif // _WIN32
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
319 }
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
320
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
321 Config::save();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
322 reloadAllSubfiles();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
323 loadLogoedStuds();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
324 g_win->R()->setBackground();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
325 g_win->fullRefresh();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
326 g_win->updateToolBars();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
327 g_win->updateFileList();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
328 }
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
329
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
330 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
331 // A dialog button was clicked
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
332 // -----------------------------------------------------------------------------
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
333 void ConfigDialog::buttonClicked (QAbstractButton* button) {
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
334 typedef QDialogButtonBox QDDB;
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
335 QDialogButtonBox* dbb = ui->buttonBox;
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
336
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
337 if (button == dbb->button (QDDB::Ok)) {
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
338 applySettings();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
339 accept();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
340 } elif (button == dbb->button (QDDB::Apply)) {
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
341 applySettings();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
342 } elif (button == dbb->button (QDDB::Cancel)) {
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
343 reject();
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 467
diff changeset
344 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
346
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
347 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
348 // Update the list of color toolbar items in the quick color tab.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
349 // -----------------------------------------------------------------------------
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
350 void ConfigDialog::updateQuickColorList (LDQuickColor* sel) {
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
351 for (QListWidgetItem* item : quickColorItems)
186
a130960bb220 Make quick color toolbar use QToolButtons, make color selector's process of making color icons a method and use that for generic color icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
352 delete item;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
354 quickColorItems.clear();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
355
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
356 // Init table items
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
357 for (LDQuickColor& entry : quickColors) {
186
a130960bb220 Make quick color toolbar use QToolButtons, make color selector's process of making color icons a method and use that for generic color icons
Santeri Piippo <crimsondusk64@gmail.com>
parents: 183
diff changeset
358 QListWidgetItem* item = new QListWidgetItem;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
360 if (entry.isSeparator()) {
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
361 item->setText ("--------");
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
362 item->setIcon (getIcon ("empty"));
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
363 } else {
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
364 LDColor* col = entry.color();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
366 if (col == null) {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
367 item->setText ("[[unknown color]]");
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
368 item->setIcon (getIcon ("error"));
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
369 } else {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
370 item->setText (col->name);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
371 item->setIcon (makeColorIcon (col, 16));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
372 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
373 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
374
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
375 ui->quickColorList->addItem (item);
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
376 quickColorItems << item;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
377
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
378 if (sel &&& entry == sel) {
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
379 ui->quickColorList->setCurrentItem (item);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
380 ui->quickColorList->scrollToItem (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
381 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
382 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
383 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
384
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
385 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
386 // Quick colors: add or edit button was clicked.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
387 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
388 void ConfigDialog::slot_setColor() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
389 LDQuickColor* entry = null;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
390 QListWidgetItem* item = null;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
391 const bool isNew = static_cast<QPushButton*> (sender()) == ui->quickColor_add;
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
392
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
393 if (isNew == false) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
394 item = getSelectedQuickColor();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
395
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
396 if (!item)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
397 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
398
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
399 ulong i = getItemRow (item, quickColorItems);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
400 entry = &quickColors[i];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
401
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
402 if (entry->isSeparator() == true)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
403 return; // don't color separators
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
404 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
405
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
406 short defval = entry ? entry->color()->index : -1;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
407 short val;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
408
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
409 if (ColorSelector::getColor (val, defval, this) == false)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
411
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
412 if (entry)
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
413 entry->setColor (getColor (val));
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
414 else {
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
415 LDQuickColor entry (getColor (val), null);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
417 item = getSelectedQuickColor();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
418 ulong idx;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
419
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
420 if (item)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
421 idx = getItemRow (item, quickColorItems) + 1;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
422 else
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
423 idx = quickColorItems.size();
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
424
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
425 quickColors.insert (idx, entry);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
426 entry = quickColors[idx];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
427 }
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
428
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
429 updateQuickColorList (entry);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
430 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
431
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
432 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
433 // Remove a quick color
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
434 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
435 void ConfigDialog::slot_delColor() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
436 if (ui->quickColorList->selectedItems().size() == 0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
437 return;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
438
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
439 QListWidgetItem* item = ui->quickColorList->selectedItems() [0];
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
440 quickColors.erase (getItemRow (item, quickColorItems));
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
441 updateQuickColorList();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
442 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
443
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
444 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
445 // Move a quick color up/down
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
446 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
447 void ConfigDialog::slot_moveColor() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
448 const bool up = (static_cast<QPushButton*> (sender()) == ui->quickColor_moveUp);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
449
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
450 if (ui->quickColorList->selectedItems().size() == 0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
451 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
452
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
453 QListWidgetItem* item = ui->quickColorList->selectedItems() [0];
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
454 int idx = getItemRow (item, quickColorItems);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
455 int dest = up ? (idx - 1) : (idx + 1);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
456
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
457 if (dest < 0 || (ulong) dest >= quickColorItems.size())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
458 return; // destination out of bounds
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
459
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
460 LDQuickColor tmp = quickColors[dest];
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
461 quickColors[dest] = quickColors[idx];
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
462 quickColors[idx] = tmp;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
463
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
464 updateQuickColorList (&quickColors[dest]);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
465 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
466
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
467 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
468 // Add a separator to quick colors
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
469 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
470 void ConfigDialog::slot_addColorSeparator() {
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
471 quickColors << LDQuickColor::getSeparator();
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
472 updateQuickColorList (&quickColors[quickColors.size() - 1]);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
473 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
474
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
475 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
476 // Clear all quick colors
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
477 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
478 void ConfigDialog::slot_clearColors() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
479 quickColors.clear();
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
480 updateQuickColorList();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
481 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
482
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
483 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
484 // Pick a color and set the appropriate configuration option.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
485 // -----------------------------------------------------------------------------
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
486 void ConfigDialog::pickColor (StringConfig& conf, QPushButton* button) {
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
487 QColor col = QColorDialog::getColor (QColor (conf));
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
488
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
489 if (col.isValid()) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
490 uchar r = col.red(),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
491 g = col.green(),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
492 b = col.blue();
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
493 conf.value.sprintf ("#%.2X%.2X%.2X", r, g, b);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
494 setButtonBackground (button, conf.value);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
495 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
496 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
497
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
498 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
499 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
500 void ConfigDialog::slot_setGLBackground() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
501 pickColor (gl_bgcolor, ui->backgroundColorButton);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
502 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
503
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
504 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
505 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
506 void ConfigDialog::slot_setGLForeground() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
507 pickColor (gl_maincolor, ui->mainColorButton);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
508 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
509
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
510 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
511 // Sets background color of a given button.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
512 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
513 void ConfigDialog::setButtonBackground (QPushButton* button, str value) {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
514 button->setIcon (getIcon ("colorselect"));
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
515 button->setAutoFillBackground (true);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
516 button->setStyleSheet (fmt ("background-color: %1", value));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
517 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
518
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
519 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
520 // Finds the given list widget item in the list of widget items given.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
521 // -----------------------------------------------------------------------------
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 395
diff changeset
522 int ConfigDialog::getItemRow (QListWidgetItem* item, List<QListWidgetItem*>& haystack) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
523 int i = 0;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
524
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
525 for (QListWidgetItem* it : haystack) {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
526 if (it == item)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
527 return i;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
528
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
529 ++i;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
530 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
531 return -1;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
532 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
533
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
534 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
535 // Which quick color is currently selected?
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
536 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
537 QListWidgetItem* ConfigDialog::getSelectedQuickColor() {
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
538 if (ui->quickColorList->selectedItems().size() == 0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
539 return null;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
540
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
541 return ui->quickColorList->selectedItems()[0];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
542 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
543
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
544 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
545 // Get the list of shortcuts selected
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
546 // -----------------------------------------------------------------------------
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
547 QList<ShortcutListItem*> ConfigDialog::getShortcutSelection() {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
548 QList<ShortcutListItem*> out;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
549
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
550 for (QListWidgetItem* entry : ui->shortcutsList->selectedItems())
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
551 out << static_cast<ShortcutListItem*> (entry);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
552
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
553 return out;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
554 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
555
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
556 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
557 // Edit the shortcut of a given action.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
558 // -----------------------------------------------------------------------------
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
559 void ConfigDialog::slot_setShortcut() {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
560 QList<ShortcutListItem*> sel = getShortcutSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
561
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
562 if (sel.size() < 1)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
563 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
564
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
565 ShortcutListItem* item = sel[0];
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
566
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
567 if (KeySequenceDialog::staticDialog (item->keyConfig(), this))
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
568 setShortcutText (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
569 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
570
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
571 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
572 // Reset a shortcut to defaults
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
573 // -----------------------------------------------------------------------------
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
574 void ConfigDialog::slot_resetShortcut() {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
575 QList<ShortcutListItem*> sel = getShortcutSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
576
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
577 for (ShortcutListItem* item : sel) {
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
578 item->keyConfig()->reset();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
579 setShortcutText (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
580 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
581 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
582
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
583 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
584 // Remove the shortcut of an action.
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
585 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
586 void ConfigDialog::slot_clearShortcut() {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
587 QList<ShortcutListItem*> sel = getShortcutSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
588
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
589 for (ShortcutListItem* item : sel) {
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
590 item->keyConfig()->value = QKeySequence();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
591 setShortcutText (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
592 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
593 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
594
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
595 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
596 // Set the path of an external program
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
597 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
598 void ConfigDialog::slot_setExtProgPath() {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
599 const extProgInfo* info = null;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
600
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
601 for (const extProgInfo& it : g_extProgInfo) {
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
602 if (it.setPathButton == sender()) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
603 info = &it;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
604 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
605 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
606 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
607
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
608 assert (info != null);
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
609 str fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, g_extProgPathFilter);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
610
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
611 if (fpath.isEmpty())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
612 return;
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
613
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
614 info->input->setText (fpath);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
615 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
616
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
617 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
618 // '...' button pressed for the download path
430
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
619 // -----------------------------------------------------------------------------
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
620 void ConfigDialog::slot_findDownloadFolder() {
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
621 str dpath = QFileDialog::getExistingDirectory();
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
622 ui->downloadPath->setText (dpath);
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
623 }
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
624
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
625 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
626 // Updates the text string for a given shortcut list item
452
47cc663e4ff4 ask the user for ext prog paths instead of telling to go to configuration if no path is defined
Santeri Piippo <crimsondusk64@gmail.com>
parents: 431
diff changeset
627 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
628 void ConfigDialog::setShortcutText (ShortcutListItem* item) {
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
629 QAction* act = item->action();
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
630 str label = act->iconText();
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
631 str keybind = item->keyConfig()->value.toString();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
632 item->setText (fmt ("%1 (%2)", label, keybind));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
633 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
634
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
635 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
636 // Gets the configuration string of the quick color toolbar
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
637 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
638 str ConfigDialog::quickColorString() {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
639 str val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
640
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
641 for (const LDQuickColor& entry : quickColors) {
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
642 if (val.length() > 0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
643 val += ':';
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
644
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
645 if (entry.isSeparator())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
646 val += '|';
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
647 else
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
648 val += fmt ("%1", entry.color()->index);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
649 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
650
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
651 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
652 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
653
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
654 // =========================================================================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
655 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
656 // =========================================================================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
657 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
658 // =========================================================================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
659 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
660 // =========================================================================================================================
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
661 KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, Qt::WindowFlags f) :
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
662 QDialog (parent, f), seq (seq) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
663 lb_output = new QLabel;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
664 IMPLEMENT_DIALOG_BUTTONS
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
665
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
666 setWhatsThis ("Into this dialog you can input a key sequence for use as a "
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
667 "shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to "
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
668 "dismiss.");
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
669
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
670 QVBoxLayout* layout = new QVBoxLayout;
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
671 layout->addWidget (lb_output);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
672 layout->addWidget (bbx_buttons);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
673 setLayout (layout);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
674
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
675 updateOutput();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
676 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
677
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
678 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
679 // -----------------------------------------------------------------------------
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 458
diff changeset
680 bool KeySequenceDialog::staticDialog (KeySequenceConfig* cfg, QWidget* parent) {
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
681 KeySequenceDialog dlg (cfg->value, parent);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
682
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
683 if (dlg.exec() == false)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
684 return false;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
685
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
686 cfg->value = dlg.seq;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
687 return true;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
688 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
689
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
690 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
691 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
692 void KeySequenceDialog::updateOutput() {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
693 str shortcut = seq.toString();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
694
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
695 if (seq == QKeySequence())
202
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
696 shortcut = "&lt;empty&gt;";
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
697
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
698 str text = fmt ("<center><b>%1</b></center>", shortcut);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
699 lb_output->setText (text);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
700 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
701
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
702 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
703 // -----------------------------------------------------------------------------
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
704 void KeySequenceDialog::keyPressEvent (QKeyEvent* ev) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
705 seq = ev->key() + ev->modifiers();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
706 updateOutput();
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 452
diff changeset
707 }

mercurial