123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- #include "mainwindow.h"
- #include "src/gui/dialogues/firstrundialog.h"
- #include "src/classes/arunguard.h"
- #include "src/database/adatabase.h"
- #include "src/classes/asettings.h"
- #include "src/astandardpaths.h"
- #include "src/classes/asettings.h"
- #include <QApplication>
- #include <QProcess>
- #include <QSettings>
- #include <QFileInfo>
- #include <QStandardPaths>
- #define APPNAME "openPilotLog"
- #define ORGNAME APPNAME
- #define ORGDOMAIN "https://github.com/fiffty-50/openpilotlog"
- int main(int argc, char *argv[])
- {
- QApplication openPilotLog(argc, argv);
- QCoreApplication::setOrganizationName(ORGNAME);
- QCoreApplication::setOrganizationDomain(ORGDOMAIN);
- QCoreApplication::setApplicationName(APPNAME);
- AStandardPaths::setup();
- AStandardPaths::scan_paths();
- if(!AStandardPaths::validate_paths()){
- DEB("Standard paths not valid.");
- return 1;
- }
- ASettings::setup();
- aDB()->connect();
-
- int selectedtheme = ASettings::getSettings().value("main/theme").toInt();
- QDir::setCurrent("/themes");
- switch (2) {
- case 1:{
- DEB "main :: Loading light theme";
- QFile file(":light.qss");
- file.open(QFile::ReadOnly | QFile::Text);
- QTextStream stream(&file);
- openPilotLog.setStyleSheet(stream.readAll());
- break;
- }
- case 2:{
- DEB "Loading dark theme";
- QFile file(":dark.qss");
- file.open(QFile::ReadOnly | QFile::Text);
- QTextStream stream(&file);
- openPilotLog.setStyleSheet(stream.readAll());
- break;
- }
- default:
- break;
- }
-
- ARunGuard guard("opl_single_key");
- if ( !guard.tryToRun() ){
- DEB "Another Instance is already running. Exiting.";
- return 0;
- }
- MainWindow w;
-
- w.show();
- return openPilotLog.exec();
- }
|