main.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include "mainwindow.h"
  2. #include <QApplication>
  3. #include <QProcess>
  4. #include <QSettings>
  5. int main(int argc, char *argv[])
  6. {
  7. QCoreApplication::setOrganizationName("openPilotLog");
  8. QCoreApplication::setOrganizationDomain("https://github.com/fiffty-50/openpilotlog");
  9. QCoreApplication::setApplicationName("openPilotLog");
  10. QSettings::setPath(QSettings::IniFormat,QSettings::UserScope,"data");
  11. QSettings::setDefaultFormat(QSettings::IniFormat);
  12. QSettings settings;
  13. QApplication openPilotLog(argc, argv);
  14. //Theming
  15. int selectedtheme = settings.value("main/theme").toInt();
  16. QDir::setCurrent("/themes");
  17. switch (selectedtheme) {
  18. case 1:
  19. {
  20. qDebug() << "main :: Loading light theme";
  21. QFile file(":light.qss");
  22. file.open(QFile::ReadOnly | QFile::Text);
  23. QTextStream stream(&file);
  24. openPilotLog.setStyleSheet(stream.readAll());
  25. break;
  26. }
  27. case 2:
  28. qDebug() << "Loading dark theme";
  29. QFile file(":dark.qss");
  30. file.open(QFile::ReadOnly | QFile::Text);
  31. QTextStream stream(&file);
  32. openPilotLog.setStyleSheet(stream.readAll());
  33. break;
  34. }
  35. MainWindow w;
  36. w.show();
  37. return openPilotLog.exec();
  38. }