-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
45 lines (33 loc) · 982 Bytes
/
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
#include "mainwindow.h"
#include "maincontroller.h"
#include <settings/settings.h>
#include <QApplication>
#include <QDebug>
#include <QCommandLineParser>
void parseCommandLine(const QApplication &a)
{
Settings settings;
QCommandLineParser parser;
QCommandLineOption clearSettingsOption("clear-settings", "Clear stored settings before starting application");
parser.addOption(clearSettingsOption);
if (!parser.parse(a.arguments())) {
qWarning() << "Failed to parse command line:" << parser.errorText();
exit(1);
}
// Settings parsed correctly, so handle them
if (parser.isSet(clearSettingsOption)) {
settings.clear();
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setApplicationDisplayName("Kronos");
a.setApplicationVersion("1.0");
a.setApplicationName("kronos");
parseCommandLine(a);
MainController c;
MainWindow w(&c);
w.show();
return a.exec();
}