forked from krogank9/WifiMouseServer
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
executable file
·37 lines (30 loc) · 933 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
#include "mainwindow.h"
#include "networkthread.h"
#include "runguard.h"
#include <QApplication>
#include <QCoreApplication>
#include <QDebug>
#include <QMessageBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
RunGuard guard("WifiMouseServer");
if( !guard.tryToRun() ) {
// QMessageBox error;
// error.setText("Another instance of WifiMouseServer is already running.");
// error.exec();
qInfo() << "Another instance of WifiMouseServer is already running.";
return 0;
}
QCoreApplication::setOrganizationName("WifiMouseAuthors");
QCoreApplication::setApplicationName("WifiMouseServer");
MainWindow w;
NetworkThread networkThread;
networkThread.mainWindow = &w;
networkThread.start();
int result = a.exec();
networkThread.requestInterruption();
networkThread.exit();
networkThread.wait(2000);
return result;
}