forked from omniedgeio/omniedge-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
49 lines (41 loc) · 1.21 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 "traymenu.h"
#include "api.h"
#include <QApplication>
#include <QSettings>
#include <QTranslator>
#include "menucontroller.h"
#include "syslog.h"
#include "runguard.h"
int main(int argc, char *argv[])
{
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication app(argc, argv);
app.setQuitOnLastWindowClosed(false);
//load default languge by system language
QString locale = QLocale::system().name();
qDebug() << locale;
QTranslator translator;
if(locale.compare("zh_CN") ==0)
{
translator.load(qApp->applicationDirPath()+QString("/languages/zh_CN.qm"));
}
else
{
translator.load(qApp->applicationDirPath()+QString("/languages/en_US.qm"));
}
app.installTranslator(&translator);
//single instance
RunGuard guard( "Omniedge_Desktop_Client" );
if ( !guard.tryToRun() )
return 0;
#ifdef QT_NO_DEBUG
syslog hlog;
hlog.installReleaseMsgHandler();
#endif
// Setting for QSetting
QCoreApplication::setOrganizationName("Omniedge");
QCoreApplication::setOrganizationDomain("omniedge.io");
QCoreApplication::setApplicationName("Omniedge Desktop Client");
TrayMenu menu;
return app.exec();
}