-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsettingdialog.cpp
63 lines (54 loc) · 1.59 KB
/
settingdialog.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
#include <QSystemTrayIcon>
#include "settingdialog.h"
#include "ui_settingdialog.h"
#include "fileio.h"
SettingDialog::SettingDialog(QWidget *parent,bool *isMilTime, bool *WarnOnPm, QSystemTrayIcon *trayIcon) :
QDialog(parent),
ui(new Ui::SettingDialog)
{
ui->setupUi(this);
_isMilTime=isMilTime;
_WarnOnPm=WarnOnPm;
_trayIcon=trayIcon;
if(*_isMilTime)
{
ui->WarnBox->setDisabled(true);
}
ui->WarnBox->setChecked(*WarnOnPm);
ui->plebTime->setChecked(!*_isMilTime);
ui->milTime->setChecked(*_isMilTime);
ui->defaultShow->setChecked(FileIO::LoadWindowShow());
ui->chk_mono->setChecked(FileIO::LoadisMono());
connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(Save()));
connect(ui->plebTime,SIGNAL(clicked(bool)),this,SLOT(toggleWarnBox()));
connect(ui->milTime,SIGNAL(clicked(bool)),this,SLOT(toggleWarnBox()));
}
SettingDialog::~SettingDialog()
{
delete ui;
}
void SettingDialog::Save()
{
FileIO::SaveWindowShow(ui->defaultShow->isChecked());
*_isMilTime=ui->milTime->isChecked();
*_WarnOnPm=ui->WarnBox->isChecked();
FileIO::SaveisMilTime(*_isMilTime);
FileIO::SaveWarnOnPm(*_WarnOnPm);
FileIO::SaveisMono(ui->chk_mono->isChecked());
if(ui->chk_mono->isChecked())
{
_trayIcon->setIcon(QIcon(":/new/icons/mono.png"));
}else{
_trayIcon->setIcon(QIcon(":/new/icons/Clock.png"));
}
this->deleteLater();
}
void SettingDialog::toggleWarnBox()
{
if(ui->plebTime->isChecked())
{
ui->WarnBox->setDisabled(false);
}else{
ui->WarnBox->setDisabled(true);
}
}