12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #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/classes/astandardpaths.h"
- #include "src/classes/asettings.h"
- #include "src/classes/astyle.h"
- #include <QApplication>
- #include <QProcess>
- #include <QSettings>
- #include <QFileInfo>
- #include <QStandardPaths>
- #include <QDebug>
- #define APPNAME QStringLiteral("openPilotLog")
- #define ORGNAME QStringLiteral("opl")
- #define ORGDOMAIN QStringLiteral("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_dirs();
- if(!AStandardPaths::validate_dirs()){
- DEB << "Standard paths not valid.";
- return 1;
- }
- ASettings::setup();
- AStyle::setup();
- aDB->connect();
- if (!ASettings::read(ASettings::Setup::SetupComplete).toBool()) {
- if(FirstRunDialog().exec() == QDialog::Rejected){
- DEB "First run not accepted. Exiting.";
- return 1;
- }
- ASettings::write(ASettings::Setup::SetupComplete, true);
- DEB << "Wrote setup_commplete?";
- }
-
- ARunGuard guard(QStringLiteral("opl_single_key"));
- if ( !guard.tryToRun() ){
- DEB << "Another Instance is already running. Exiting.";
- return 2;
- }
- MainWindow w;
-
- w.show();
- return openPilotLog.exec();
- }
|