776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
1
2
3
|
#include "config.h"
#include "confighalfenergydlg.h"
#include "ui_confighalfenergydlg.h"
|
66e60ceb5
김태훈
모든 버튼에 음향 효과 추가
|
4
|
#include "soundplayer.h"
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
using namespace Define;
ConfigHalfEnergyDlg::ConfigHalfEnergyDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::ConfigHalfEnergyDlg)
{
Config* cfg = Config::getInstance();
config_item item;
item = cfg->getConfigValue(config_set_half_energy);
m_nCurSel = item.d32;
ui->setupUi(this);
this->setWindowFlags( Qt::FramelessWindowHint);
this->setAttribute( Qt::WA_DeleteOnClose);
|
754df0b51
고영탁
엔코더 작업 진행중
|
19
20
|
qApp->setActiveWindow(this);
this->setFocus();
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
21
|
|
66e60ceb5
김태훈
모든 버튼에 음향 효과 추가
|
22
23
|
foreach (QPushButton *button, findChildren<QPushButton *>())
connect(button, &QPushButton::pressed, SoundPlayer::playClick);
|
7ae6a4b1d
고영탁
시스템 설정 마무리 및 다국어 처리
|
24
25
|
ui->pushButton_1->setText(tr(set_unset_menu[0]));
ui->pushButton_2->setText(tr(set_unset_menu[1]));
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
26
27
28
29
30
31
32
33
34
35
36
|
reloadUi();
m_pSignalMapper = new QSignalMapper(this);
m_pSignalMapper->setMapping(ui->pushButton_1,0);
m_pSignalMapper->setMapping(ui->pushButton_2,1);
connect(ui->pushButton_1,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
connect(ui->pushButton_2,SIGNAL(clicked(bool)),m_pSignalMapper,SLOT(map()));
connect(m_pSignalMapper,SIGNAL(mapped(int)),this,SLOT(onConfigBtnClicked(int)));
|
754df0b51
고영탁
엔코더 작업 진행중
|
37
38
39
40
41
42
|
m_vectorTabOrder.append(this);
m_vectorTabOrder.append(ui->pushButton_1);
m_vectorTabOrder.append(ui->pushButton_2);
m_vectorTabOrder.append(ui->ctrBtnOk);
m_vectorTabOrder.append(ui->ctrBtnCancel);
|
776411ce5
고영탁
설정 기능 5월 개발 범위 UI...
|
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
|
}
ConfigHalfEnergyDlg::~ConfigHalfEnergyDlg()
{
delete ui;
}
void ConfigHalfEnergyDlg::on_ctrBtnOk_clicked()
{
Config* cfg = Config::getInstance();
config_item item;
item.d32 = m_nCurSel;
cfg->setConfigValue(config_set_half_energy,item);
accept();
}
void ConfigHalfEnergyDlg::onConfigBtnClicked(const int sel){
m_nCurSel = sel;
}
void ConfigHalfEnergyDlg::on_ctrBtnCancel_clicked()
{
reject();
}
void ConfigHalfEnergyDlg::reloadUi(){
switch(m_nCurSel){
case 0:
ui->pushButton_1->setChecked(true);
break;
case 1:
ui->pushButton_2->setChecked(true);
break;
default:
break;
}
}
|
754df0b51
고영탁
엔코더 작업 진행중
|
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
void ConfigHalfEnergyDlg::keyPressEvent(QKeyEvent *event){
int i = 0;
switch (event->key())
{
case 0x01000030: // Turn left
for(i = 0; i < m_vectorTabOrder.size();i++){
if(focusWidget() == m_vectorTabOrder[i]) break;
}
if(i==0){
i = m_vectorTabOrder.size()-1;
m_vectorTabOrder[i]->setFocus();
}
else if(i < m_vectorTabOrder.size()) {
i = i - 1;
m_vectorTabOrder[i]->setFocus();
}
else{
i=0;
m_vectorTabOrder[i]->setFocus();
}
break;
case 0x01000031: // Push
break;
case 0x01000032: // Turn right
for(i = 0; i < m_vectorTabOrder.size();i++){
if(focusWidget() == m_vectorTabOrder[i]) break;
}
if(i<m_vectorTabOrder.size()-1){
i+=1;
m_vectorTabOrder[i]->setFocus();
}
else if(i== (m_vectorTabOrder.size()-1)){
i=0;
m_vectorTabOrder[i]->setFocus();
}
else{
i=0;
m_vectorTabOrder[i]->setFocus();
}
break;
}
}
void ConfigHalfEnergyDlg::keyReleaseEvent(QKeyEvent *event){
int i = 0;
switch (event->key())
{
case 0x01000030: // Turn left
for(i = 0; i < m_vectorTabOrder.size();i++){
if(focusWidget() == m_vectorTabOrder[i]) break;
}
if(i==0){
i = m_vectorTabOrder.size()-1;
m_vectorTabOrder[i]->setFocus();
}
else if(i < m_vectorTabOrder.size()) {
i = i - 1;
m_vectorTabOrder[i]->setFocus();
}
else{
i=0;
m_vectorTabOrder[i]->setFocus();
}
break;
case 0x01000031: // Push
{
QPushButton *btn = qobject_cast<QPushButton*>(focusWidget());
if(btn != NULL){
btn->click();
}
break;
}
case 0x01000032: // Turn right
for(i = 0; i < m_vectorTabOrder.size();i++){
if(focusWidget() == m_vectorTabOrder[i]) break;
}
if(i<m_vectorTabOrder.size()-1){
i+=1;
m_vectorTabOrder[i]->setFocus();
}
else if(i== (m_vectorTabOrder.size()-1)){
i=0;
m_vectorTabOrder[i]->setFocus();
}
else{
i=0;
m_vectorTabOrder[i]->setFocus();
}
break;
}
}
|