-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitorwindow.cpp
More file actions
266 lines (228 loc) · 5.82 KB
/
monitorwindow.cpp
File metadata and controls
266 lines (228 loc) · 5.82 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
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#include "monitorwindow.h"
#include "ui_monitorwindow.h"
MonitorWindow::MonitorWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MonitorWindow)
{
ui->setupUi(this);
setWindowIcon(QIcon(":/Icon/Icon/Evo.png"));
consDistance = 0;
consAngle = 0;
posDistance = 0;
posAngle = 0;
addDistance = 0;
addDoubleDistance = 0;
addAngle = 0;
addDoubleAngle = 0;
QPixmap homeImage(":/Icon/Icon/home.png");
QIcon home;
home.addPixmap(homeImage);
ui->pushButton->setIcon(home);
ui->pushButton->setIconSize(QSize(20,20));
QPixmap arrowUpImage(":/Icon/Icon/arrow_up.png");
QIcon arrowUp;
arrowUp.addPixmap(arrowUpImage);
ui->pushButton_2->setIcon(arrowUp);
ui->pushButton_2->setIconSize(QSize(20,20));
QPixmap doubleArrowUpImage(":/Icon/Icon/double_arrow_up.png");
QIcon doubleArrowUp;
doubleArrowUp.addPixmap(doubleArrowUpImage);
ui->pushButton_3->setIcon(doubleArrowUp);
ui->pushButton_3->setIconSize(QSize(20,40));
QPixmap arrowRightImage(":/Icon/Icon/arrow_right.png");
QIcon arrowRight;
arrowRight.addPixmap(arrowRightImage);
ui->pushButton_4->setIcon(arrowRight);
ui->pushButton_4->setIconSize(QSize(20,20));
QPixmap doubleArrowRightImage(":/Icon/Icon/double_arrow_right.png");
QIcon doubleArrowRight;
doubleArrowRight.addPixmap(doubleArrowRightImage);
ui->pushButton_5->setIcon(doubleArrowRight);
ui->pushButton_5->setIconSize(QSize(40,20));
QPixmap arrowDownImage(":/Icon/Icon/arrow_down.png");
QIcon arrowDown;
arrowDown.addPixmap(arrowDownImage);
ui->pushButton_6->setIcon(arrowDown);
ui->pushButton_6->setIconSize(QSize(20,20));
QPixmap doubleArrowDownImage(":/Icon/Icon/double_arrow_down.png");
QIcon doubleArrowDown;
doubleArrowDown.addPixmap(doubleArrowDownImage);
ui->pushButton_7->setIcon(doubleArrowDown);
ui->pushButton_7->setIconSize(QSize(20,40));
QPixmap arrowLeftImage(":/Icon/Icon/arrow_left.png");
QIcon arrowLeft;
arrowLeft.addPixmap(arrowLeftImage);
ui->pushButton_8->setIcon(arrowLeft);
ui->pushButton_8->setIconSize(QSize(20,20));
QPixmap doubleArrowLeftImage(":/Icon/Icon/double_arrow_left.png");
QIcon doubleArrowLeft;
doubleArrowLeft.addPixmap(doubleArrowLeftImage);
ui->pushButton_9->setIcon(doubleArrowLeft);
ui->pushButton_9->setIconSize(QSize(40,20));
shortcut = new QShortcut(QKeySequence(Qt::Key_Escape), this);
QObject::connect(shortcut, SIGNAL(activated()), this, SLOT(quit()));
}
MonitorWindow::~MonitorWindow()
{
delete ui;
}
void MonitorWindow::setAddDistance(int value)
{
addDistance = value;
}
int MonitorWindow::getAddDistance()
{
return addDistance;
}
void MonitorWindow::setAddDoubleDistance(int value)
{
addDoubleDistance = value;
}
int MonitorWindow::getAddDoubleDistance()
{
return addDoubleDistance;
}
void MonitorWindow::setAddAngle(int value)
{
addAngle = value;
}
int MonitorWindow::getAddAngle()
{
return addAngle;
}
void MonitorWindow::setAddDoubleAngle(int value)
{
addDoubleAngle = value;
}
int MonitorWindow::getAddDoubleAngle()
{
return addDoubleAngle;
}
int MonitorWindow::getConsDistance()
{
return consDistance;
}
int MonitorWindow::getConsAngle()
{
return consAngle;
}
void MonitorWindow::cmd_acquisition(bool value)
{
ui->pushButton->setEnabled(value);
ui->pushButton_2->setEnabled(value);
ui->pushButton_3->setEnabled(value);
ui->pushButton_4->setEnabled(value);
ui->pushButton_5->setEnabled(value);
ui->pushButton_6->setEnabled(value);
ui->pushButton_7->setEnabled(value);
ui->pushButton_8->setEnabled(value);
ui->pushButton_9->setEnabled(value);
ui->pushRun->setEnabled(value);
}
void MonitorWindow::quit()
{
this->close();
}
void MonitorWindow::lcd_update()
{
ui->lcdNumber->display(consDistance);
ui->lcdNumber_2->display(consAngle);
ui->lcdNumber_3->display(posDistance);
ui->lcdNumber_4->display(posAngle);
}
void MonitorWindow::on_pushButton_clicked()
{
if (ui->checkBox->isChecked())
emit home();
else {
consDistance = 0;
consAngle = 0;
lcd_update();
}
}
void MonitorWindow::on_pushButton_2_clicked()
{
if (ui->checkBox->isChecked())
emit up();
else {
consDistance += addDistance;
lcd_update();
}
}
void MonitorWindow::on_pushButton_3_clicked()
{
if (ui->checkBox->isChecked())
emit doubleUp();
else {
consDistance += addDoubleDistance;
lcd_update();
}
}
void MonitorWindow::on_pushButton_4_clicked()
{
if (ui->checkBox->isChecked())
emit right();
else {
consAngle += addAngle;
lcd_update();
}
}
void MonitorWindow::on_pushButton_5_clicked()
{
if (ui->checkBox->isChecked())
emit doubleRight();
else {
consAngle += addDoubleAngle;
lcd_update();
}
}
void MonitorWindow::on_pushButton_6_clicked()
{
if (ui->checkBox->isChecked())
emit down();
else {
consDistance -= addDistance;
lcd_update();
}
}
void MonitorWindow::on_pushButton_7_clicked()
{
if (ui->checkBox->isChecked())
emit doubleDown();
else {
consDistance -= addDoubleDistance;
lcd_update();
}
}
void MonitorWindow::on_pushButton_8_clicked()
{
if (ui->checkBox->isChecked())
emit left();
else {
consAngle -= addAngle;
lcd_update();
}
}
void MonitorWindow::on_pushButton_9_clicked()
{
if (ui->checkBox->isChecked())
emit doubleLeft();
else {
consAngle -= addDoubleAngle;
lcd_update();
}
}
void MonitorWindow::on_pushRun_clicked()
{
emit runButton();
}
void MonitorWindow::on_checkBox_clicked()
{
consDistance = 0;
consAngle = 0;
lcd_update();
}
void MonitorWindow::on_pushStop_clicked()
{
emit stopButton();
}