forked from stijnherfst/HiveWE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
87 lines (73 loc) · 3.15 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
79
80
81
82
83
84
85
86
87
#include <QPalette>
#include <QCoreApplication>
#include <QApplication>
#include <QSurfaceFormat>
#include <QFont>
#include <QStyleFactory>
#include <QSettings>
#include <QFile>
#include "HiveWE.h"
#include "test.h"
#include "DockManager.h"
#ifdef WIN32
// To force HiveWE to run on the discrete GPU if available
extern "C" {
__declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
__declspec(dllexport) unsigned long NvOptimusEnablement = 1;
}
#endif
int main(int argc, char *argv[]) {
QSurfaceFormat format;
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setVersion(4, 5);
format.setProfile(QSurfaceFormat::CoreProfile);
QSurfaceFormat::setDefaultFormat(format);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QCoreApplication::setOrganizationName("HiveWE");
QCoreApplication::setApplicationName("HiveWE");
QLocale::setDefault(QLocale("en_US"));
QApplication a(argc, argv);
qApp->setStyle(QStyleFactory::create("Fusion"));
// increase font size for better reading
QFont defaultFont = QApplication::font();
defaultFont.setPointSize(defaultFont.pointSize() + 2);
qApp->setFont(defaultFont);
// modify palette to dark
QPalette darkPalette;
darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
darkPalette.setColor(QPalette::WindowText, Qt::white);
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127, 127, 127));
darkPalette.setColor(QPalette::Base, QColor(42, 42, 42));
darkPalette.setColor(QPalette::AlternateBase, QColor(66, 66, 66));
darkPalette.setColor(QPalette::ToolTipBase, Qt::white);
darkPalette.setColor(QPalette::ToolTipText, Qt::white);
darkPalette.setColor(QPalette::Text, Qt::white);
darkPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
darkPalette.setColor(QPalette::ButtonText, Qt::white);
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127, 127, 127));
darkPalette.setColor(QPalette::BrightText, Qt::red);
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
darkPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80));
darkPalette.setColor(QPalette::HighlightedText, Qt::white);
darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127));
ads::CDockManager::setConfigFlag(ads::CDockManager::FocusHighlighting);
ads::CDockManager::setConfigFlag(ads::CDockManager::AllTabsHaveCloseButton);
ads::CDockManager::setConfigFlag(ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility);
ads::CDockManager::setConfigFlag(ads::CDockManager::OpaqueSplitterResize);
qApp->setPalette(darkPalette);
QSettings settings;
if (!settings.contains("theme")) {
settings.setValue("theme", "Dark");
}
QFile file("Data/Themes/" + settings.value("theme").toString() + ".qss");
file.open(QFile::ReadOnly);
QString StyleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(StyleSheet);
HiveWE w;
return QApplication::exec();
}