-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
83 lines (65 loc) · 3.54 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/*****************************************************************************
* Copyright (C) 2021 by Lorenzo Buzzi ([email protected]) *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
*****************************************************************************/
#include "lbchronorace.hpp"
#include <QApplication>
#include <QTranslator>
#include <QLocale>
#include <QFontDatabase>
#include <QWindow>
#include <QIcon>
#include <QTimer>
#ifdef Q_OS_WIN
#include <QStyleFactory>
#endif
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLocale lbcrLocale;
QTranslator qtTranslator;
QTranslator qtbaseTranslator;
QTranslator lbcrTranslator;
QString translationsDir = QCoreApplication::applicationDirPath() + QDir::separator() + QStringLiteral("translations");
if (qtTranslator.load(lbcrLocale, QStringLiteral("qt"), QStringLiteral("_"), translationsDir))
QApplication::installTranslator(&qtTranslator);
if (qtbaseTranslator.load(lbcrLocale, QStringLiteral("qtbase"), QStringLiteral("_"), translationsDir))
QApplication::installTranslator(&qtbaseTranslator);
if (lbcrTranslator.load(lbcrLocale, QStringLiteral(LBCHRONORACE_NAME), QStringLiteral("_"), QStringLiteral(":/i18n")))
QApplication::installTranslator(&lbcrTranslator);
#ifdef Q_OS_WIN
app.setStyle(QStyleFactory::create("Fusion"));
//app.setStyle(QStyleFactory::create("WindowsVista"));
#endif
QFontDatabase::addApplicationFont(":/fonts/LiberationMono-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationMono-BoldItalic.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationMono-Italic.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationMono-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSans-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSans-BoldItalic.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSans-Italic.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSans-Regular.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSerif-Bold.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSerif-BoldItalic.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSerif-Italic.ttf");
QFontDatabase::addApplicationFont(":/fonts/LiberationSerif-Regular.ttf");
LBChronoRace w(Q_NULLPTR, &app);
QTimer::singleShot(0, &w, &LBChronoRace::initialize);
w.show();
foreach (auto win, app.allWindows()) {
win->setIcon(QIcon(":/icons/LBChronoRace.ico"));
}
return QApplication::exec();
}