diff ui/main.cpp @ 612:2ea11a95aa4a

Bail if the user is already running the application.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 18 Jun 2014 15:09:42 +0200
parents 077b4342d69b
children edf269b6e499
line wrap: on
line diff
--- a/ui/main.cpp	Wed Jun 18 14:43:56 2014 +0200
+++ b/ui/main.cpp	Wed Jun 18 15:09:42 2014 +0200
@@ -6,6 +6,7 @@
  * See LICENSE.txt for details.
  */
 #include "mainwindow.h"
+#include "processhelp.h"
 
 #include <QApplication>
 #include <QSystemTrayIcon>
@@ -55,6 +56,12 @@
         return 0;
     }
 
+    if (ProcessHelp::otherProcessesExist(APPNAME)) {
+        qDebug() << "Another " << APPNAME << " process is already running. Exiting.";
+        ProcessHelp::activateWindowForProcess(APPNAME);
+        return 0;
+    }
+
     QTranslator translator;
     if (QLocale::system().name() == "C") {
         /* Useful for testing / development as the primary target is german */

http://wald.intevation.org/projects/trustbridge/