forked from easymodo/qimgv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
executable file
·70 lines (58 loc) · 2.14 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
#include <QApplication>
#include "appversion.h"
#include "settings.h"
#include "components/actionmanager/actionmanager.h"
#include "utils/inputmap.h"
#include "utils/actions.h"
#include "sharedresources.h"
#include "core.h"
void saveSettings() {
delete settings;
}
//------------------------------------------------------------------------------
QDataStream& operator<<(QDataStream& out, const Script& v) {
out << v.command << v.blocking;
return out;
}
//------------------------------------------------------------------------------
QDataStream& operator>>(QDataStream& in, Script& v) {
in >> v.command;
in >> v.blocking;
return in;
}
int main(int argc, char *argv[]) {
// I'm not sure what this does but "1" breaks the UI
// Huge widgets but tiny fonts
qputenv("QT_AUTO_SCREEN_SCALE_FACTOR","0");
// for testing purposes
//qputenv("QT_SCALE_FACTOR","2.0");
//qputenv("QT_SCREEN_SCALE_FACTORS", "1;1.7");
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication a(argc, argv);
QCoreApplication::setOrganizationName("greenpepper software");
QCoreApplication::setOrganizationDomain("github.com/easymodo/qimgv");
QCoreApplication::setApplicationName("qimgv");
QCoreApplication::setApplicationVersion(appVersion.normalized().toString());
// needed for mpv
std::setlocale(LC_NUMERIC, "C");
qRegisterMetaTypeStreamOperators<Script>("Script");
inputMap = InputMap::getInstance();
appActions = Actions::getInstance();
settings = Settings::getInstance();
scriptManager = ScriptManager::getInstance();
actionManager = ActionManager::getInstance();
shrRes = SharedResources::getInstance();
atexit(saveSettings);
QFile file(":/res/styles/dark.qss");
if(file.open(QFile::ReadOnly)) {
QString StyleSheet = QLatin1String(file.readAll());
qApp->setStyleSheet(StyleSheet);
}
Core core;
if(a.arguments().length() > 1) {
QString fileName = a.arguments().at(1);
core.loadByPathBlocking(fileName);
}
core.showGui();
return a.exec();
}