-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
49 lines (44 loc) · 960 Bytes
/
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 "mainwindow.h"
#include "controller_window.h"
#include "qtrc_dbus.h"
#include <QApplication>
#include <QtDBus/QtDBus>
#include <QTimer>
#include <cstdio>
#include <global.h>
#define ARG_FLAG(val,flag) if(strcmp(argv[i],val)==0) { flag = true; }
int main(int argc, char *argv[])
{
bool bStop = false;
bool bShow = false;
for(int i = 1; i < argc; i++)
{
ARG_FLAG("--exit",bStop) ;
ARG_FLAG("--show",bShow) ;
}
QDBusInterface qdbi("net.mew151.qtrc","/","net.mew151.qtrc");
QDBusMessage reply;
if(bStop)
{
reply = qdbi.call("Stop");
}
else if(bShow)
{
reply = qdbi.call("Show");
}
else
{
reply = qdbi.call("Reconfigure");
}
if((reply.type() == QDBusMessage::ReplyMessage))
{
return 0;
}
QApplication a(argc, argv);
controller_window win;
new qtrc_dbus(&win);
QDBusConnection::sessionBus().registerObject("/",&win);
QDBusConnection::sessionBus().registerService("net.mew151.qtrc");
win.show();
return a.exec();
}