forked from linuxdeepin/deepin-shortcut-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingleapplication.h
40 lines (30 loc) · 931 Bytes
/
singleapplication.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#ifndef SINGLEAPPLICATION_H
#define SINGLEAPPLICATION_H
#include <QApplication>
#include <QLocalServer>
#include <QLocalSocket>
#include <DApplication>
DWIDGET_USE_NAMESPACE
class SingleApplication : public DApplication
{
Q_OBJECT
public:
explicit SingleApplication(int &argc, char **argv, int = ApplicationFlags);
~SingleApplication();
void initConnect();
void newClientProcess(const QString& key, const QByteArray &message);
static QString userServerName(const QString& key);
static QString userID();
static QString UserID;
static void processArgs(const QStringList &list);
public slots:
bool setSingleInstance(const QString& key);
void handleConnection();
void readData();
private:
QLocalServer* m_localServer;
};
#endif // SINGLEAPPLICATION_H