src/configDialog.cpp

Mon, 08 Jul 2013 01:36:12 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Mon, 08 Jul 2013 01:36:12 +0300
changeset 364
7c3af0a6f8ab
parent 343
75487752f3e6
child 373
91bea18bd77a
permissions
-rw-r--r--

Renamed the color class to LDColor for clarity

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
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
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.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
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.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
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/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
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
19 #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
20 #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
21 #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
22 #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
23 #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
24 #include <QGroupBox>
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
25 #include <QDoubleSpinBox>
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
26 #include <QLineEdit>
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
27 #include <QCheckBox>
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
28
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include "common.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include "configDialog.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #include "file.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 #include "config.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include "misc.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "colors.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 #include "colorSelectDialog.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
36 #include "gldraw.h"
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
37 #include "ui_config.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 extern_cfg (str, gl_bgcolor);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 extern_cfg (str, gl_maincolor);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41 extern_cfg (bool, lv_colorize);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 extern_cfg (bool, gl_colorbfc);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
43 extern_cfg (float, gl_maincolor_alpha);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 extern_cfg (int, gl_linethickness);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 extern_cfg (int, gui_toolbar_iconsize);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 extern_cfg (str, gui_colortoolbar);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 extern_cfg (bool, edit_schemanticinline);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 extern_cfg (bool, gl_blackedges);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 #define INIT_CHECKBOX(BOX, CFG) \
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 BOX->setCheckState (CFG ? Qt::Checked : Qt::Unchecked);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 #define APPLY_CHECKBOX(BTN, CFG) \
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 CFG = BTN->checkState() == Qt::Checked;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 ConfigDialog::ConfigDialog (ForgeWindow* parent) : QDialog (parent) {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
60 ui = new Ui_ConfigUI;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
61 ui->setupUi( this );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
62
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63 initMainTab ();
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
64 initShortcutsTab ();
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
65 initQuickColorTab ();
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 initGridTab ();
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 initExtProgTab ();
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
68 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
69
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
70 // =============================================================================
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
72 // =============================================================================
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
73 ConfigDialog::~ConfigDialog()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
74 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
75 delete ui;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
76 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
77
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
78 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 void ConfigDialog::initMainTab () {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
82 // Init color stuff
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
83 setButtonBackground (ui->backgroundColorButton, gl_bgcolor);
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
84 connect (ui->backgroundColorButton, SIGNAL (clicked ()),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
85 this, SLOT (slot_setGLBackground ()));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
87 setButtonBackground (ui->mainColorButton, gl_maincolor.value);
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
88 connect (ui->mainColorButton, SIGNAL (clicked ()),
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 this, SLOT (slot_setGLForeground ()));
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
91 ui->mainColorAlpha->setValue( gl_maincolor_alpha * 10.0f );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
93 // Sliders
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
94 ui->lineThickness->setValue( gl_linethickness );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
95 ui->iconSize->setValue(( gui_toolbar_iconsize - 12 ) / 4 );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
97 // Checkboxes
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
98 ui->colorizeObjects->setChecked( lv_colorize );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
99 ui->colorBFC->setChecked( gl_colorbfc );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
100 ui->blackEdges->setChecked (gl_blackedges);
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
101 ui->scemanticInlining->setChecked (edit_schemanticinline);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 void ConfigDialog::initShortcutsTab () {
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108 ulong i = 0;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
109 for( actionmeta& info : g_actionMeta ) {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
110 if( info.qAct == null )
237
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 233
diff changeset
111 break;
ec77f6e9a19f Added fatal error message box for the.. fatal stuff. Windows isn't really good at conveying error messages, converted actions into a C-style array because I've had a ton of problems with the vector approach (it gets zeroed when it shouldn't be..)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 233
diff changeset
112
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 QAction* const act = *info.qAct;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 ShortcutListItem* item = new ShortcutListItem;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
116 setShortcutText( item, info );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
117 item->setIcon( act->icon() );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
118 item->setActionInfo( &info );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 // If the action doesn't have a valid icon, use an empty one
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 // so that the list is kept aligned.
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
122 if( act->icon().isNull() )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
123 item->setIcon( getIcon( "empty" ));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
125 ui->shortcutsList->insertItem( i++, item );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
128 ui->shortcutsList->setSortingEnabled( true );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
129 ui->shortcutsList->sortItems();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
130
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
131 connect( ui->shortcut_set, SIGNAL( clicked() ), this, SLOT( slot_setShortcut() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
132 connect( ui->shortcut_reset, SIGNAL( clicked() ), this, SLOT( slot_resetShortcut() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
133 connect( ui->shortcut_clear, SIGNAL( clicked() ), this, SLOT( slot_clearShortcut() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
134 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
135
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
136 // =============================================================================
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
137 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
138 // =============================================================================
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
139 void ConfigDialog::initQuickColorTab()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
140 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
141 quickColorMeta = parseQuickColorMeta();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
142 updateQuickColorList();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
143
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
144 connect( ui->quickColor_add, SIGNAL( clicked() ), this, SLOT( slot_setColor() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
145 connect( ui->quickColor_remove, SIGNAL( clicked() ), this, SLOT( slot_delColor() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
146 connect( ui->quickColor_edit, SIGNAL( clicked() ), this, SLOT( slot_setColor() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
147 connect( ui->quickColor_addSep, SIGNAL( clicked() ), this, SLOT( slot_addColorSeparator() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
148 connect( ui->quickColor_moveUp, SIGNAL( clicked() ), this, SLOT( slot_moveColor() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
149 connect( ui->quickColor_moveDown, SIGNAL( clicked() ), this, SLOT( slot_moveColor() ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
150 connect( ui->quickColor_clear, SIGNAL( clicked() ), this, SLOT( slot_clearColors() ));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
151 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
154 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
155 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
156 void ConfigDialog::initGridTab()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
157 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
158 QGridLayout* gridlayout = new QGridLayout;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
159
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
160 QLabel* xlabel = new QLabel( "X" ),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
161 *ylabel = new QLabel( "Y" ),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
162 *zlabel = new QLabel( "Z" ),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
163 *anglabel = new QLabel( "Angle" );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
164
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
165 short i = 1;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
166
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
167 for( QLabel* label : initlist<QLabel*> ({ xlabel, ylabel, zlabel, anglabel }))
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
168 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
169 label->setAlignment( Qt::AlignCenter );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
170 gridlayout->addWidget( label, 0, i++ );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
171 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
173 for( int i = 0; i < g_NumGrids; ++i )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
174 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
175 // Icon
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
176 lb_gridIcons[i] = new QLabel;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
177 lb_gridIcons[i]->setPixmap( getIcon( fmt( "grid-%1", str( g_GridInfo[i].name ).toLower() )));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
178
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
179 // Text label
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
180 lb_gridLabels[i] = new QLabel( fmt( "%1:", g_GridInfo[i].name ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
181
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
182 QHBoxLayout* labellayout = new QHBoxLayout;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
183 labellayout->addWidget( lb_gridIcons[i] );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
184 labellayout->addWidget( lb_gridLabels[i] );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
185 gridlayout->addLayout( labellayout, i + 1, 0 );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
186
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
187 // Add the widgets
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
188 for( int j = 0; j < 4; ++j )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
189 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
190 dsb_gridData[i][j] = new QDoubleSpinBox;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
191 dsb_gridData[i][j]->setValue( g_GridInfo[i].confs[j]->value );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
192 gridlayout->addWidget( dsb_gridData[i][j], i + 1, j + 1 );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
193 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
194 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
196 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
197 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
201 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
202 extern_cfg( str, prog_ytruder );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
203 extern_cfg( str, prog_rectifier );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
204 extern_cfg( str, prog_intersector );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
205 extern_cfg( str, prog_coverer );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
206 extern_cfg( str, prog_isecalc );
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
207 extern_cfg( str, prog_edger2 );
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
208 extern_cfg( bool, prog_ytruder_wine );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
209 extern_cfg( bool, prog_rectifier_wine );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
210 extern_cfg( bool, prog_intersector_wine );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
211 extern_cfg( bool, prog_coverer_wine );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
212 extern_cfg( bool, prog_isecalc_wine );
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
213 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
214
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
215 static const struct extProgInfo
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
216 {
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
217 const str name, iconname;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
218 strconfig* const path;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
219 mutable QLineEdit* input;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
220 mutable QPushButton* setPathButton;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
221 #ifndef _WIN32
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
222 boolconfig* const wine;
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
223 mutable QCheckBox* wineBox;
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
224 #endif // _WIN32
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
225 } g_extProgInfo[] = {
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
226 #ifndef _WIN32
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
227 # 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
228 #else
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
229 # 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
230 #endif
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
231 EXTPROG( Ytruder, ytruder )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
232 EXTPROG( Rectifier, rectifier )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
233 EXTPROG( Intersector, intersector )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
234 EXTPROG( Isecalc, isecalc )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
235 EXTPROG( Coverer, coverer )
343
75487752f3e6 Completed Edger 2 interface
Santeri Piippo <crimsondusk64@gmail.com>
parents: 328
diff changeset
236 EXTPROG( Edger2, edger2 )
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
237 #undef EXTPROG
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
238 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
239
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
240 void ConfigDialog::initExtProgTab()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
241 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
242 QGridLayout* pathsLayout = new QGridLayout;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
243 ulong row = 0;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
244
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
245 for( const extProgInfo & info : g_extProgInfo )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
246 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
247 QLabel* icon = new QLabel,
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
248 *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
249 QLineEdit* input = new QLineEdit;
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
250 QPushButton* setPathButton = new QPushButton;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
252 icon->setPixmap( getIcon( info.iconname ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
253 input->setText( info.path->value );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
254 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
255 info.input = input;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
256 info.setPathButton = setPathButton;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
257
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
258 connect( setPathButton, SIGNAL( clicked() ), this, SLOT( slot_setExtProgPath() ));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
259
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
260 pathsLayout->addWidget( icon, row, 0 );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
261 pathsLayout->addWidget( progLabel, row, 1 );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
262 pathsLayout->addWidget( input, row, 2 );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
263 pathsLayout->addWidget( setPathButton, row, 3 );
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
264
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
265 #ifndef _WIN32
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
266 QCheckBox* wineBox = new QCheckBox( "Wine" );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
267 wineBox->setChecked( *info.wine );
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
268 info.wineBox = wineBox;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
269 pathsLayout->addWidget( wineBox, row, 4 );
300
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
270 #endif
0c7e00cc3d44 Added support for launching external programs with Wine
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
271
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
272 ++row;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
273 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
274
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
275 ui->extProgs->setLayout( pathsLayout );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
276 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
277
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
278 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
279 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
280 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
281 void ConfigDialog::updateQuickColorList( quickColor* sel )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
282 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
283 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
284 delete item;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
285
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
286 quickColorItems.clear();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
287
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
288 // Init table items
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
289 for( quickColor& entry : quickColorMeta )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
290 {
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
291 QListWidgetItem* item = new QListWidgetItem;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
292
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
293 if( entry.isSeparator )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
294 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
295 item->setText( "--------" );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
296 item->setIcon( getIcon( "empty" ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
297 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
298 else
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
299 {
364
7c3af0a6f8ab Renamed the color class to LDColor for clarity
Santeri Piippo <crimsondusk64@gmail.com>
parents: 343
diff changeset
300 LDColor* col = entry.col;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
301
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
302 if( col == null )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
303 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
304 item->setText( "[[unknown color]]" );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
305 item->setIcon( getIcon( "error" ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
306 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
307 else
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
308 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
309 item->setText( col->name );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
310 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
311 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
314 ui->quickColorList->addItem( item );
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
315 quickColorItems << item;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
316
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
317 if( sel && &entry == sel )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
318 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
319 ui->quickColorList->setCurrentItem( item );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
320 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
321 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
322 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
323 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
324
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
325 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
326 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
327 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
328 void ConfigDialog::slot_setColor()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
329 {
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
330 quickColor* entry = null;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
331 QListWidgetItem* item = null;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
332 const bool isNew = static_cast<QPushButton*>( sender() ) == ui->quickColor_add;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
333
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
334 if( isNew == false )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
335 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
336 item = getSelectedQuickColor();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
337
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
338 if( !item )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
339 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
340
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
341 ulong i = getItemRow( item, quickColorItems );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
342 entry = &quickColorMeta[i];
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
343
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
344 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
345 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
346 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
347
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
348 short defval = entry ? entry->col->index : -1;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
349 short val;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
350
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
351 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
352 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
354 if( entry )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
355 entry->col = getColor( val );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
356 else
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
357 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
358 quickColor entry = {getColor( val ), null, false};
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
360 item = getSelectedQuickColor();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
361 ulong idx;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
362
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
363 if( item )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
364 idx = getItemRow( item, quickColorItems ) + 1;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365 else
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
366 idx = quickColorItems.size();
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
367
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
368 quickColorMeta.insert( idx, entry );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
369 entry = quickColorMeta[idx];
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
370 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
372 updateQuickColorList( entry );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
373 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
374
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
375 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
376 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
377 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
378 void ConfigDialog::slot_delColor()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
379 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
380 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
381 return;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
382
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
383 QListWidgetItem* item = ui->quickColorList->selectedItems()[0];
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
384 quickColorMeta.erase( getItemRow( item, quickColorItems ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
385 updateQuickColorList();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
386 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
387
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
388 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
389 void ConfigDialog::slot_moveColor()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
390 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
391 const bool up = ( static_cast<QPushButton*>( sender() ) == ui->quickColor_moveUp );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
392
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
393 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
394 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
395
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
396 QListWidgetItem* item = ui->quickColorList->selectedItems()[0];
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
397 int idx = getItemRow( item, quickColorItems );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
398 int dest = up ? ( idx - 1 ) : ( idx + 1 );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
399
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
400 if( dest < 0 || ( ulong ) dest >= quickColorItems.size() )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
401 return; // destination out of bounds
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
402
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
403 quickColor tmp = quickColorMeta[dest];
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
404 quickColorMeta[dest] = quickColorMeta[idx];
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
405 quickColorMeta[idx] = tmp;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
406
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
407 updateQuickColorList( &quickColorMeta[dest] );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
408 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
409
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
411 void ConfigDialog::slot_addColorSeparator()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
412 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
413 quickColorMeta << quickColor({ null, null, true });
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
414 updateQuickColorList( &quickColorMeta[quickColorMeta.size() - 1] );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
415 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
417 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
418 void ConfigDialog::slot_clearColors()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
419 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
420 quickColorMeta.clear();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
421 updateQuickColorList();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
422 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
423
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
424 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
425 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
426 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
427 void ConfigDialog::pickColor( strconfig& conf, QPushButton* button )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
428 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
429 QColor col = QColorDialog::getColor( QColor( conf ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
430
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
431 if( col.isValid() )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
432 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
433 uchar r = col.red(),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
434 g = col.green(),
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
435 b = col.blue();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
436 conf.value.sprintf( "#%.2X%.2X%.2X", r, g, b );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
437 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
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
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
441 void ConfigDialog::slot_setGLBackground()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
442 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
443 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
444 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
445
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
446 void ConfigDialog::slot_setGLForeground()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
447 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
448 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
449 }
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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
453 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
454 void ConfigDialog::setButtonBackground( QPushButton* button, str value )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
455 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
456 button->setIcon( getIcon( "colorselect" ));
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
457 button->setAutoFillBackground( true );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
458 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
459 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
460
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
461 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
462 int ConfigDialog::getItemRow( QListWidgetItem* item, vector<QListWidgetItem*>& haystack )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
463 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
464 int i = 0;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
465
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
466 for( QListWidgetItem * it : haystack )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
467 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
468 if( it == item )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
469 return i;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
470
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
471 ++i;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
472 }
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 return -1;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
475 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
476
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
477 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
478 QListWidgetItem* ConfigDialog::getSelectedQuickColor()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
479 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
480 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
481 return null;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
482
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
483 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
484 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
485
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
486 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
487 QList<ShortcutListItem*> ConfigDialog::getShortcutSelection()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
488 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
489 QList<ShortcutListItem*> out;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
490
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
491 for( QListWidgetItem * entry : ui->shortcutsList->selectedItems() )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
492 out << static_cast<ShortcutListItem*>( entry );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
493
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
494 return out;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
495 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
496
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
497 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
498 void ConfigDialog::slot_setShortcut()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
499 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
500 QList<ShortcutListItem*> sel = getShortcutSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
501
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
502 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
503 return;
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 ShortcutListItem* item = sel[0];
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
506
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
507 if( KeySequenceDialog::staticDialog( *( item->getActionInfo() ), this ))
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
508 setShortcutText( item, *( item->getActionInfo() ));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
509 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
510
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
511 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
512 void ConfigDialog::slot_resetShortcut()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
513 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
514 QList<ShortcutListItem*> sel = getShortcutSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
515
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
516 for( ShortcutListItem * item : sel )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
517 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
518 actionmeta* info = item->getActionInfo();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
519 keyseqconfig* conf = info->conf;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
520
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
521 conf->reset();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
522 ( *info->qAct )->setShortcut( *conf );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
523
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
524 setShortcutText( item, *info );
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
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
528 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
529 void ConfigDialog::slot_clearShortcut()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
530 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
531 QList<ShortcutListItem*> sel = getShortcutSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
532 QKeySequence dummy;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
533
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
534 for( ShortcutListItem * item : sel )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
535 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
536 actionmeta* info = item->getActionInfo();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
537 keyseqconfig* conf = info->conf;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
538 conf->value = dummy;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
539
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
540 ( *info->qAct )->setShortcut( *conf );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
541 setShortcutText( item, *info );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
542 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
543 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
544
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
545 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
546 void ConfigDialog::slot_setExtProgPath()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
547 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
548 const extProgInfo* info = null;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
549
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
550 for( const extProgInfo & it : g_extProgInfo )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
551 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
552 if( it.setPathButton == sender() )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
553 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
554 info = &it;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
555 break;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
556 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
557 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
558
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
559 assert( info != null );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
560
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
561 str filter;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
562 #ifdef _WIN32
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
563 filter = "Applications (*.exe)(*.exe);;All files (*.*)(*.*)";
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
564 #endif // WIN32
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
565
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
566 str fpath = QFileDialog::getOpenFileName( this, fmt( "Path to %1", info->name ), *info->path, filter );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
567
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
568 if( fpath.length() == 0 )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
569 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
570
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
571 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
572 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
573
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
574 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
575 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
576 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
577 void ConfigDialog::setShortcutText( QListWidgetItem* item, actionmeta meta )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
578 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
579 QAction* const act = *meta.qAct;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
580 str label = act->iconText();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
581 str keybind = act->shortcut().toString();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
582
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
583 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
584 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
585
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
586 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
587 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
588 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
589 str ConfigDialog::makeColorToolBarString()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
590 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
591 str val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
592
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
593 for( quickColor entry : quickColorMeta )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
594 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
595 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
596 val += ':';
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
597
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
598 if( entry.isSeparator )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
599 val += '|';
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
600 else
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
601 val += fmt( "%1", entry.col->index );
183
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 return val;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
605 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
606
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
607 const Ui_ConfigUI* ConfigDialog::getUI() const
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
608 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
609 return ui;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
610 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
611
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
612 float ConfigDialog::getGridValue( int i, int j ) const
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
613 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
614 return dsb_gridData[i][j]->value();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
615 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
616
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
617 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
618 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
619 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
620 void ConfigDialog::staticDialog()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
621 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
622 ConfigDialog dlg( g_win );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
623
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
624 if( dlg.exec() )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
625 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
626 // Apply configuration
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
627 lv_colorize = dlg.getUI()->colorizeObjects->isChecked();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
628 gl_colorbfc = dlg.getUI()->colorBFC->isChecked();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
629 edit_schemanticinline = dlg.getUI()->scemanticInlining->isChecked();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
630 gl_blackedges = dlg.getUI()->blackEdges->isChecked();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
631 gl_maincolor_alpha = ( ( double )dlg.getUI()->mainColorAlpha->value() ) / 10.0f;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
632 gl_linethickness = dlg.getUI()->lineThickness->value();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
633 gui_toolbar_iconsize = ( dlg.getUI()->iconSize->value() * 4 ) + 12;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
634
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
635 // Manage the quick color toolbar
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
636 g_win->setQuickColorMeta( dlg.quickColorMeta );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
637 gui_colortoolbar = dlg.makeColorToolBarString();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
638
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
639 // Set the grid settings
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
640 for( int i = 0; i < g_NumGrids; ++i )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
641 for( int j = 0; j < 4; ++j )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
642 g_GridInfo[i].confs[j]->value = dlg.getGridValue( i, j );
183
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 // Ext program settings
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
645 for( const extProgInfo & info : g_extProgInfo )
303
8899806d382d Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents: 300
diff changeset
646 {
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
647 *info.path = info.input->text();
303
8899806d382d Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents: 300
diff changeset
648 *info.wine = info.wineBox->isChecked();
8899806d382d Converted Intersector UI, improved handling of failed ext program launches, fixed launch of non-wine programs
Santeri Piippo <crimsondusk64@gmail.com>
parents: 300
diff changeset
649 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
650
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
651 // Save the config
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
652 config::save();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
653
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
654 // Reload all subfiles as the ldraw path potentially changed.
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
655 reloadAllSubfiles();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
656
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
657 g_win->R()->setBackground();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
658 g_win->fullRefresh();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
659 g_win->updateToolBars();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
660 }
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 // =========================================================================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
670 KeySequenceDialog::KeySequenceDialog( QKeySequence seq, QWidget* parent, Qt::WindowFlags f ) :
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
671 QDialog( parent, f ), seq( seq )
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
672 {
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
673 lb_output = new QLabel;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
674 IMPLEMENT_DIALOG_BUTTONS
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
675
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
676 setWhatsThis( "Into this dialog you can input a key sequence for use as a "
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
677 "shortcut in LDForge. Use OK to confirm the new shortcut and Cancel to "
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
678 "dismiss." );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
679
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
680 QVBoxLayout* layout = new QVBoxLayout;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
681 layout->addWidget( lb_output );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
682 layout->addWidget( bbx_buttons );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
683 setLayout( layout );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
684
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
685 updateOutput();
183
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
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
688 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
689 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
690 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
691 bool KeySequenceDialog::staticDialog( actionmeta& meta, QWidget* parent )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
692 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
693 KeySequenceDialog dlg( *meta.conf, parent );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
694
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
695 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
696 return false;
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 *meta.conf = dlg.seq;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
699 ( *meta.qAct )->setShortcut( *meta.conf );
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
700 return true;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
701 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
702
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
703 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
704 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
705 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
706 void KeySequenceDialog::updateOutput()
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
707 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
708 str shortcut = seq.toString();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
709
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
710 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
711 shortcut = "&lt;empty&gt;";
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
712
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
713 str text = fmt( "<center><b>%1</b></center>", shortcut );
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
714
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
715 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
716 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
717
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
718 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
719 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
720 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
721 void KeySequenceDialog::keyPressEvent( QKeyEvent* ev )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
722 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
723 seq = ev->key() + ev->modifiers();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 327
diff changeset
724 updateOutput();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
725 }

mercurial