-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.cpp
45 lines (39 loc) · 1020 Bytes
/
window.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
#include <QDebug>
#include <QCloseEvent>
#include <MApplication>
#include "window.h"
#include "settings.h"
#include "Singleton.h"
void Window::closeEvent(QCloseEvent *event)
{
Settings *settings = &Singleton<Settings>::Instance();
if(mainpage->wantsToSaveFile()){
if(mainpage->saveWithDialog()) {
event->setAccepted(false);
mainpage->wantsToCloseWindow();
settings->setAutoLoadFileName(mainpage->getActualFileName());
MApplication::quit();
}
else {
event->setAccepted(false);
this->mainpage->saveOnWindowEvents();
settings->setAutoLoadFileName(mainpage->getActualFileName());
MApplication::quit();
}
}
else {
event->setAccepted(true);
}
}
void Window::setSaveFileFlag(bool set)
{
this->saveFileFlag = set;
}
bool Window::getSaveFileFlag()
{
return this->saveFileFlag;
}
void Window::setMainPage(MainPage *mainPage)
{
this->mainpage = mainPage;
}