forked from wtr9987/gvtree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
78 lines (66 loc) · 2.29 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 Wolfgang Trummer */
/* Contact: [email protected] */
/* */
/* gvtree V1.8-0 */
/* */
/* git version tree browser */
/* */
/* 28. December 2021 */
/* */
/* This program is licensed under */
/* GNU GENERAL PUBLIC LICENSE */
/* Version 3, 29 June 2007 */
/* */
/* --------------------------------------------- */
#include <QtGui>
#include <QSettings>
#include "mainwindow.h"
int main(int argc, char** argv)
{
QApplication app(argc, argv);
app.setWindowIcon(QIcon(":/images/gvtree_logo_128.png"));
app.setOrganizationName("gvtree");
app.setOrganizationDomain("gvtree");
app.setApplicationName("gvtree");
// qsettings
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings settings;
// will be overwritten by -s
bool styleSheet = false;
if (settings.contains("styleSheetFile"))
{
QFile styleFile(settings.value("styleSheetFile").toString());
if (styleFile.open(QFile::ReadOnly))
{
QString style(styleFile.readAll());
app.setStyleSheet(style);
styleFile.close();
styleSheet = true;
}
}
if (styleSheet == false)
{
QFile styleFile(":/css/gvtree.css");
if (styleFile.open(QFile::ReadOnly))
{
QString style(styleFile.readAll());
app.setStyleSheet(style);
}
}
#if QT_VERSION < QT_VERSION_CHECK(5,0,0)
// Codec for git log output
if (settings.contains("codecForCStrings"))
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName(settings.value("codecForCStrings").toString().toUtf8().data()));
}
else
{
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
}
#endif
// main window
new MainWindow(QCoreApplication::arguments());
return app.exec();
}