Browse Source

Edited Runguard to fix restarting app after theme change

fiffty-50 4 năm trước cách đây
mục cha
commit
f06b57f555
2 tập tin đã thay đổi với 8 bổ sung7 xóa
  1. 7 7
      main.cpp
  2. 1 0
      mainwindow.h

+ 7 - 7
main.cpp

@@ -42,13 +42,6 @@ bool setup()
 
 int main(int argc, char *argv[])
 {
-    //sqlite does not deal well with multiple connections, ensure only one instance is running
-    RunGuard guard("opl_single_key");
-        if ( !guard.tryToRun() ){
-            qDebug() << "Another Instance is already running. Exiting.";
-            return 0;
-        }
-
     QCoreApplication::setOrganizationName("openPilotLog");
     QCoreApplication::setOrganizationDomain("https://github.com/fiffty-50/openpilotlog");
     QCoreApplication::setApplicationName("openPilotLog");
@@ -89,6 +82,13 @@ int main(int argc, char *argv[])
     }
 
 
+    //sqlite does not deal well with multiple connections, ensure only one instance is running
+    RunGuard guard("opl_single_key");
+        if ( !guard.tryToRun() ){
+            qDebug() << "Another Instance is already running. Exiting.";
+            return 0;
+        }
+
     MainWindow w;
     //w.showMaximized();
     w.show();

+ 1 - 0
mainwindow.h

@@ -34,6 +34,7 @@
 #include "src/gui/widgets/pilotswidget.h"
 #include "src/gui/dialogues/newtail.h"
 #include "src/gui/dialogues/newpilot.h"
+#include "src/classes/runguard.h"
 
 QT_BEGIN_NAMESPACE
 namespace Ui {