-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
55 lines (49 loc) · 1.37 KB
/
main.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
#include <QApplication>
#include <QIcon>
#include <QProcess>
#include <QSettings>
#include <QString>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("SheetMusicViewer");
QCoreApplication::setApplicationName("SheetMusicViewer");
QSettings settings;
QString customIconTheme = settings.value("customIconTheme").toString();
if (!customIconTheme.isNull() && !customIconTheme.isEmpty())
{
QIcon::setThemeName(customIconTheme);
}
else
{
settings.setValue("customIconTheme", QString());
}
QString customStyle = settings.value("customStyle").toString();
if (!customStyle.isNull() && !customStyle.isEmpty())
{
QApplication::setStyle(customStyle);
}
else
{
settings.setValue("customStyle", QString());
}
QString quitCommand = settings.value("quitCommand").toString();
if (quitCommand.isNull() || quitCommand.isEmpty())
{
settings.setValue("quitCommand", QString());
}
else
{
QObject::connect(&a, &QApplication::lastWindowClosed, [&quitCommand]()
{
if ((QApplication::queryKeyboardModifiers() & Qt::ShiftModifier) == 0)
{
QProcess::execute(quitCommand);
}
});
}
MainWindow w;
w.show();
return a.exec();
}