forked from giowck/symphytum
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·56 lines (44 loc) · 1.8 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
50
51
52
53
54
55
56
/*
* Copyright (c) 2012 Giorgio Wicklein <[email protected]>
*/
//-----------------------------------------------------------------------------
// Hearders
//-----------------------------------------------------------------------------
#include "widgets/mainwindow.h"
#include "utils/definitionholder.h"
#include "utils/qtsingleapplication/qtsingleapplication.h"
#include <QtCore/QTranslator>
#include <QtCore/QLocale>
//-----------------------------------------------------------------------------
// Main
//-----------------------------------------------------------------------------
int main(int argc, char *argv[])
{
//enable high DPI scaling on Windows and Linux
//NOTE: don't move, must be called before QApplication initialization
//or it won't work at all
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QtSingleApplication symphytumApp(argc, argv);
symphytumApp.setApplicationName(DefinitionHolder::NAME);
symphytumApp.setApplicationVersion(DefinitionHolder::VERSION);
symphytumApp.setOrganizationName(DefinitionHolder::COMPANY);
symphytumApp.setOrganizationDomain(DefinitionHolder::DOMAIN_NAME);
symphytumApp.setWindowIcon(QIcon(":/images/icons/symphytum.png"));
//only one instance allowed
if (symphytumApp.sendMessage("Wake up!"))
return 0;
//setup translations
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(),
":/languages");
symphytumApp.installTranslator(&qtTranslator);
QTranslator myappTranslator;
myappTranslator.load("symphytum_" + QLocale::system().name(), ":/languages");
symphytumApp.installTranslator(&myappTranslator);
//init gui
MainWindow w;
w.show();
//wake up window
symphytumApp.setActivationWindow(&w);
return symphytumApp.exec();
}