-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.cpp
44 lines (38 loc) · 1.14 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
#ifdef WIN32
#include <windows.h>
#endif
#include <QApplication>
#include "window.h"
#include <QString>
#include <QWindow>
#include "upload_list.h"
int main(int argc, char *argv[])
{
//AllocConsole();
SingleApplication app(argc, argv, true);
QCoreApplication::setOrganizationName("RGhost");
QCoreApplication::setOrganizationDomain("rghost.net");
QCoreApplication::setApplicationName("RGhost Uploader");
QCoreApplication::setApplicationVersion(VERSION);
if( app.isSecondary() ) {
qInfo() << "Already started, waking up the primary process";
#ifdef WIN32
AllowSetForegroundWindow(DWORD(app.primaryPid()));
#endif
app.sendMessage("\n"); // wake up even if no args given
for(int i = 1; i < app.arguments().size(); ++i) {
app.sendMessage(app.arguments().at(i).toUtf8());
app.sendMessage("\n");
}
return 0;
} else {
Window::instance().show();
QObject::connect(
&app,
&SingleApplication::receivedMessage,
&Window::instance(),
&Window::receivedMessage
);
}
return app.exec();
}