forked from linuxdeepin/deepin-shortcut-viewer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
52 lines (41 loc) · 1.26 KB
/
main.cpp
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
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#include <QApplication>
#include <DLog>
//#include "widget.h"
#include "./view/mainwidget.h"
#include <QRect>
#include <QPoint>
#include <QFile>
#include <QLocale>
#include "singleapplication.h"
#include <QJsonObject>
#include <QJsonArray>
#include <QJsonDocument>
DCORE_USE_NAMESPACE
int main(int argc, char *argv[])
{
//Singlentan process
SingleApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false);
app.setOrganizationName("deepin");
app.setApplicationName(QObject::tr("Deepin Shortcut Viewer"));
app.setApplicationVersion("v1.0");
app.setTheme("dark");
//Logger handle
DLogManager::registerConsoleAppender();
QString uniqueKey = app.applicationName();
bool isSingleApplication = app.setSingleInstance(uniqueKey);
//Handle singlelentan process communications;
if (isSingleApplication) {
SingleApplication::processArgs(app.arguments());
return app.exec();
} else {
QByteArray array;
for (const QString &arg : app.arguments())
array.append(arg.toLocal8Bit()).append('\0');
app.newClientProcess(uniqueKey, array);
return 0;
}
}