Add singleapplication

This commit is contained in:
Kevin Yue 2020-02-15 16:42:20 +08:00
parent 321c73710e
commit b6f499dde5
5 changed files with 13 additions and 4 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "singleapplication"]
path = singleapplication
url = git@github.com:itay-grudev/SingleApplication.git

Binary file not shown.

View File

@ -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

View File

@ -1,11 +1,13 @@
#include "singleapplication.h"
#include "gpclient.h"
#include <QApplication>
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();
}

1
singleapplication Submodule

@ -0,0 +1 @@
Subproject commit 0f6695e2a9d8fdaa336e7ad941855c46c61f218a