src/dialogs/colorselector.h

Thu, 29 Mar 2018 12:09:06 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Thu, 29 Mar 2018 12:09:06 +0300
changeset 1362
9a5da3e469e2
parent 1174
91696a2e022c
child 1195
fead30e6c557
permissions
-rw-r--r--

Branch close

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1072
9ce9496427f2 Happy new year 2017!
Teemu Piippo <teemu@hecknology.net>
parents: 1014
diff changeset
3 * Copyright (C) 2013 - 2017 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #pragma once
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QDialog>
950
5df69eb50182 Move colorSelector.cc to dialogs/colorselector.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents: 948
diff changeset
21 #include "../main.h"
5df69eb50182 Move colorSelector.cc to dialogs/colorselector.cpp
Teemu Piippo <crimsondusk64@gmail.com>
parents: 948
diff changeset
22 #include "../colors.h"
1159
6ad8cdcd88d9 print() is no longer a global function but is tied to HierarchyElement.
Teemu Piippo <teemu@hecknology.net>
parents: 1114
diff changeset
23 #include "../hierarchyelement.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
25 /*
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
26 * Implements a dialog that asks the user to choose an LDraw color from a grid of available colors. Direct colors are also supported.
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
27 */
970
c8aae45afd85 Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 968
diff changeset
28 class ColorSelector : public QDialog, public HierarchyElement
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 Q_OBJECT
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
32 public:
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
33 ColorSelector(QWidget* parent, LDColor defaultvalue = LDColor::nullColor);
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
34 ~ColorSelector();
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
35
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
36 static bool selectColor(QWidget* parent, LDColor& color, LDColor defaultColor = LDColor::nullColor);
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
37 LDColor selectedColor() const;
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
38 Q_SLOT void setSelectedColor(LDColor color);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
40 private:
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
41 static const int columnCount = 16;
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
42
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
43 Q_SLOT void colorButtonClicked();
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
44 Q_SLOT void chooseDirectColor();
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
45 Q_SLOT void transparentCheckboxClicked();
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
46
948
3a91828475fd Replaced updaterevision with a python script, more renames, clang fixes
Teemu Piippo <crimsondusk64@gmail.com>
parents: 947
diff changeset
47 class Ui_ColorSelUi& ui;
1173
6cd85b28f43b Cleanup ColorSelector::colorButtonClicked()
Teemu Piippo <teemu@hecknology.net>
parents: 1159
diff changeset
48 QMap<LDColor, QPushButton*> m_buttons;
6cd85b28f43b Cleanup ColorSelector::colorButtonClicked()
Teemu Piippo <teemu@hecknology.net>
parents: 1159
diff changeset
49 QMap<QPushButton*, LDColor> m_buttonsReversed;
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
50 LDColor m_selectedColor;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 };

mercurial