-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
54 lines (39 loc) · 1003 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
46
47
48
49
50
51
52
53
54
#include "ui/mainwindow.h"
#include "deviser-version.h"
#include "model/devisersettings.h"
#include <QApplication>
#include <QFile>
#include <QTextCodec>
#include <QProcess>
#include <QMetaType>
#include <iostream>
int main(int argc, char *argv[])
{
qRegisterMetaType<QProcess::ExitStatus>("QProcess::ExitStatus");
QApplication a(argc, argv);
a.setApplicationName("Deviser Edit");
#if QT_VERSION > 0x050000
a.setApplicationDisplayName("Deviser Edit");
#endif
QString openFileName(QString::null);
for (int i = 1; i < argc; ++i)
{
QString current(argv[i]);
if (current == "--version")
{
std::cout << "DeviserEdit " << DEVISER_DOTTED_VERSION << std::endl;
return 0;
}
if (current.toLower() == "--havelanguage")
{
DeviserSettings::setHaveLanguage(true);
}
if (QFile(current).exists())
openFileName = current;
}
MainWindow w;
if (!openFileName.isNull())
w.openFile(openFileName);
w.show();
return a.exec();
}