-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettingspage.cpp
More file actions
75 lines (59 loc) · 1.33 KB
/
Copy pathsettingspage.cpp
File metadata and controls
75 lines (59 loc) · 1.33 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
#include <QMessageBox>
#include "settingspage.h"
SettingsPage::SettingsPage(QWidget *parent)
: QWidget(parent),
m_modified(false)
{
}
void SettingsPage::aboutToShow()
{
load();
}
bool SettingsPage::aboutToClose()
{
if (m_modified) {
QMessageBox::StandardButton result = \
QMessageBox::warning(this,
tr("Unsaved Changes"),
tr("You have unsaved configuration changes that will be lost, do you want to discard them?"),
QMessageBox::Cancel|QMessageBox::Discard|QMessageBox::Save, QMessageBox::Cancel);
switch(result) {
case QMessageBox::Cancel:
return false;
case QMessageBox::Discard:
load();
return true;
case QMessageBox::Save:
save();
return true;
default:
return false;
}
}
return true;
}
void SettingsPage::setModified()
{
if (!m_modified)
emit modifiedChanged(true);
m_modified = true;
}
void SettingsPage::clearModified()
{
if (m_modified)
emit modifiedChanged(false);
m_modified = false;
}
void SettingsPage::load()
{
}
void SettingsPage::save()
{
}
void SettingsPage::reset()
{
load();
}
void SettingsPage::defaults()
{
}