src/configDialog.h

Sun, 07 Jul 2013 23:17:17 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 07 Jul 2013 23:17:17 +0300
changeset 360
77f08db90249
parent 328
b6a814a608c6
child 367
3745caa5d87d
permissions
-rw-r--r--

when inlining (as an action), reinterpret the inlinees so that there's not any pointer mess-ups

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
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
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
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #ifndef CONFIGDIALOG_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #define CONFIGDIALOG_H
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "gui.h"
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
23 #include <QDialog>
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
24
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
25 class Ui_ConfigUI;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
26 class QLabel;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
27 class QDoubleSpinBox;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
30 class ShortcutListItem : public QListWidgetItem
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
31 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 public:
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
33 explicit ShortcutListItem( QListWidget* view = null, int type = Type ) :
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
34 QListWidgetItem( view, type ) {}
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
36 actionmeta* getActionInfo() const
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
37 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
38 return m_info;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
39 }
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
40
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
41 void setActionInfo( actionmeta* info )
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
42 {
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
43 m_info = info;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
44 }
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 private:
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 actionmeta* m_info;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 };
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 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
51 class ConfigDialog : public QDialog
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
52 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 Q_OBJECT
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 public:
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
56 ConfigDialog( ForgeWindow* parent );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
57 virtual ~ConfigDialog();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
58 static void staticDialog();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
59 const Ui_ConfigUI* getUI() const;
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
60 float getGridValue( int i, int j ) const;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61
252
3f9067022d74 Take the aforementioned operator<< into use
Santeri Piippo <crimsondusk64@gmail.com>
parents: 251
diff changeset
62 vector<quickColor> quickColorMeta;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
63 QDoubleSpinBox* dsb_gridData[3][4];
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
64
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
65 private:
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
66 Ui_ConfigUI* ui;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 QLabel* lb_gridLabels[3];
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
68 QLabel* lb_gridIcons[3];
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
69 vector<QListWidgetItem*> quickColorItems;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
70
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
71 void initMainTab();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
72 void initShortcutsTab();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
73 void initQuickColorTab();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
74 void initGridTab();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
75 void initExtProgTab();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
76 void setButtonBackground( QPushButton* button, str value );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
77 void pickColor( strconfig& cfg, QPushButton* button );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
78 void updateQuickColorList( quickColor* sel = null );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
79 void setShortcutText( QListWidgetItem* qItem, actionmeta meta );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
80 int getItemRow( QListWidgetItem* item, vector<QListWidgetItem*>& haystack );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
81 str makeColorToolBarString();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
82 QListWidgetItem* getSelectedQuickColor();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
83 QList<ShortcutListItem*> getShortcutSelection();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
84
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
85 private slots:
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
86 void slot_setGLBackground();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
87 void slot_setGLForeground();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
88 void slot_setShortcut();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
89 void slot_resetShortcut();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
90 void slot_clearShortcut();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
91 void slot_setColor();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
92 void slot_delColor();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
93 void slot_addColorSeparator();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
94 void slot_moveColor();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
95 void slot_clearColors();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
96 void slot_setExtProgPath();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 };
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 // =============================================================================
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 // =============================================================================
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
102 class KeySequenceDialog : public QDialog
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
103 {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 Q_OBJECT
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
105
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 public:
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
107 explicit KeySequenceDialog( QKeySequence seq, QWidget* parent = null, Qt::WindowFlags f = 0 );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
108 static bool staticDialog( actionmeta& meta, QWidget* parent = null );
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
109
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 QLabel* lb_output;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111 QDialogButtonBox* bbx_buttons;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
112 QKeySequence seq;
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
113
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114 private:
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
115 void updateOutput();
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
116
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117 private slots:
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
118 virtual void keyPressEvent( QKeyEvent* ev );
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
328
b6a814a608c6 Converted the config dialog to a designer UI file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
121 #endif // CONFIGDIALOG_H

mercurial