-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsettingsform.cpp
More file actions
115 lines (92 loc) · 2.37 KB
/
settingsform.cpp
File metadata and controls
115 lines (92 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "settingsform.h"
#include "ui_settingsform.h"
SettingsForm::SettingsForm(QWidget *parent) :
QWidget(parent),
ui(new Ui::SettingsForm)
{
ui->setupUi(this);
}
SettingsForm::~SettingsForm()
{
delete ui;
emit window_destroyed(true);
}
void SettingsForm::on_btnDone_pressed()
{
emit window_destroyed(true);
delete this;
}
void SettingsForm::on_slideR_sliderReleased()
{
values = getSliderValues(FORMAT::RGB);
int r = values[0];
int g = values[1];
int b = values[2];
emit returnValues(r, g, b, FORMAT::RGB);
}
void SettingsForm::on_slideG_sliderReleased()
{
values = getSliderValues(FORMAT::RGB);
int r = values[0];
int g = values[1];
int b = values[2];
emit returnValues(r, g, b, FORMAT::RGB);
}
void SettingsForm::on_slideB_sliderReleased()
{
values = getSliderValues(FORMAT::RGB);
int r = values[0];
int g = values[1];
int b = values[2];
emit returnValues(r, g, b, FORMAT::RGB);
}
void SettingsForm::on_slideHue_sliderReleased()
{
values = getSliderValues(FORMAT::HSL);
int h = values[0];
int s = values[1];
int l = values[2];
emit returnValues(h, s, l, FORMAT::HSL);
}
void SettingsForm::on_slideSaturation_sliderReleased()
{
values = getSliderValues(FORMAT::HSL);
int h = values[0];
int s = values[1];
int l = values[2];
emit returnValues(h, s, l, FORMAT::HSL);
}
void SettingsForm::on_sliderLightness_sliderReleased()
{
values = getSliderValues(FORMAT::HSL);
int h = values[0];
int s = values[1];
int l = values[2];
emit returnValues(h, s, l, FORMAT::HSL);
}
// Return integers in RGB HSL format
QList<int> SettingsForm::getSliderValues(FORMAT::option f)
{
QList<int> res;
switch(f)
{
case FORMAT::RGB:
res.insert(0, ui->slideR->value());
res.insert(1, ui->slideG->value());
res.insert(2, ui->slideB->value());
return res;
break;
case FORMAT::HSL:
res.insert(0, ui->slideHue->value());
res.insert(1, ui->slideSaturation->value());
res.insert(2, ui->sliderLightness->value());
return res;
break;
default:
res.insert(0, ui->slideR->value());
res.insert(1, ui->slideG->value());
res.insert(2, ui->slideB->value());
return res;
break;
}
}