-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.cpp
43 lines (35 loc) · 1.15 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
#include <QApplication>
#include <QCommandLineParser>
#include <KAboutData>
#include <KLocalizedString>
#include "mainwindow.h"
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
KLocalizedString::setApplicationDomain("livetikz");
KAboutData aboutData(
QStringLiteral("livetikz"),
i18n("LiveTikZ"),
QStringLiteral(APPVERSION),
i18n("A TikZ editor with live preview."),
KAboutLicense::BSDL,
i18n("(c) 2017-2020 Michael Schwarz"),
"",
"https://misc0110.net"
);
QCommandLineParser parser;
parser.setApplicationDescription(QCoreApplication::translate("main", "A TikZ editor with live preview."));
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("file", QCoreApplication::translate("main", "Document to open."));
aboutData.setupCommandLine(&parser);
parser.process(app);
aboutData.processCommandLine(&parser);
KAboutData::setApplicationData(aboutData);
MainWindow *window = new MainWindow();
window->show();
const QStringList args = parser.positionalArguments();
if (args.count()) {
window->load(QUrl::fromLocalFile(args.at(0)));
}
return app.exec();
}