-
Notifications
You must be signed in to change notification settings - Fork 0
/
optiondialog.cpp
107 lines (85 loc) · 1.94 KB
/
optiondialog.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
#include "optiondialog.h"
#include "./ui_optiondialog.h"
#include <iostream>
OptionDialog::OptionDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::OptionDialog)
{
ui->setupUi(this);
speed_index = ui->ComBoxSpeed->currentIndex();
inface_index = ui->ComBoxInterface->currentIndex();
}
OptionDialog::~OptionDialog()
{
delete ui;
}
Ui::OptionDialog * OptionDialog::OptionDialog_Get_ui()
{
return ui;
}
void OptionDialog::on_buttonBox_accepted()
{
std::cout<<" pressed OK"<<std::endl;
speed_index = ui->ComBoxSpeed->currentIndex();
inface_index = ui->ComBoxInterface->currentIndex();
emit signal_button_ok();
}
void OptionDialog::on_buttonBox_rejected()
{
std::cout<<" pressed cancelled"<<std::endl;
ui->ComBoxInterface->setCurrentIndex(inface_index);
ui->ComBoxSpeed->setCurrentIndex(speed_index);
emit signal_button_cancell();
}
int OptionDialog::Option_get_speed()
{
int speed = 50;
switch(speed_index)
{
case 0:
speed = 100;
break;
case 1:
speed = 200;
break;
case 2:
speed = 500;
break;
case 3:
speed = 800;
break;
case 4:
speed = 1000;
break;
case 5:
speed = 2000;
break;
case 6:
speed = 3000;
break;
case 7:
speed = 4000;
break;
case 8:
speed = 5000;
break;
case 9:
speed = 6000;
break;
case 10:
speed = 7000;
break;
default:
speed = 50;break;
}
return speed ;
}
int OptionDialog::Option_get_inface()
{
// if(inface_index)
// {
// return 1;
// }else
// return 2;
return (inface_index + 1);
}