This repository was archived by the owner on Jul 22, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathdialogparameters.cpp
More file actions
108 lines (80 loc) · 3.39 KB
/
dialogparameters.cpp
File metadata and controls
108 lines (80 loc) · 3.39 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
#include <QtWidgets>
#include <iostream>
#include "mainwindow.h"
#include "dialogparameters.h"
//#include "datadialogparameters.h"
#include "configuration.h"
DialogParameters::DialogParameters()
= default;
DialogParameters::DialogParameters(QWidget *parent)
: QDialog(parent)
{
this->parent=(MainWindow *)parent;
std::cout<< "constructor DialogScalaTraslaRota" <<std::endl;
labMaxLines = new QLabel(tr("MAXLINES"));
MaxLines = new QLineEdit;
MaxLines->setText("50000");
labStepOffset = new QLabel(tr("Step Offset"));
stepOffset = new QLineEdit;
stepOffset->setText("0.01");
labWindowOffset = new QLabel(tr("Window Offset"));
windowOffset = new QLineEdit;
windowOffset->setText("3.0");
labMessageCLEAN = new QLabel(tr("\nATTENTION: \n Be aware that if you pressed OK, \n datasets will be cleaned/deleted \n and you will have to reload and\n calculate the datasets again.\n"));
buttonOK = new QPushButton(tr("&OK"));
buttonCancel = new QPushButton(tr("&Cancel"));
std::cout<< "constructor dialogScalaTraslaRota after Button Cancel" <<std::endl;
connect(buttonOK, SIGNAL(clicked()), this, SLOT(onOK()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(onCancel()));
QVBoxLayout *leftLayout = new QVBoxLayout;
//leftLayout->addLayout(topLeftLayout);
leftLayout->addWidget(labMaxLines);
leftLayout->addWidget(MaxLines);
leftLayout->addWidget(labStepOffset);
leftLayout->addWidget(stepOffset);
leftLayout->addWidget(labWindowOffset);
leftLayout->addWidget(windowOffset);
leftLayout->addWidget(labMessageCLEAN);
QHBoxLayout *buttonLayout2 = new QHBoxLayout;
buttonLayout2->addWidget(buttonOK);
buttonLayout2->addWidget(buttonCancel);
QGridLayout *mainLayout = new QGridLayout;
mainLayout->setSizeConstraint(QLayout::SetFixedSize);
mainLayout->addLayout(leftLayout, 0, 0);
mainLayout->addLayout(buttonLayout2, 1,0);
//mainLayout->addWidget(buttonBox, 0, 1);
//mainLayout->addWidget(extension, 1, 0, 1, 2);
mainLayout->setRowStretch(2, 1);
setLayout(mainLayout);
setWindowTitle(tr("Modify Configuration Parameters"));
}
void DialogParameters::onOK()
{
std::cout<< "onOK" <<std::endl;
//Take the data from screen
double maxLines = MaxLines->text().toDouble();
double offset_window = windowOffset->text().toDouble();
double offset_step = stepOffset->text().toDouble();
std::cout<< "onOK" <<std::endl;
((MainWindow*)(parent))->dataDialogParameters->updateData(maxLines,offset_step,offset_window);
((MainWindow*)(parent))->cleanDataSets();
Configuration::setMaxLines(maxLines);
Configuration::setStepOffset(offset_step);
Configuration::setWindowOffset(offset_window);
std::cout<< "FIN onOK" <<std::endl;
this->close();
}
void DialogParameters::onCancel()
{
std::cout<< "onCancel" <<std::endl;
std::cout<< "FIN onCancel" <<std::endl;
this->close();
}
void DialogParameters::setDataDialog(DataDialogParameters* aModel){
std::cout<<"aModel->getMAXLINES()"<<aModel->getMAXLINES()<<std::endl;
std::cout<<"aModel->getStepOffset()"<<aModel->getStepOffset()<<std::endl;
std::cout<<"aModel->getOffsetWindow()"<<aModel->getOffsetWindow()<<std::endl;
MaxLines->setText(QString::number(aModel->getMAXLINES(),'f',6));
stepOffset->setText(QString::number(aModel->getStepOffset(),'f',6));
windowOffset->setText(QString::number(aModel->getOffsetWindow(),'f',6));
}