diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a38e54c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "singleapplication"] + path = singleapplication + url = git@github.com:itay-grudev/SingleApplication.git diff --git a/GPClient/GPClient b/GPClient/GPClient index fafb981..c2ab6d4 100755 Binary files a/GPClient/GPClient and b/GPClient/GPClient differ diff --git a/GPClient/GPClient.pro b/GPClient/GPClient.pro index 7dbb124..7bca10b 100644 --- a/GPClient/GPClient.pro +++ b/GPClient/GPClient.pro @@ -4,6 +4,9 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 +include(../singleapplication/singleapplication.pri) +DEFINES += QAPPLICATION_CLASS=QApplication + # The following define makes your compiler emit warnings if you use # any Qt feature that has been marked deprecated (the exact warnings # depend on your compiler). Please consult the documentation of the diff --git a/GPClient/main.cpp b/GPClient/main.cpp index 65d45bb..0d66edf 100644 --- a/GPClient/main.cpp +++ b/GPClient/main.cpp @@ -1,11 +1,13 @@ +#include "singleapplication.h" #include "gpclient.h" -#include - int main(int argc, char *argv[]) { - QApplication a(argc, argv); + SingleApplication app(argc, argv); GPClient w; w.show(); - return a.exec(); + + QObject::connect(&app, &SingleApplication::instanceStarted, &w, &GPClient::raise); + + return app.exec(); } diff --git a/singleapplication b/singleapplication new file mode 160000 index 0000000..0f6695e --- /dev/null +++ b/singleapplication @@ -0,0 +1 @@ +Subproject commit 0f6695e2a9d8fdaa336e7ad941855c46c61f218a