-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigMainWindow.cpp
More file actions
76 lines (68 loc) · 2.19 KB
/
Copy pathConfigMainWindow.cpp
File metadata and controls
76 lines (68 loc) · 2.19 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
#include "ConfigMainWindow.h"
#include "ui_ConfigMainWindow.h"
#include <QMessageBox>
#include "FolderDialog.h"
CConfigMainWindow::CConfigMainWindow(QWidget *parent):
CConfigWidgetBase(parent),
ui(new Ui::CConfigMainWindow)
{
ui->setupUi(this);
}
CConfigMainWindow::~CConfigMainWindow()
{
delete ui;
}
bool CConfigMainWindow::Save(QSettings* pSettings)
{
pSettings->setValue("MainWnd/SlideShowEnabled",ui->chkSlideShow->isChecked());
pSettings->setValue("MainWnd/PicturesFolder",ui->editPicturesFolder->text());
pSettings->setValue("MainWnd/Delay",ui->editDelay->text().toInt());
pSettings->setValue("MainWnd/Randomize",ui->chkRandom->isChecked());
pSettings->setValue("MainWnd/WeatherEnabled",ui->chkWeather->isChecked());
pSettings->setValue("MainWnd/Location",ui->editLocation->text());
return true;
}
bool CConfigMainWindow::Load(QSettings* pSettings)
{
ui->chkSlideShow->setChecked(pSettings->value("MainWnd/SlideShowEnabled",false).toBool());
ui->editPicturesFolder->setText(pSettings->value("MainWnd/PicturesFolder","").toString());
ui->editDelay->setText(pSettings->value("MainWnd/Delay",20).toString());
ui->chkRandom->setChecked(pSettings->value("MainWnd/Randomize",false).toBool());
ui->chkWeather->setChecked(pSettings->value("MainWnd/WeatherEnabled",true).toBool());
ui->editLocation->setText(pSettings->value("MainWnd/Location","").toString());
return true;
}
void CConfigMainWindow::on_btnDelayMinus_clicked()
{
int val = ui->editDelay->text().toInt();
val--;
if(val<0)
{
val=0;
}
ui->editDelay->setText(QString::number(val));
}
void CConfigMainWindow::on_btnDelayPlus_clicked()
{
int val = ui->editDelay->text().toInt();
val++;
if(val>1500)
{
val=1500;
}
ui->editDelay->setText(QString::number(val));
}
void CConfigMainWindow::on_btnBrowse_clicked()
{
CFolderDialog dlg;
dlg.SelectedPath = ui->editPicturesFolder->text();
if(dlg.exec()==QDialog::Accepted)
{
ui->editPicturesFolder->setText(dlg.SelectedPath);
}
// QString str = QFileDialog::getExistingDirectory(this);
// if(str!="")
// {
// ui->editPicturesFolder->setText(str);
// }
}