-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
changetime.cpp
99 lines (86 loc) · 2.3 KB
/
changetime.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
#include "changetime.h"
#include "ui_changetime.h"
ChangeTime::ChangeTime(QWidget* parent)
: QDialog(parent)
, ui(new Ui::ChangeTime)
{
ui->setupUi(this);
setWindowTitle(QApplication::translate("MainWindow", "Set delay", 0));
// setWindowTitle(QString::fromWCharArray(static_cast<wchar_t*>("Zmnit as")));
connect(this, SIGNAL(changeDateTime(int, int, int, int, bool)), parent, SLOT(changeDateTime_clicked(int, int, int, int, bool)));
QPalette pal = this->palette();
pal.setColor(QPalette::Window, "#D0D0E7");
this->setPalette(pal);
}
ChangeTime::~ChangeTime()
{
delete ui;
}
void ChangeTime::changeEvent(QEvent* e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void ChangeTime::on_buttonBox_accepted()
{
int year = ui->yearSpinBox->text().toInt();
int month = ui->monthSpinBox->text().toInt();
int day = ui->daySpinBox->text().toInt();
int sec = (ui->hourSpinBox->text().toInt() * 3600)
(ui->minuteSpinBox->text().toInt() * 60)
ui->secondSpinBox->text().toInt();
/*if(ui->signComboBox->currentText() == "-")
{
year = -year;
month = -month;
day = -day;
sec = -sec;
}*/
/*QString n;
if(ui->photoRButton->isChecked())
n = "pictures";
else
n = "gps";*/
emit changeDateTime(year, month, day, sec, ui->checkBox_isSaveTime->isChecked());
}
/*
void ChangeTime::checkTime(QLineEdit *lineEdit)
{
QString text = lineEdit->text();
if(!text.isEmpty() && !text.at(lineEdit->cursorPosition() - 1).isNumber())
{
text.remove((lineEdit->cursorPosition() - 1),1);
lineEdit->setText(text);
}
}
void ChangeTime::on_yearLineEdit_textEdited(QString )
{
checkTime(ui->yearLineEdit);
}
void ChangeTime::on_monthLineEdit_textEdited(QString )
{
checkTime(ui->monthLineEdit);
}
void ChangeTime::on_dayLineEdit_textEdited(QString )
{
checkTime(ui->dayLineEdit);
}
void ChangeTime::on_hourLineEdit_textEdited(QString )
{
checkTime(ui->hourLineEdit);
}
void ChangeTime::on_minuteLineEdit_textEdited(QString )
{
checkTime(ui->minuteLineEdit);
}
void ChangeTime::on_secondLineEdit_textEdited(QString )
{
checkTime(ui->secondLineEdit);
}
*/