src/configDialog.cpp

Tue, 22 Oct 2013 19:22:15 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 22 Oct 2013 19:22:15 +0300
changeset 526
b29b6fc45ba9
parent 517
2b5adb45aaa5
child 527
47c068f2e7e3
permissions
-rw-r--r--

style corrections

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"
526
b29b6fc45ba9 style corrections
Santeri Piippo <crimsondusk64@gmail.com>
parents: 517
diff changeset
41 #include "moc_configDialog.cpp"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42
461
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_bgcolor);
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 (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
45 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
46 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
47 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
48 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
49 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
50 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
51 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
52 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
53 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
54 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
55 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
56 extern_cfg (Bool, gl_logostuds);
464
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
57 extern_cfg (String, ld_defaultname);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
58 extern_cfg (String, ld_defaultuser);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
59 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
60 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
61 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
62 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
63 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
64 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
65 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
66 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
67 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
68 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
69 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
70 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
71 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
72
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
73 #define act(N) extern_cfg (KeySequence, key_##N);
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
74 #include "actions.h"
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
75
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
76 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
77 #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
78 "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
79 #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
80 "";
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 #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
82
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
83 // =============================================================================
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
84 // -----------------------------------------------------------------------------
467
59549731151a Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
85 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
86 QDialog (parent, f)
59549731151a Added ListConfig type, using it in recent files now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
87 {
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
88 assert (g_win != null);
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
89 ui = new Ui_ConfigUI;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
90 ui->setupUi (this);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
91
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
92 // 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
93 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
94 connect (ui->backgroundColorButton, SIGNAL (clicked()),
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
95 this, SLOT (slot_setGLBackground()));
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
96
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
97 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
98 connect (ui->mainColorButton, SIGNAL (clicked()),
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
99 this, SLOT (slot_setGLForeground()));
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
100
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
101 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
102 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
103 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
104 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
105 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
106 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
107 ui->m_logostuds->setChecked (gl_logostuds);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
108
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
109 int i = 0;
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
110 #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
111 #include "actions.h"
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
112
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
113 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
114 ui->shortcutsList->sortItems();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
115
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
116 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
117 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
118 connect (ui->shortcut_clear, SIGNAL (clicked()), this, SLOT (slot_clearShortcut()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
119
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
120 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
121 updateQuickColorList();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
122
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
123 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
124 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
125 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
126 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
127 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
128 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
129 connect (ui->quickColor_clear, SIGNAL (clicked()), this, SLOT (slot_clearColors()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
130
430
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
131 ui->downloadPath->setText (net_downloadpath);
431
ec1e2059319b stability to downloading
Santeri Piippo <crimsondusk64@gmail.com>
parents: 430
diff changeset
132 ui->guessNetPaths->setChecked (net_guesspaths);
ec1e2059319b stability to downloading
Santeri Piippo <crimsondusk64@gmail.com>
parents: 430
diff changeset
133 ui->autoCloseNetPrompt->setChecked (net_autoclose);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
134 connect (ui->findDownloadPath, SIGNAL (clicked (bool)), this, SLOT (slot_findDownloadFolder()));
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
135
464
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
136 ui->m_profileName->setText (ld_defaultname);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
137 ui->m_profileUsername->setText (ld_defaultuser);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
138 ui->m_profileLicense->setCurrentIndex (ld_defaultlicense);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
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();
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
142 selectPage (deftab);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
143
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
144 connect (ui->buttonBox, SIGNAL (clicked (QAbstractButton*)),
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
145 this, SLOT (buttonClicked (QAbstractButton*)));
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
146
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
147 connect (ui->m_pages, SIGNAL (currentChanged (int)),
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
148 this, SLOT (selectPage (int)));
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
149
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
150 connect (ui->m_pagelist, SIGNAL (currentRowChanged (int)),
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
151 this, SLOT (selectPage (int)));
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
152 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
153
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
154 // =============================================================================
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 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
156 ConfigDialog::~ConfigDialog()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
157 { delete ui;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
159
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
160 // =============================================================================
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
161 // -----------------------------------------------------------------------------
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
162 void ConfigDialog::selectPage (int row)
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
163 { ui->m_pagelist->setCurrentRow (row);
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
164 ui->m_pages->setCurrentIndex (row);
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
165 }
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
166
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
167 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
168 // 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
169 // -----------------------------------------------------------------------------
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
170 void ConfigDialog::addShortcut (KeySequenceConfig& cfg, QAction* act, int& i)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
171 { ShortcutListItem* item = new ShortcutListItem;
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
172 item->setIcon (act->icon());
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
173 item->setKeyConfig (&cfg);
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
174 item->setAction (act);
386
751d31336f08 fixed config dialog crashing
Santeri Piippo <crimsondusk64@gmail.com>
parents: 382
diff changeset
175 setShortcutText (item);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
176
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
177 // 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
178 // so that the list is kept aligned.
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
179 if (act->icon().isNull())
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
180 item->setIcon (getIcon ("empty"));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
181
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
182 ui->shortcutsList->insertItem (i++, item);
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
183 }
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
184
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
185 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
186 // 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
187 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
188 void ConfigDialog::initGrids()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
189 { 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
190 QLabel* xlabel = new QLabel ("X"),
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
191 *ylabel = new QLabel ("Y"),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
192 *zlabel = new QLabel ("Z"),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
193 *anglabel = new QLabel ("Angle");
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
194 short i = 1;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
195
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
196 for (QLabel* label : initlist<QLabel*> ({xlabel, ylabel, zlabel, anglabel}))
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
197 { label->setAlignment (Qt::AlignCenter);
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
198 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
199 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
200
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
201 for (int i = 0; i < g_NumGrids; ++i)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
202 { // Icon
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
203 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
204 lb_gridIcons[i]->setPixmap (getIcon (fmt ("grid-%1", str (g_GridInfo[i].name).toLower())));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
205
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
206 // Text label
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
207 lb_gridLabels[i] = new QLabel (fmt ("%1:", g_GridInfo[i].name));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
208
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
209 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
210 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
211 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
212 gridlayout->addLayout (labellayout, i + 1, 0);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
213
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
214 // Add the widgets
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
215 for (int j = 0; j < 4; ++j)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
216 { 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
217 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
218 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
219 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
220 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
221
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
222 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
223 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
224
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
225 // =============================================================================
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
226 // -----------------------------------------------------------------------------
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
227 static const struct LDExtProgInfo
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
228 { 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
229 StringConfig* const path;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
230 mutable QLineEdit* input;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
231 mutable QPushButton* setPathButton;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
232 #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
233 BoolConfig* const wine;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
234 mutable QCheckBox* wineBox;
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
235 #endif // _WIN32
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
236 } g_LDExtProgInfo[] =
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
237 {
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
238 #ifndef _WIN32
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
239 # 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
240 #else
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
241 # 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
242 #endif
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
243 EXTPROG (Ytruder, ytruder)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
244 EXTPROG (Rectifier, rectifier)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
245 EXTPROG (Intersector, intersector)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
246 EXTPROG (Isecalc, isecalc)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
247 EXTPROG (Coverer, coverer)
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
248 EXTPROG (Edger2, edger2)
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
249 #undef EXTPROG
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251
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
252 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
253 // 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
254 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
255 void ConfigDialog::initExtProgs()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
256 { QGridLayout* pathsLayout = new QGridLayout;
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
257 int row = 0;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
258
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
259 for (const LDExtProgInfo& info : g_LDExtProgInfo)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
260 { 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
261 *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
262 QLineEdit* input = new QLineEdit;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
263 QPushButton* setPathButton = new QPushButton;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
264
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
265 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
266 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
267 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
268 info.input = input;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
269 info.setPathButton = setPathButton;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
270
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
271 connect (setPathButton, SIGNAL (clicked()), this, SLOT (slot_setExtProgPath()));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
272
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
273 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
274 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
275 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
276 pathsLayout->addWidget (setPathButton, row, 3);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
277
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
278 #ifndef _WIN32
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
279 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
280 wineBox->setChecked (*info.wine);
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
281 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
282 pathsLayout->addWidget (wineBox, row, 4);
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
283 #endif
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
284
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
285 ++row;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
286 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
287
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
288 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
289 }
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
290
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
291 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
292 // 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
293 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
294 void ConfigDialog::applySettings()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
295 { // Apply configuration
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 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
297 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
298 gl_blackedges = ui->blackEdges->isChecked();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
299 gl_maincolor_alpha = ( (double) ui->mainColorAlpha->value()) / 10.0f;
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
300 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
301 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
302 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
303 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
304 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
305 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
306 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
307 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
308 ld_defaultlicense = ui->m_profileLicense->currentIndex();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
309
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
310 // 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
311 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
312 gui_colortoolbar = quickColorString();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
313
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
314 // 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
315 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
316 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
317 g_GridInfo[i].confs[j]->value = dsb_gridData[i][j]->value();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
318
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
319 // 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
320 #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
321 #include "actions.h"
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
322
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
323 // Ext program settings
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
324 for (const LDExtProgInfo& info : g_LDExtProgInfo)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
325 { *info.path = info.input->text();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
326
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
327 #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
328 *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
329 #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
330 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
331
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 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
333 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
334 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
335 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
336 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
337 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
338 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
339 }
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
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 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
342 // 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
343 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
344 void ConfigDialog::buttonClicked (QAbstractButton* button)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
345 { typedef QDialogButtonBox QDDB;
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
346 QDialogButtonBox* dbb = ui->buttonBox;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
347
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
348 if (button == dbb->button (QDDB::Ok))
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
349 { applySettings();
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
350 accept();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
351 } elif (button == dbb->button (QDDB::Apply))
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
352 { applySettings();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
353 } elif (button == dbb->button (QDDB::Cancel))
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
354 { reject();
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
355 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
356 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
358 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
359 // 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
360 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
361 void ConfigDialog::updateQuickColorList (LDQuickColor* sel)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
362 { 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
363 delete item;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
364
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
365 quickColorItems.clear();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
366
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
367 // Init table items
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
368 for (LDQuickColor& entry : quickColors)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
369 { QListWidgetItem* item = new QListWidgetItem;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
370
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
371 if (entry.isSeparator())
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
372 { item->setText ("--------");
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
373 item->setIcon (getIcon ("empty"));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
374 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
375 else
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
376 { LDColor* col = entry.color();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
377
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
378 if (col == null)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
379 { item->setText ("[[unknown color]]");
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
380 item->setIcon (getIcon ("error"));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
381 }
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
382 else
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
383 { item->setText (col->name);
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
384 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
385 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
386 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
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 ui->quickColorList->addItem (item);
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
389 quickColorItems << item;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
390
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
391 if (sel && &entry == sel)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
392 { ui->quickColorList->setCurrentItem (item);
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
393 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
394 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
395 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
396 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
397
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
398 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
399 // 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
400 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
401 void ConfigDialog::slot_setColor()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
402 { LDQuickColor* entry = null;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
403 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
404 const bool isNew = static_cast<QPushButton*> (sender()) == ui->quickColor_add;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
405
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
406 if (isNew == false)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
407 { item = getSelectedQuickColor();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
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 (!item)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410 return;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
411
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
412 int i = getItemRow (item, quickColorItems);
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
413 entry = &quickColors[i];
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
414
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
415 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
416 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
417 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
418
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
419 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
420 short val;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
421
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
422 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
423 return;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
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 if (entry)
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
426 entry->setColor (getColor (val));
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
427 else
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
428 { LDQuickColor entry (getColor (val), null);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
429
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
430 item = getSelectedQuickColor();
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
431 int idx = (item) ? getItemRow (item, quickColorItems) + 1 : quickColorItems.size();
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
432
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
433 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
434 entry = quickColors[idx];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
435 }
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
436
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
437 updateQuickColorList (entry);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
438 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
439
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
440 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
441 // 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
442 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
443 void ConfigDialog::slot_delColor()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
444 { 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
445 return;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
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 QListWidgetItem* item = ui->quickColorList->selectedItems() [0];
503
bebe09014dd6 removed the List class in favor of QList
Santeri Piippo <crimsondusk64@gmail.com>
parents: 498
diff changeset
448 quickColors.removeAt (getItemRow (item, quickColorItems));
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
449 updateQuickColorList();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
450 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
451
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
452 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
453 // 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
454 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
455 void ConfigDialog::slot_moveColor()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
456 { const bool up = (static_cast<QPushButton*> (sender()) == ui->quickColor_moveUp);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
457
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
458 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
459 return;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
460
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
461 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
462 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
463 int dest = up ? (idx - 1) : (idx + 1);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
464
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
465 if (dest < 0 || dest >= quickColorItems.size())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
466 return; // destination out of bounds
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
467
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
468 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
469 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
470 quickColors[idx] = tmp;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
471
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[dest]);
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 // 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
477 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
478 void ConfigDialog::slot_addColorSeparator()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
479 { 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
480 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
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 // 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
485 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
486 void ConfigDialog::slot_clearColors()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
487 { quickColors.clear();
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
488 updateQuickColorList();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
489 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
490
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
491 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
492 // 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
493 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
494 void ConfigDialog::pickColor (StringConfig& conf, QPushButton* button)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
495 { QColor col = QColorDialog::getColor (QColor (conf));
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
496
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
497 if (col.isValid())
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
498 { uchar r = col.red(),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
499 g = col.green(),
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
500 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
501 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
502 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
503 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
504 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
505
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
506 // =============================================================================
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
507 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
508 void ConfigDialog::slot_setGLBackground()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
509 { 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
510 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
511
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 // =============================================================================
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
513 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
514 void ConfigDialog::slot_setGLForeground()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
515 { 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
516 }
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 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
519 // 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
520 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
521 void ConfigDialog::setButtonBackground (QPushButton* button, str value)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
522 { button->setIcon (getIcon ("colorselect"));
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
523 button->setAutoFillBackground (true);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
524 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
525 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
526
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
527 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
528 // 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
529 // -----------------------------------------------------------------------------
504
6a1fa662bfc1 Removed the List -> QList alias, use QList directly
Santeri Piippo <crimsondusk64@gmail.com>
parents: 503
diff changeset
530 int ConfigDialog::getItemRow (QListWidgetItem* item, QList<QListWidgetItem*>& haystack)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
531 { int i = 0;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
532
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
533 for (QListWidgetItem* it : haystack)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
534 { if (it == item)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
535 return i;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
536
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
537 ++i;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
538 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
539
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
540 return -1;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
541 }
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 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
544 // 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
545 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
546 QListWidgetItem* ConfigDialog::getSelectedQuickColor()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
547 { 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
548 return null;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
549
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
550 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
551 }
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 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
554 // 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
555 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
556 QList<ShortcutListItem*> ConfigDialog::getShortcutSelection()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
557 { QList<ShortcutListItem*> out;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
558
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
559 for (QListWidgetItem* entry : ui->shortcutsList->selectedItems())
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 417
diff changeset
560 out << static_cast<ShortcutListItem*> (entry);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
561
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
562 return out;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
563 }
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 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
566 // 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
567 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
568 void ConfigDialog::slot_setShortcut()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
569 { QList<ShortcutListItem*> sel = getShortcutSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
570
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
571 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
572 return;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
573
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
574 ShortcutListItem* item = sel[0];
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
575
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
576 if (KeySequenceDialog::staticDialog (item->keyConfig(), this))
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
577 setShortcutText (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
578 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
579
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
580 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
581 // 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
582 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
583 void ConfigDialog::slot_resetShortcut()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
584 { QList<ShortcutListItem*> sel = getShortcutSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
585
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
586 for (ShortcutListItem* item : sel)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
587 { item->keyConfig()->reset();
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
588 setShortcutText (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
589 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
590 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
591
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
592 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
593 // 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
594 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
595 void ConfigDialog::slot_clearShortcut()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
596 { QList<ShortcutListItem*> sel = getShortcutSelection();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
597
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
598 for (ShortcutListItem* item : sel)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
599 { item->keyConfig()->value = QKeySequence();
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
600 setShortcutText (item);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
601 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
602 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
603
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
604 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
605 // 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
606 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
607 void ConfigDialog::slot_setExtProgPath()
498
791c831c8020 further cleansing - removed most uses of unsigned ints, removed list reversers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 493
diff changeset
608 { const LDExtProgInfo* info = null;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
609
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
610 for (const LDExtProgInfo& it : g_LDExtProgInfo)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
611 { if (it.setPathButton == sender())
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
612 { info = &it;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
613 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
614 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
615 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
616
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
617 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
618 str fpath = QFileDialog::getOpenFileName (this, fmt ("Path to %1", info->name), *info->path, g_extProgPathFilter);
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
619
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
620 if (fpath.isEmpty())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
621 return;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
622
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
623 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
624 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
625
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
626 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
627 // '...' 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
628 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
629 void ConfigDialog::slot_findDownloadFolder()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
630 { str dpath = QFileDialog::getExistingDirectory();
430
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
631 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
632 }
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
633
8458cf2719d1 added config option, refined logic and regexps. This behaves coherently now. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
634 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
635 // 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
636 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
637 void ConfigDialog::setShortcutText (ShortcutListItem* item)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
638 { QAction* act = item->action();
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
639 str label = act->iconText();
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
640 str keybind = item->keyConfig()->value.toString();
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
641 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
642 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
643
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
644 // =============================================================================
471
Santeri Piippo <crimsondusk64@gmail.com>
parents: 469
diff changeset
645 // 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
646 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
647 str ConfigDialog::quickColorString()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
648 { str val;
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
649
517
2b5adb45aaa5 Made the config dialog use a list widget for navigation over a tab widget.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 504
diff changeset
650 for (const LDQuickColor& entry : quickColors)
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
651 { 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
652 val += ':';
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
653
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
654 if (entry.isSeparator())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
655 val += '|';
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
656 else
480
ee5a4c5d4461 rework quick color code a tad
Santeri Piippo <crimsondusk64@gmail.com>
parents: 475
diff changeset
657 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
658 }
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
659
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
660 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
661 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
662
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
663 // =========================================================================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
664 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
665 // =========================================================================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
666 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
667 // =========================================================================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
668 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
669 // =========================================================================================================================
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
670 KeySequenceDialog::KeySequenceDialog (QKeySequence seq, QWidget* parent, Qt::WindowFlags f) :
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
671 QDialog (parent, f), seq (seq)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
672 { lb_output = new QLabel;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
673 IMPLEMENT_DIALOG_BUTTONS
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
674
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
675 setWhatsThis ("Into this dialog you can input a key sequence for use as a "
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
676 "shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to "
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
677 "dismiss.");
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
678
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
679 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
680 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
681 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
682 setLayout (layout);
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
683
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
684 updateOutput();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
685 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
686
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
687 // =============================================================================
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
688 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
689 bool KeySequenceDialog::staticDialog (KeySequenceConfig* cfg, QWidget* parent)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
690 { KeySequenceDialog dlg (cfg->value, parent);
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
691
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
692 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
693 return false;
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
694
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 373
diff changeset
695 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
696 return true;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
697 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
698
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
699 // =============================================================================
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
700 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
701 void KeySequenceDialog::updateOutput()
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
702 { str shortcut = seq.toString();
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
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 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
705 shortcut = "&lt;empty&gt;";
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
706
395
5210bcb1d7e0 Further restructure, removed GUI toolbar icon size slider (always 22x22 now)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 386
diff changeset
707 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
708 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
709 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
710
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
711 // =============================================================================
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
712 // -----------------------------------------------------------------------------
493
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
713 void KeySequenceDialog::keyPressEvent (QKeyEvent* ev)
16766ac1bbd9 last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents: 491
diff changeset
714 { seq = ev->key() + ev->modifiers();
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
715 updateOutput();
491
7d1b5ecd76c0 it's LDForge's 1st birthday!
Santeri Piippo <crimsondusk64@gmail.com>
parents: 482
diff changeset
716 }

mercurial