-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
68 lines (60 loc) · 2.17 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
// © Copyright (c) 2018 SqYtCO
#include "graphiccore.h"
#include "mainwindow.h"
#include <QApplication>
#include <QStyleFactory>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// load application icon
app.setWindowIcon(QIcon(":/images/"));
// set application name
app.setApplicationDisplayName("Nagel-Schreckenberg");
// set best available application style (Breeze > Oxygen > Fusion > Windows)
if(QStyleFactory::keys().contains("Breeze"))
{
qDebug("Theme: Breeze");
app.setStyle(QStyleFactory::create("Breeze"));
}
else if(QStyleFactory::keys().contains("Oxygen"))
{
qDebug("Theme: Oxygen");
app.setStyle(QStyleFactory::create("Oxygen"));
}
else if(QStyleFactory::keys().contains("Fusion"))
{
qDebug("Theme: Fusion");
app.setStyle(QStyleFactory::create("Fusion"));
// in Fusion style buttons are too small
app.setStyleSheet("QToolButton { height: 1.5em; }");
}
else if(QStyleFactory::keys().contains("Windows"))
{
qDebug("Theme: Windows");
app.setStyle(QStyleFactory::create("Windows"));
}
// set all (dark) colors
QPalette dark_palette;
dark_palette.setColor(QPalette::Window, QColor(0x30, 0x30, 0x30));
dark_palette.setColor(QPalette::WindowText, Qt::white);
dark_palette.setColor(QPalette::Base, QColor(0x10, 0x10, 0x10));
dark_palette.setColor(QPalette::AlternateBase, QColor(0xF0, 0xF0, 0xF0));
dark_palette.setColor(QPalette::ToolTipBase, Qt::black);
dark_palette.setColor(QPalette::ToolTipText, Qt::white);
dark_palette.setColor(QPalette::Text, Qt::white);
dark_palette.setColor(QPalette::Button, QColor(0x10, 0x10, 0x10));
dark_palette.setColor(QPalette::ButtonText, Qt::white);
dark_palette.setColor(QPalette::BrightText, Qt::white);
dark_palette.setColor(QPalette::Link, QColor(0x00, 0x10, 0xFF));
dark_palette.setColor(QPalette::Highlight, QColor(0xF0, 0xF0, 0xF0));
dark_palette.setColor(QPalette::HighlightedText, Qt::black);
// set default palette in application
app.setPalette(dark_palette);
GraphicCore::init();
// if more than 1 argument is given, pass last argument as start_file
MainWindow win((argc > 1) ? argv[argc - 1] : nullptr);
// display window
win.show();
// application event loop
return app.exec();
}