src/guiutilities.cpp

Tue, 15 Nov 2016 17:37:31 +0200

author
Teemu Piippo <teemu@hecknology.net>
date
Tue, 15 Nov 2016 17:37:31 +0200
changeset 1046
f4a7b56c7eb2
parent 1043
0091a761daf2
child 1072
9ce9496427f2
permissions
-rw-r--r--

Cleanup PartDownloader

974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
1014
f0a8ecb6a357 Happy new year 2016!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1012
diff changeset
3 * Copyright (C) 2013 - 2016 Teemu Piippo
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QComboBox>
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QPainter>
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "colors.h"
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "guiutilities.h"
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include "ldDocument.h"
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "mainwindow.h"
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 GuiUtilities::GuiUtilities (QObject* parent) :
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 QObject (parent),
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 HierarchyElement (parent) {}
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
30 /*
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
31 * makeColorIcon
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
32 *
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
33 * Creates an icon to represent an LDraw color.
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
34 */
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
35 QIcon GuiUtilities::makeColorIcon (LDColor ldColor, int size)
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
37 QImage image {size, size, QImage::Format_ARGB32};
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
38 QPainter painter {&image};
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
39 QColor color;
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
41 if (ldColor == MainColor)
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
43 // Use the user preferences for the main color.
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
44 color = m_config->mainColor();
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
45 color.setAlphaF(m_config->mainColorAlpha());
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 }
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
47 else
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
48 color = ldColor.faceColor();
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 // Paint the icon border
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
51 painter.fillRect(QRect {0, 0, size, size}, ldColor.edgeColor());
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53 // Paint the checkerboard background, visible with translucent icons
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
54 painter.drawPixmap(QRect {1, 1, size - 2, size - 2}, GetIcon("checkerboard"), QRect {0, 0, 8, 8});
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
56 // Paint the color above the checkerboard
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
57 painter.fillRect (QRect {1, 1, size - 2, size - 2}, color);
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
58 return QIcon {QPixmap::fromImage(image)};
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 }
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
61 /*
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
62 * fillUsedColorsToComboBox
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
63 *
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
64 * Fills the provided combo box with the colors used in the current document.
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
65 */
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66 void GuiUtilities::fillUsedColorsToComboBox (QComboBox* box)
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
68 QMap<LDColor, int> frequencies;
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
70 for (LDObject* object : currentDocument()->objects())
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
72 if (object->isColored() and object->color().isValid())
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
73 {
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
74 if (not frequencies.contains(object->color()))
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
75 frequencies[object->color()] = 1;
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
76 else
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
77 frequencies[object->color()] += 1;
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
78 }
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79 }
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
80
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
81 box->clear();
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
82 int row = 0;
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
83 QMapIterator<LDColor, int> iterator {frequencies};
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
84
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
85 while (iterator.hasNext())
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
86 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
87 iterator.next();
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
88 LDColor color = iterator.key();
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
89 int frequency = iterator.value();
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
90 QIcon icon = makeColorIcon(color, 16);
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
91 box->addItem(icon, format("[%1] %2 (%3 object%4)", color.index(), color.name(), frequency, plural(frequency)));
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
92 box->setItemData(row, color.index());
974
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 ++row;
b2fa5f89798a Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 }
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 978
diff changeset
95 }
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 978
diff changeset
96
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
97 /*
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
98 * mainColorRepresentation
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
99 *
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
100 * Returns the user-preferred appearance for the main color.
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
101 */
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 978
diff changeset
102 QColor GuiUtilities::mainColorRepresentation()
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 978
diff changeset
103 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
104 QColor result = {m_config->mainColor()};
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 978
diff changeset
105
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
106 if (result.isValid())
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
107 {
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
108 result.setAlpha(m_config->mainColorAlpha() * 255.f);
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
109 return result;
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
110 }
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
111 else
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
112 {
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
113 return QColor {0, 0, 0};
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
114 }
986
525921eae58c Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents: 978
diff changeset
115 }
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
116
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
117 /*
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
118 * loadQuickColorList
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
119 *
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
120 * Returns a list of contents for the color toolbar, based on configuration.
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
121 */
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
122 QVector<ColorToolbarItem> GuiUtilities::loadQuickColorList()
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
123 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
124 QVector<ColorToolbarItem> colors;
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
125
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
126 for (QString colorName : m_config->quickColorToolbar().split(":"))
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
127 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
128 if (colorName == "|")
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
129 {
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
130 colors << ColorToolbarItem::makeSeparator();
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
131 }
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
132 else
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
133 {
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
134 LDColor color = colorName.toInt();
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
135
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
136 if (color.isValid())
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
137 colors << ColorToolbarItem {color, nullptr};
1017
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
138 }
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
139 }
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
140
fc1c13db9618 Renamed ConfigurationValueBag to Configuration and added a pointer to it into HierarchyElement. This helps with the fight against global variables.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 1014
diff changeset
141 return colors;
1043
0091a761daf2 Refactor GuiUtilities
Teemu Piippo <teemu@hecknology.net>
parents: 1017
diff changeset
142 }

mercurial