diff options
author | 2021-04-05 23:53:18 +0530 | |
---|---|---|
committer | 2021-04-05 23:53:18 +0530 | |
commit | 35c8d9e91c26e0c788c7ee3ae69b5421dde1af69 (patch) | |
tree | 23f91e3ab84084fcfc2aa746b097718af7e54608 /src/main.cpp | |
parent | d3e34c8e6b2a59fff225aae20e5b17113efd6081 (diff) | |
download | whatsie-35c8d9e91c26e0c788c7ee3ae69b5421dde1af69.tar.gz whatsie-35c8d9e91c26e0c788c7ee3ae69b5421dde1af69.zip |
implemented runguard..
Diffstat (limited to 'src/main.cpp')
-rw-r--r-- | src/main.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/main.cpp b/src/main.cpp index f6b7e12..7f93480 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,7 +6,9 @@ #include <QSettings> #include <QDebug> -#include <mainwindow.h> +#include "mainwindow.h" + +#include "rungaurd.h" #include "common.h" @@ -31,6 +33,17 @@ int main(int argc, char *argv[]) QApplication::setOrganizationName("org.keshavnrj.ubuntu"); QApplication::setApplicationVersion(VERSIONSTR); + QString appname = QApplication::applicationName(); + + //allow multiple instances in debug builds + #ifndef QT_DEBUG + RunGuard guard("org.keshavnrj.ubuntu."+appname); + if ( !guard.tryToRun() ){ + QMessageBox::critical(0, appname,"An instance of "+appname+" is already running."); + return 0; + } + #endif + //QtWebEngine::initialize(); QWebEngineSettings::defaultSettings()->setAttribute(QWebEngineSettings::PluginsEnabled, true); |