Add singleapplication for service

This commit is contained in:
Kevin Yue 2020-02-15 20:40:01 +08:00
parent b6f499dde5
commit 482012098e
2 changed files with 6 additions and 4 deletions

View File

@ -4,6 +4,9 @@ QT -= gui
CONFIG += c++11 console
CONFIG -= app_bundle
include(../singleapplication/singleapplication.pri)
DEFINES += QAPPLICATION_CLASS=QCoreApplication
# 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,10 @@
#include <QCoreApplication>
#include <QtDBus>
#include "gpservice.h"
#include "singleapplication.h"
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
SingleApplication app(argc, argv);
if (!QDBusConnection::systemBus().isConnected()) {
qWarning("Cannot connect to the D-Bus session bus.\n"
@ -15,5 +14,5 @@ int main(int argc, char *argv[])
new GPService;
return a.exec();
return app.exec();
}