-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
executable file
·38 lines (29 loc) · 1.05 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
#include "mainwindow.h"
#include <QApplication>
#include <QSettings>
#include <QTranslator>
#include <QLibraryInfo>
#include <QStandardPaths>
#include <QDir>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSettings::setDefaultFormat(QSettings::IniFormat);
QApplication::setApplicationName("onsen-watch");
QSettings settings;
QString locale = settings.value("locale", QLocale::system().name()).toString();
if(locale.isEmpty())
locale = QLocale::system().name();
QDir().mkpath(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
QTranslator qtTranslator;
qtTranslator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
a.installTranslator(&qtTranslator);
QTranslator onsenTranslator;
onsenTranslator.load("onsen_" + locale);
a.installTranslator(&onsenTranslator);
a.setWindowIcon(QIcon(":/icons/onsen.png"));
a.setApplicationVersion(APP_VERSION);
MainWindow w;
w.show();
return a.exec();
}