-
Notifications
You must be signed in to change notification settings - Fork 39
/
customcolors.cpp
32 lines (28 loc) · 990 Bytes
/
customcolors.cpp
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
#include "customcolors.h"
CustomColors::CustomColors() {
m_buttonsMap.clear();
m_buttonsMap.insert("CH1", &ch1);
m_buttonsMap.insert("CH1 REF", &ch1ref);
m_buttonsMap.insert("CH1 FFT", &ch1fft);
m_buttonsMap.insert("CH2", &ch2);
m_buttonsMap.insert("CH2 REF", &ch2ref);
m_buttonsMap.insert("CH2 FFT", &ch2fft);
m_buttonsMap.insert("GRID", &grid);
m_buttonsMap.insert("AXES", &axes);
for(int i = 0; i < 8; i++) {
m_buttonsMap.insert("BIT " + QString::number(i), &bit[i]);
m_buttonsMap.insert("BIT " + QString::number(i) + " REF", &bit[i]);
}
m_buttonsMap.insert("LABELS", &label);
}
QColor CustomColors::colorAt(QString from) {
if(from == "BACKGROUND")
return background.color();
return *m_buttonsMap.value(from);
}
void CustomColors::setColor(QString from, QColor new_color) {
if(from == "BACKGROUND")
background.setColor(new_color);
else
*(m_buttonsMap.value(from)) = new_color;
}