forked from FLAME-HPC/flame_visualiser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimedialog.cpp
74 lines (64 loc) · 2.19 KB
/
timedialog.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
/*!
* \file timedialog.cpp
* \author Simon Coakley
* \date 2012
* \copyright Copyright (c) 2012 University of Sheffield
* \brief Implementation of time dialog
*/
#include "./timedialog.h"
#include "./ui_timedialog.h"
TimeDialog::TimeDialog(TimeScale * ts, QWidget *parent)
: QDialog(parent), ui(new Ui::TimeDialog) {
ui->setupUi(this);
timeScale = ts;
ui->spinBox_millisecond->setValue(ts->millisecond);
ui->spinBox_second->setValue(ts->second);
ui->spinBox_minute->setValue(ts->minute);
ui->spinBox_hour->setValue(ts->hour);
ui->spinBox_day->setValue(ts->day);
ui->checkBox_displayTimeInVisual->setChecked(ts->displayInVisual);
connect(ui->spinBox_millisecond, SIGNAL(valueChanged(int)),
this, SLOT(millisecondsChanged(int)));
connect(ui->spinBox_second, SIGNAL(valueChanged(int)),
this, SLOT(secondsChanged(int)));
connect(ui->spinBox_minute, SIGNAL(valueChanged(int)),
this, SLOT(minutesChanged(int)));
connect(ui->spinBox_hour, SIGNAL(valueChanged(int)),
this, SLOT(hoursChanged(int)));
connect(ui->spinBox_day, SIGNAL(valueChanged(int)),
this, SLOT(daysChanged(int)));
connect(ui->checkBox_displayTimeInVisual, SIGNAL(clicked(bool)),
this, SLOT(timeInVisualChanged(bool)));
connect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(close()));
connect(ui->buttonBox, SIGNAL(rejected()), this, SLOT(close()));
}
TimeDialog::~TimeDialog() {
delete ui;
}
void TimeDialog::closeEvent(QCloseEvent *event) {
emit(time_dialog_closed());
QDialog::closeEvent(event);
}
void TimeDialog::timeInVisualChanged(bool b) {
timeScale->displayInVisual = b;
}
void TimeDialog::millisecondsChanged(int i) {
timeScale->millisecond = i;
timeScale->calcTotalSeconds();
}
void TimeDialog::secondsChanged(int i) {
timeScale->second = i;
timeScale->calcTotalSeconds();
}
void TimeDialog::minutesChanged(int i) {
timeScale->minute = i;
timeScale->calcTotalSeconds();
}
void TimeDialog::hoursChanged(int i) {
timeScale->hour = i;
timeScale->calcTotalSeconds();
}
void TimeDialog::daysChanged(int i) {
timeScale->day = i;
timeScale->calcTotalSeconds();
}