-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdialogacquisitionconfiguration.cpp
109 lines (91 loc) · 3.43 KB
/
dialogacquisitionconfiguration.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 "dialogacquisitionconfiguration.h"
#include "ui_dialogacquisitionconfiguration.h"
DialogAcquisitionConfiguration::DialogAcquisitionConfiguration(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogAcquisitionConfiguration)
{
ui->setupUi(this);
this->setWindowTitle("ACQUISITION CONFIGURATION");
connect(ui->pushButtonSelectAll,SIGNAL(clicked(bool)),this,SLOT(pushButtonSelectAllPressed()));
connect(ui->pushButtonUnselect,SIGNAL(clicked(bool)),this,SLOT(pushButtonUnselectAllPressed()));
connect(ui->checkBoxSaveBinary,SIGNAL(clicked(bool)),this,SLOT(checkBoxSaveBinaryClicked()));
connect(ui->checkBoxSaveText,SIGNAL(clicked(bool)),this,SLOT(checkBoxSaveTextClicked()));
configureCheckboxPointers();
}
DialogAcquisitionConfiguration::~DialogAcquisitionConfiguration()
{
delete ui;
}
void DialogAcquisitionConfiguration::configureCheckboxPointers(){
for(QObject *obj : ui->groupBoxAFE0->children()){
QCheckBox *checkbox = reinterpret_cast<QCheckBox*>(obj);
this->ptr_ch_enabled.append(checkbox);
}
for(QObject *obj : ui->groupBoxAFE1->children()){
QCheckBox *checkbox = reinterpret_cast<QCheckBox*>(obj);
this->ptr_ch_enabled.append(checkbox);
}
for(QObject *obj : ui->groupBoxAFE2->children()){
QCheckBox *checkbox = reinterpret_cast<QCheckBox*>(obj);
this->ptr_ch_enabled.append(checkbox);
}
for(QObject *obj : ui->groupBoxAFE3->children()){
QCheckBox *checkbox = reinterpret_cast<QCheckBox*>(obj);
this->ptr_ch_enabled.append(checkbox);
}
for(QObject *obj : ui->groupBoxAFE4->children()){
QCheckBox *checkbox = reinterpret_cast<QCheckBox*>(obj);
this->ptr_ch_enabled.append(checkbox);
}
}
QVector<bool> DialogAcquisitionConfiguration::getCheckBoxStates(){
QVector<bool> checkboxStates;
for(QCheckBox *chk : this->ptr_ch_enabled){
bool state = chk->isChecked();
checkboxStates.append(state);
}
return checkboxStates;
}
void DialogAcquisitionConfiguration::setCheckBoxStates(const QVector<bool> &states){
int i = 0;
for(QCheckBox *chk : this->ptr_ch_enabled){
chk->setChecked(states.at(i));
i++;
}
}
int DialogAcquisitionConfiguration::getRecordLength(){
return ui->spinBoxRecordLenght->value();
}
void DialogAcquisitionConfiguration::setRecordLength(const int &record_length){
ui->spinBoxRecordLenght->setValue(record_length);;
}
void DialogAcquisitionConfiguration::pushButtonSelectAllPressed(){
for(QCheckBox *chk : this->ptr_ch_enabled){
chk->setChecked(true);
}
}
void DialogAcquisitionConfiguration::pushButtonUnselectAllPressed(){
for(QCheckBox *chk : this->ptr_ch_enabled){
chk->setChecked(false);
}
}
bool DialogAcquisitionConfiguration::getCheckBoxSaveTextState(){
return ui->checkBoxSaveText->isChecked();
}
bool DialogAcquisitionConfiguration::getCheckBoxSaveBinaryState(){
return ui->checkBoxSaveBinary->isChecked();
}
void DialogAcquisitionConfiguration::setCheckBoxSaveTextState(const bool &state){
ui->checkBoxSaveText->setChecked(state);
}
void DialogAcquisitionConfiguration::setCheckBoxSaveBinaryState(const bool &state){
ui->checkBoxSaveBinary->setChecked(state);
}
void DialogAcquisitionConfiguration::checkBoxSaveBinaryClicked(){
ui->checkBoxSaveBinary->setChecked(true);
ui->checkBoxSaveText->setChecked(false);
}
void DialogAcquisitionConfiguration::checkBoxSaveTextClicked(){
ui->checkBoxSaveBinary->setChecked(false);
ui->checkBoxSaveText->setChecked(true);
}