This repository has been archived by the owner on Jun 16, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
51 lines (37 loc) · 1.41 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
#include <QObject>
#include <DApplication>
#include "wallpaper.h"
#include "dbuswallpaperservice.h"
#include "settings.h"
DWIDGET_USE_NAMESPACE
int main(int argc, char *argv[])
{
DApplication::loadDXcbPlugin();
DApplication a(argc, argv);
a.setTheme("light");
setlocale(LC_NUMERIC, "C");
if (a.setSingleInstance("deepin-dreamscene")) {
a.setApplicationName(QObject::tr("Deepin DreamScene"));
a.setApplicationVersion("Version 0.1");
Wallpaper *w = new Wallpaper;
DBusWallpaperService *dbusInter = new DBusWallpaperService(w);
Q_UNUSED(dbusInter);
QDBusConnection::sessionBus().registerService("com.deepin.dde.DreamScene");
QDBusConnection::sessionBus().registerObject("/com/deepin/dde/DreamScene", "com.deepin.dde.DreamScene", w);
QString envName("DDE_SESSION_PROCESS_COOKIE_ID");
QByteArray cookie = qgetenv(envName.toUtf8().data());
qunsetenv(envName.toUtf8().data());
if (!cookie.isEmpty()) {
QDBusInterface iface("com.deepin.SessionManager",
"/com/deepin/SessionManager",
"com.deepin.SessionManager",
QDBusConnection::sessionBus());
iface.asyncCall("Register", QString(cookie));
}
#ifdef QT_DEBUG
Settings *s = new Settings;
s->show();
#endif
}
return a.exec();
}