|
@@ -15,6 +15,7 @@
|
|
|
#include "breakpad/CrashDumps.h"
|
|
|
#include "Version.h"
|
|
|
#include "settings/SettingsComponent.h"
|
|
|
+#include "settings/SettingsSection.h"
|
|
|
#include "ui/KonvergoWindow.h"
|
|
|
#include "ui/KonvergoEngine.h"
|
|
|
#include "UniqueApplication.h"
|
|
@@ -27,13 +28,33 @@
|
|
|
using namespace QsLogging;
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
-void initQt(QGuiApplication* app)
|
|
|
+static void preinitQt()
|
|
|
{
|
|
|
QCoreApplication::setApplicationName(Names::MainName());
|
|
|
QCoreApplication::setApplicationVersion(Version::GetVersionString());
|
|
|
QCoreApplication::setOrganizationDomain("plex.tv");
|
|
|
|
|
|
- app->setWindowIcon(QIcon(":/images/icon.png"));
|
|
|
+#ifdef Q_OS_WIN32
|
|
|
+ if (QFile::exists(Paths::dataDir("use_opengl")))
|
|
|
+ QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
|
|
+ else
|
|
|
+ QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
|
|
|
+#endif
|
|
|
+}
|
|
|
+
|
|
|
+/////////////////////////////////////////////////////////////////////////////////////////
|
|
|
+static void updateGL(const QVariantMap& values)
|
|
|
+{
|
|
|
+#ifdef Q_OS_WIN32
|
|
|
+ QString path = Paths::dataDir("use_opengl");
|
|
|
+ if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "useOpenGL").toBool())
|
|
|
+ {
|
|
|
+ QFile f(path);
|
|
|
+ f.open(QIODevice::WriteOnly);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ QFile::remove(path);
|
|
|
+#endif
|
|
|
}
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -199,8 +220,9 @@ int main(int argc, char *argv[])
|
|
|
QSurfaceFormat::setDefaultFormat(format);
|
|
|
#endif
|
|
|
|
|
|
+ preinitQt();
|
|
|
QGuiApplication app(newArgc, newArgv);
|
|
|
- initQt(&app);
|
|
|
+ app.setWindowIcon(QIcon(":/images/icon.png"));
|
|
|
|
|
|
// init breakpad.
|
|
|
setupCrashDumper();
|
|
@@ -240,6 +262,11 @@ int main(int argc, char *argv[])
|
|
|
//
|
|
|
ComponentManager::Get().initialize();
|
|
|
|
|
|
+ auto mainSection = SettingsComponent::Get().getSection("main");
|
|
|
+ if (mainSection)
|
|
|
+ QObject::connect(mainSection, &SettingsSection::valuesUpdated, &updateGL);
|
|
|
+ updateGL(QVariantMap{});
|
|
|
+
|
|
|
// enable remote inspection if we have the correct setting for it.
|
|
|
if (SettingsComponent::Get().value(SETTINGS_SECTION_MAIN, "remoteInspector").toBool())
|
|
|
qputenv("QTWEBENGINE_REMOTE_DEBUGGING", "0.0.0.0:9992");
|