@@ -24,6 +24,7 @@ This file is part of Fast Track.
2424#include < QScopedPointer>
2525#include < QSplashScreen>
2626#include < QString>
27+ #include " cli.h"
2728#include " mainwindow.h"
2829
2930QScopedPointer<QFile> logFile;
@@ -37,25 +38,31 @@ void messageHandler(QtMsgType type, const QMessageLogContext &context, const QSt
3738int main (int argc, char *argv[]) {
3839 char env[] = " OPENCV_OPENCL_DEVICE=disabled" ;
3940 putenv (env); // disable OpenCL to fix windows memory leaks and increase performance
41+
4042 QApplication a (argc, argv);
41- QPixmap pixmap (QStringLiteral (" :/assets/icon.png" ));
42- QSplashScreen splash (pixmap);
43- splash.show ();
44- a.setApplicationName (QStringLiteral (" FastTrack" ));
45- a.setApplicationVersion (APP_VERSION); // clazy:exclude=qstring-allocations
46- a.setOrganizationName (QStringLiteral (" FastTrackOrg" ));
47- a.setOrganizationDomain (QStringLiteral (" www.fasttrack.sh" ));
48- logFile.reset (new QFile (QStandardPaths::writableLocation (QStandardPaths::AppLocalDataLocation) + " /fasttrack.log" ));
49- QDir ().mkpath (QStandardPaths::writableLocation (QStandardPaths::AppLocalDataLocation));
50- logFile.data ()->open (QFile::Append | QFile::Text);
43+ if (argc == 1 ) {
44+ QPixmap pixmap (QStringLiteral (" :/assets/icon.png" ));
45+ QSplashScreen splash (pixmap);
46+ splash.show ();
47+ a.setApplicationName (QStringLiteral (" FastTrack" ));
48+ a.setApplicationVersion (APP_VERSION); // clazy:exclude=qstring-allocations
49+ a.setOrganizationName (QStringLiteral (" FastTrackOrg" ));
50+ a.setOrganizationDomain (QStringLiteral (" www.fasttrack.sh" ));
51+ logFile.reset (new QFile (QStandardPaths::writableLocation (QStandardPaths::AppLocalDataLocation) + " /fasttrack.log" ));
52+ QDir ().mkpath (QStandardPaths::writableLocation (QStandardPaths::AppLocalDataLocation));
53+ logFile.data ()->open (QFile::Append | QFile::Text);
5154#ifdef QT_NO_DEBUG
52- qInstallMessageHandler (messageHandler);
55+ qInstallMessageHandler (messageHandler);
5356#endif
54- MainWindow w;
55- w.setWindowIcon (QIcon (" :/assets/icon.png" ));
56- QFontDatabase::addApplicationFont (QStringLiteral (" :/assets/Font.ttf" ));
57- w.setStyleSheet (QStringLiteral (" QWidget {font-family: 'Lato', sans-serif;}" ));
58- w.show ();
59- splash.finish (&w);
60- a.exec ();
57+ MainWindow w;
58+ w.setWindowIcon (QIcon (" :/assets/icon.png" ));
59+ QFontDatabase::addApplicationFont (QStringLiteral (" :/assets/Font.ttf" ));
60+ w.setStyleSheet (QStringLiteral (" QWidget {font-family: 'Lato', sans-serif;}" ));
61+ w.show ();
62+ splash.finish (&w);
63+ a.exec ();
64+ }
65+ else {
66+ return cli (argc, argv);
67+ }
6168}
0 commit comments