diff options
| author | jjl | 2010-09-23 04:41:19 +0200 |
|---|---|---|
| committer | jjl | 2010-09-23 04:41:19 +0200 |
| commit | da5372e49f47271f000d1f51887a93556fd0cda2 (patch) | |
| tree | 4628e2737614f2567bb6f71adfb69cba5c758641 /src | |
| parent | [PVSGUI] Turn on/off toolbar via menu and cmd-switch (pvsgui -h) (diff) | |
| download | pvs-da5372e49f47271f000d1f51887a93556fd0cda2.tar.gz pvs-da5372e49f47271f000d1f51887a93556fd0cda2.tar.xz pvs-da5372e49f47271f000d1f51887a93556fd0cda2.zip | |
[PVSGUI] Only one instance should be allowed now
Diffstat (limited to 'src')
| -rw-r--r-- | src/pvsgui.cpp | 9 | ||||
| -rw-r--r-- | src/pvsgui.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/pvsgui.cpp b/src/pvsgui.cpp index c2ac3cb..5b11104 100644 --- a/src/pvsgui.cpp +++ b/src/pvsgui.cpp @@ -438,13 +438,20 @@ void printVersion() int main(int argc, char *argv[]) { - QApplication app(argc, argv); + QtSingleApplication app(argc, argv); QStringList args = app.arguments(); app.setQuitOnLastWindowClosed(false); app.setOrganizationName("openslx"); app.setOrganizationDomain("openslx.org"); app.setApplicationName("pvsgui"); + // only one instance should be allowed + if (app.sendMessage("")) + { + qDebug("[PVSGUI] ERROR: Already running. Exiting"); + return 0; + } + // use system locale as language to translate gui QTranslator translator; translator.load(":pvsgui"); diff --git a/src/pvsgui.h b/src/pvsgui.h index 171f6bd..bab340a 100644 --- a/src/pvsgui.h +++ b/src/pvsgui.h @@ -16,6 +16,7 @@ #include <QtGui> #include <QtNetwork> +#include "3rdparty/qtsingleapplication/qtsingleapplication.h" #include "ui_clientToolbar.h" #include "src/gui/clientConfigDialog.h" #include "src/gui/clientChatDialog.h" |
