-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
69 lines (55 loc) · 2.31 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
#include "mainwindow.h"
#include "DarkStyle.h"
#include "framelesswindow/framelesswindow.h"
#include <QApplication>
#include <QLocale>
#include <QTranslator>
#include <QtWebEngineCore>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
#ifdef __linux__
a.setWindowIcon(QIcon(":/images/france-tv-2.svg"));
#elif _WIN32
a.setWindowIcon(QIcon("./images/france-tv-2.ico"));
#elif __APPLE__
a.setWindowIcon(QIcon("./images/france-tv-2.icns"));
#endif
// style our application with custom dark style
QApplication::setStyle(new DarkStyle);
// create frameless window (and set windowState or title)
FramelessWindow framelessWindow;
//framelessWindow.setWindowState(Qt::WindowFullScreen);
//framelessWindow.setWindowTitle("test title");
//framelessWindow.setWindowIcon(QIcon("../images/france-tv.ico"));
#ifdef __linux__
framelessWindow.setWindowIcon(QIcon(":/images/france-tv-2.ico"));
#elif _WIN32
framelessWindow.setWindowIcon(QIcon("./france-tv-2.ico"));
#elif __APPLE__
framelessWindow.setWindowIcon(QIcon(":/images/france-tv-2.icns"));
#endif
QTranslator translator;
const QStringList uiLanguages = QLocale::system().uiLanguages();
for (const QString &locale : uiLanguages) {
const QString baseName = "FranceTV_" + QLocale(locale).name();
if (translator.load(":/i18n/" + baseName)) {
a.installTranslator(&translator);
break;
}
}
QCoreApplication::setOrganizationName("Paul_WOISARD");
QCoreApplication::setOrganizationDomain("https://github.com/Paullux/");
QCoreApplication::setApplicationName("FranceTV");
qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--blink-settings=forceDarkModeEnabled=true,darkModeInversionAlgorithm=4 --proprietary-codecs --disable-logging");
QLoggingCategory::setFilterRules("*qt.webenginecontext=false\n"
"*js=false");
// create our mainwindow instance
MainWindow *w = new MainWindow;
QObject::connect(&framelessWindow, &FramelessWindow::accueil, w, &MainWindow::accueil);
QObject::connect(&framelessWindow, &FramelessWindow::sliderZoomValue, w, &MainWindow::changeZoomScaled);
// add the mainwindow to our custom frameless window
framelessWindow.setContent(w);
framelessWindow.showMaximized();
return a.exec();
}