src/dialogs/colorselector.h

Sun, 01 Apr 2018 11:39:07 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 01 Apr 2018 11:39:07 +0300
changeset 1367
0aab8d972cf6
parent 1326
69a90bd2dba2
permissions
-rw-r--r--

fixed some problems

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
1326
69a90bd2dba2 Happy new year 2018
Teemu Piippo <teemu@hecknology.net>
parents: 1296
diff changeset
3 * Copyright (C) 2013 - 2018 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"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
24 /*
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
25 * 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
26 */
1296
aee618d087ff Added vertex object editing dialog
Teemu Piippo <teemu@hecknology.net>
parents: 1174
diff changeset
27 class ColorSelector : public QDialog
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 Q_OBJECT
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
31 public:
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
32 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
33 ~ColorSelector();
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
34
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
35 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
36 LDColor selectedColor() const;
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
37 Q_SLOT void setSelectedColor(LDColor color);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
794
c254ddc6618b - source reformat
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
39 private:
1174
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
40 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
41
91696a2e022c Cleanup ColorSelector, moved direct color composition to a new LDColor constructor.
Teemu Piippo <teemu@hecknology.net>
parents: 1173
diff changeset
42 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
43 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
44 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
45
948
3a91828475fd Replaced updaterevision with a python script, more renames, clang fixes
Teemu Piippo <crimsondusk64@gmail.com>
parents: 947
diff changeset
46 class Ui_ColorSelUi& ui;
1173
6cd85b28f43b Cleanup ColorSelector::colorButtonClicked()
Teemu Piippo <teemu@hecknology.net>
parents: 1159
diff changeset
47 QMap<LDColor, QPushButton*> m_buttons;
6cd85b28f43b Cleanup ColorSelector::colorButtonClicked()
Teemu Piippo <teemu@hecknology.net>
parents: 1159
diff changeset
48 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
49 LDColor m_selectedColor;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 };

mercurial