diff --git a/README.md b/README.md index c2ca0e79..fb877f1c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Everyone can contribute with code, design, documentation or translation. Visit o # HTTPS git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git ``` -3. Download the latest __Qt 5.14__. Earlier versions are not supported! +3. Download the latest __Qt 5.13__. Earlier versions are not supported! ### Windows 1. [Download and install MSVC 2019 Community](https://visualstudio.microsoft.com/vs/community/) 2. [Download and install Win 10 SDK (debugging support. Not included via the MSVC installer)](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk) @@ -41,7 +41,7 @@ git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git 3. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer) - Install the Maintaince tool - Select the following features to install: - - Qt 5.14.0 + - Qt 5.13.0 - MSVC 2017 64-bit - Qt WebEngine - Developer and Designer Tools @@ -68,7 +68,7 @@ sudo zypper install -t pattern devel_basis 2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer) - Install the Maintaince tool - Select the following features to install: - - Qt 5.14.0 + - Qt 5.13.0 - GCC - Qt WebEngine - Developer and Designer Tools @@ -81,7 +81,7 @@ sudo zypper install -t pattern devel_basis 3. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer) - Install the Maintaince tool - Select the following features to install: - - Qt 5.14.0 + - Qt 5.13.0 - Qt WebEngine - Developer and Designer Tools - OpenSSL 1.1.1.c Toolkit diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index 1232dc80..ce22ca87 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -59,6 +59,7 @@ App::App() // Init after we have the paths from settings m_installedListModel->init(); +#if QT_VERSION > QT_VERSION_CHECK(5, 14, 0) // Set visible if the -silent parameter was not set if (QGuiApplication::instance()->arguments().contains("-silent")) { settings()->setSilentStart(true); @@ -67,5 +68,5 @@ App::App() qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this); m_mainWindowEngine = make_unique(); m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml"))); - +#endif } diff --git a/ScreenPlay/app.h b/ScreenPlay/app.h index 57215fe6..16a72c8b 100644 --- a/ScreenPlay/app.h +++ b/ScreenPlay/app.h @@ -1,7 +1,6 @@ #pragma once #include - #include #include #include @@ -10,6 +9,7 @@ #include #include #include +#include #include #include @@ -59,6 +59,13 @@ class App : public QObject { public: explicit App(); +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + static App* instance() + { + static App app; + return &app; + } +#endif GlobalVariables* globalVariables() const { return m_globalVariables.get(); @@ -211,7 +218,9 @@ public slots: } private: +#if QT_VERSION > QT_VERSION_CHECK(5, 14, 0) unique_ptr m_mainWindowEngine; +#endif unique_ptr m_create; unique_ptr m_screenPlayManager; diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 6ae04043..3405a899 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -7,7 +7,23 @@ int main(int argc, char* argv[]) QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QGuiApplication qtGuiApp(argc, argv); + +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + qmlRegisterSingletonType("ScreenPlay", 1, 0, "ScreenPlay", [](QQmlEngine* engine, QJSEngine*) -> QObject* { + engine->setObjectOwnership(App::instance(), QQmlEngine::ObjectOwnership::CppOwnership); + return App::instance(); + }); + QQmlApplicationEngine m_mainWindowEngine; + m_mainWindowEngine.load(QUrl(QStringLiteral("qrc:/main.qml"))); + + // Set visible if the -silent parameter was not set + if (QGuiApplication::instance()->arguments().contains("-silent")) { + App::instance()->settings()->setSilentStart(true); + } + +#else App app; +#endif return qtGuiApp.exec(); }