History

More UI improvements

atlante45 committed 13 years ago

Commit 45e13fd1 parent 60bea898 files · +165 −69Browse files

Showing the changes to interface/src/Swatch.cpp (1 of 8 files). Show all

Unified · Split

interface/src/Swatch.cpp+50−40
@@ -4,18 +4,30 @@ · 3 unmodified lines
44 Swatch::Swatch(QAction* action) : Tool(action, 0, -1, -1),
55 _selected(1),
66 _margin(4),
7− _textRenderer(SANS_FONT_FAMILY, -1, 100) {
7+ _textRenderer(MONO_FONT_FAMILY, 10, 100) {
88 _width = 62;
99 _height = 30;
10+}
1011
11− _colors[0].setRgb(128, 128, 128);
12− _colors[1].setRgb(255, 0, 0);
13− _colors[2].setRgb(0, 255, 0);
14− _colors[3].setRgb(0, 0, 255);
15− _colors[4].setRgb(255, 0, 255);
16− _colors[5].setRgb(255, 255, 0);
17− _colors[6].setRgb(0, 255, 255);
18− _colors[7].setRgb(0, 0, 0);
12+void Swatch::reset() {
13+ _colors[0].setRgb(237, 175, 0);
14+ _colors[1].setRgb(161, 211, 72);
15+ _colors[2].setRgb(51, 204, 204);
16+ _colors[3].setRgb(63, 169, 245);
17+ _colors[4].setRgb(193, 99, 122);
18+ _colors[5].setRgb(255, 54, 69);
19+ _colors[6].setRgb(124, 36, 36);
20+ _colors[7].setRgb(63, 35, 19);
21+}
22+
23+QColor Swatch::getColor() {
24+ return _colors[_selected - 1];
25+}
26+
27+void Swatch::checkColor() {
28+ if (_action->data().value<QColor>() == _colors[_selected - 1]) {
29+ return;
30+ }
1931
2032 QPixmap map(16, 16);
2133 map.fill(_colors[_selected - 1]);
@@ -23,15 +35,11 @@ Swatch::Swatch(QAction* action) : Tool(action, 0, -1, -1), · 1 unmodified line
2335 _action->setIcon(map);
2436 }
2537
26−QColor Swatch::getColor() {
27− return _colors[_selected - 1];
28−}
29−
3038 void Swatch::saveData(QSettings* settings) {
3139 settings->beginGroup("Swatch");
3240
3341 for (int i(0); i < SWATCH_SIZE; ++i) {
34− QString name("R0");
42+ QString name("R1");
3543 name[1] = '1' + i;
3644 settings->setValue(name, _colors[i].red());
3745 name[0] = 'G';
@@ -45,33 +53,35 @@ void Swatch::saveData(QSettings* settings) { · 7 unmodified lines
4553
4654 void Swatch::loadData(QSettings* settings) {
4755 settings->beginGroup("Swatch");
48−
49− _colors[0].setRgb(settings->value("R1", 128).toInt(),
50− settings->value("G1", 128).toInt(),
51− settings->value("B1", 128).toInt());
52− _colors[1].setRgb(settings->value("R2", 128).toInt(),
53− settings->value("G2", 128).toInt(),
54− settings->value("B2", 128).toInt());
55− _colors[2].setRgb(settings->value("R3", 128).toInt(),
56− settings->value("G3", 128).toInt(),
57− settings->value("B3", 128).toInt());
58− _colors[3].setRgb(settings->value("R4", 128).toInt(),
59− settings->value("G4", 128).toInt(),
60− settings->value("B4", 128).toInt());
61− _colors[4].setRgb(settings->value("R5", 128).toInt(),
62− settings->value("G5", 128).toInt(),
63− settings->value("B5", 128).toInt());
64− _colors[5].setRgb(settings->value("R6", 128).toInt(),
65− settings->value("G6", 128).toInt(),
66− settings->value("B6", 128).toInt());
67− _colors[6].setRgb(settings->value("R7", 128).toInt(),
68− settings->value("G7", 128).toInt(),
69− settings->value("B7", 128).toInt());
70− _colors[7].setRgb(settings->value("R8", 128).toInt(),
71− settings->value("G8", 128).toInt(),
72− settings->value("B8", 128).toInt());
73−
56+
57+ _colors[0].setRgb(settings->value("R1", 237).toInt(),
58+ settings->value("G1", 175).toInt(),
59+ settings->value("B1", 0).toInt());
60+ _colors[1].setRgb(settings->value("R2", 161).toInt(),
61+ settings->value("G2", 211).toInt(),
62+ settings->value("B2", 72).toInt());
63+ _colors[2].setRgb(settings->value("R3", 51).toInt(),
64+ settings->value("G3", 204).toInt(),
65+ settings->value("B3", 204).toInt());
66+ _colors[3].setRgb(settings->value("R4", 63).toInt(),
67+ settings->value("G4", 169).toInt(),
68+ settings->value("B4", 245).toInt());
69+ _colors[4].setRgb(settings->value("R5", 193).toInt(),
70+ settings->value("G5", 99).toInt(),
71+ settings->value("B5", 122).toInt());
72+ _colors[5].setRgb(settings->value("R6", 255).toInt(),
73+ settings->value("G6", 54).toInt(),
74+ settings->value("B6", 69).toInt());
75+ _colors[6].setRgb(settings->value("R7", 124).toInt(),
76+ settings->value("G7", 36).toInt(),
77+ settings->value("B7", 36).toInt());
78+ _colors[7].setRgb(settings->value("R8", 63).toInt(),
79+ settings->value("G8", 35).toInt(),
80+ settings->value("B8", 19).toInt());
81+
7482 settings->endGroup();
83+
84+ checkColor();
7585 }
7686
7787 void Swatch::handleEvent(int key, bool getColor) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t