/
csettingdlg.cpp
155 lines (123 loc) · 3.98 KB
/
csettingdlg.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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#include "csettingdlg.h"
#include "ui_csettingdlg.h"
/*
#include "qtpropertymanager.h"
#include "qtvariantproperty.h"
#include "qttreepropertybrowser.h"
*/
CSettingDlg::CSettingDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::CSettingDlg)
{
ui->setupUi(this);
m_bkGradient = new QPixmap(ui->label_10->width(), ui->label_10->height());
makeBkGrad();
ui->checkBox_3->setChecked(g_skSet.map.background.bStatic);
ui->checkBox_4->setChecked(!g_skSet.map.background.bStatic);
ui->frame_16->setStyleSheet("background : " + QColor(g_skSet.map.background.staticColor).name());
ui->frame->setValues(g_skSet.map.starRange, 10);
ui->spinBox->setValue(R2D(g_skSet.map.star.propNamesFromFov));
ui->spinBox_3->setValue(R2D(g_skSet.map.star.bayerFromFov));
ui->spinBox_4->setValue(R2D(g_skSet.map.star.flamsFromFov));
ui->checkBox->setChecked(g_skSet.map.star.bayerPriority);
setFrameStyle(ui->frame_12, FONT_STAR_PNAME);
////////////////////
}
CSettingDlg::~CSettingDlg()
{
delete m_bkGradient;
delete ui;
}
void CSettingDlg::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
//////////////////////////////
void CSettingDlg::makeBkGrad()
//////////////////////////////
{
QPainter p;
QLinearGradient g(QPoint(0, 0), QPoint(m_bkGradient->width() - 1, m_bkGradient->height()));
g.setColorAt(0, g_skSet.map.background.dynamicColor[0]);
g.setColorAt(0.5f, g_skSet.map.background.dynamicColor[1]);
g.setColorAt(1, g_skSet.map.background.dynamicColor[2]);
p.begin(m_bkGradient);
p.fillRect(m_bkGradient->rect(), g);
p.end();
ui->label_10->setPixmap(*m_bkGradient);
}
//////////////////////////////////////////////////////
void CSettingDlg::setFrameStyle(QFrame *frm, int font)
//////////////////////////////////////////////////////
{
frm->setStyleSheet("background : " + QColor(g_skSet.fonst[font].color).name());
}
// nigth color /////////////////////////////
void CSettingDlg::on_pushButton_21_clicked()
////////////////////////////////////////////
{
QColorDialog dlg(this);
dlg.setCurrentColor(g_skSet.map.background.dynamicColor[0]);
if (dlg.exec() == DL_OK)
{
g_skSet.map.background.dynamicColor[0] = dlg.selectedColor().toRgb().rgba();
makeBkGrad();
}
}
// twilight color /////////////////////////
void CSettingDlg::on_pushButton_23_clicked()
////////////////////////////////////////////
{
QColorDialog dlg(this);
dlg.setCurrentColor(g_skSet.map.background.dynamicColor[1]);
if (dlg.exec() == DL_OK)
{
g_skSet.map.background.dynamicColor[1] = dlg.selectedColor().toRgb().rgba();
makeBkGrad();
}
}
// day color ///////////////////////////////
void CSettingDlg::on_pushButton_22_clicked()
////////////////////////////////////////////
{
QColorDialog dlg(this);
dlg.setCurrentColor(g_skSet.map.background.dynamicColor[2]);
if (dlg.exec() == DL_OK)
{
g_skSet.map.background.dynamicColor[2] = dlg.selectedColor().toRgb().rgba();
makeBkGrad();
}
}
/////////////////////////////////////////////////////
void CSettingDlg::on_checkBox_3_toggled(bool checked)
/////////////////////////////////////////////////////
{
g_skSet.map.background.bStatic = checked;
ui->checkBox_4->setChecked(!g_skSet.map.background.bStatic);
}
/////////////////////////////////////////////////////
void CSettingDlg::on_checkBox_4_toggled(bool checked)
/////////////////////////////////////////////////////
{
g_skSet.map.background.bStatic = !checked;
ui->checkBox_3->setChecked(g_skSet.map.background.bStatic);
}
////////////////////////////////////////////
void CSettingDlg::on_pushButton_20_clicked()
////////////////////////////////////////////
{
QColorDialog dlg(this);
dlg.setCurrentColor(g_skSet.map.background.staticColor);
if (dlg.exec() == DL_OK)
{
g_skSet.map.background.staticColor = dlg.selectedColor().toRgb().rgba();
ui->frame_16->setStyleSheet("background : " + QColor(g_skSet.map.background.staticColor).name());
}
}