diff --git a/ScreenPlay/inc/public/ScreenPlay/createimportvideo.h b/ScreenPlay/inc/public/ScreenPlay/createimportvideo.h index 6a22cd5b..da7cf06e 100644 --- a/ScreenPlay/inc/public/ScreenPlay/createimportvideo.h +++ b/ScreenPlay/inc/public/ScreenPlay/createimportvideo.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlay/inc/public/ScreenPlay/monitorlistmodel.h b/ScreenPlay/inc/public/ScreenPlay/monitorlistmodel.h index 58af0ccf..ed80ce6e 100644 --- a/ScreenPlay/inc/public/ScreenPlay/monitorlistmodel.h +++ b/ScreenPlay/inc/public/ScreenPlay/monitorlistmodel.h @@ -3,7 +3,7 @@ #pragma once #include -#include + #include #include #include diff --git a/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h b/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h index 04df4be3..90c698ec 100644 --- a/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h +++ b/ScreenPlay/inc/public/ScreenPlay/screenplaymanager.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlay/inc/public/ScreenPlay/sdkconnection.h b/ScreenPlay/inc/public/ScreenPlay/sdkconnection.h index f898ab7a..da04a12f 100644 --- a/ScreenPlay/inc/public/ScreenPlay/sdkconnection.h +++ b/ScreenPlay/inc/public/ScreenPlay/sdkconnection.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlay/inc/public/ScreenPlay/settings.h b/ScreenPlay/inc/public/ScreenPlay/settings.h index b73a9506..4d0388ac 100644 --- a/ScreenPlay/inc/public/ScreenPlay/settings.h +++ b/ScreenPlay/inc/public/ScreenPlay/settings.h @@ -2,7 +2,7 @@ #pragma once -#include +#include #include #include #include diff --git a/ScreenPlay/inc/public/ScreenPlay/util.h b/ScreenPlay/inc/public/ScreenPlay/util.h index 15cf3e78..654070b0 100644 --- a/ScreenPlay/inc/public/ScreenPlay/util.h +++ b/ScreenPlay/inc/public/ScreenPlay/util.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlay/src/app.cpp b/ScreenPlay/src/app.cpp index ccee8a17..8fd01055 100644 --- a/ScreenPlay/src/app.cpp +++ b/ScreenPlay/src/app.cpp @@ -10,6 +10,7 @@ #include #include #include +#include namespace ScreenPlay { @@ -132,7 +133,7 @@ App::App() /*! \brief Used for initialization after the constructor. The sole purpose is to check if another ScreenPlay instance is running and then quit early. This is also because we cannot - call QApplication::quit(); in the SDKConnector before the app.exec(); ( the Qt main event + call QGuiApplication::quit(); in the SDKConnector before the app.exec(); ( the Qt main event loop ) has started. */ void App::init() @@ -189,25 +190,25 @@ void App::init() // Init after we have the paths from settings m_installedListModel->init(); - auto* guiApplication = QGuiApplication::instance(); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); // Set visible if the -silent parameter was not set - if (guiApplication->arguments().contains("-silent")) { + if (guiAppInst->arguments().contains("-silent")) { qInfo() << "Starting in silent mode."; settings()->setSilentStart(true); } qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "App", this); - m_mainWindowEngine->addImportPath(guiApplication->applicationDirPath() + "/qml"); + m_mainWindowEngine->addImportPath(guiAppInst->applicationDirPath() + "/qml"); #if defined(Q_OS_OSX) - QDir workingDir(guiApplication->applicationDirPath()); + QDir workingDir(guiAppInst->applicationDirPath()); workingDir.cdUp(); workingDir.cdUp(); workingDir.cdUp(); // OSX Development workaround: m_mainWindowEngine->addImportPath(workingDir.path() + "/qml"); #endif - guiApplication->addLibraryPath(guiApplication->applicationDirPath() + "/qml"); + guiAppInst->addLibraryPath(guiAppInst->applicationDirPath() + "/qml"); if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { setupKDE(); @@ -227,14 +228,15 @@ QString App::version() const } /*! - \brief Calls QApplication quit() and can be used to do additional + \brief Calls QGuiApplication quit() and can be used to do additional tasks before exiting. */ void App::exit() { m_screenPlayManager->removeAllWallpapers(); m_screenPlayManager->removeAllWidgets(); - QApplication::instance()->quit(); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + guiAppInst->quit(); } bool App::isKDEInstalled() diff --git a/ScreenPlay/src/createimportvideo.cpp b/ScreenPlay/src/createimportvideo.cpp index 1447bf28..f6ff3492 100644 --- a/ScreenPlay/src/createimportvideo.cpp +++ b/ScreenPlay/src/createimportvideo.cpp @@ -2,6 +2,7 @@ #include "ScreenPlay/createimportvideo.h" #include "ScreenPlayUtil/util.h" +#include namespace ScreenPlay { @@ -61,8 +62,8 @@ void CreateImportVideo::setupFFMPEG() m_ffprobeExecutable = "ffprobe"; m_ffmpegExecutable = "ffmpeg"; #else - m_ffprobeExecutable = QApplication::applicationDirPath() + "/ffprobe" + ScreenPlayUtil::executableBinEnding(); - m_ffmpegExecutable = QApplication::applicationDirPath() + "/ffmpeg" + ScreenPlayUtil::executableBinEnding(); + m_ffprobeExecutable = QGuiApplication::applicationDirPath() + "/ffprobe" + ScreenPlayUtil::executableBinEnding(); + m_ffmpegExecutable = QGuiApplication::applicationDirPath() + "/ffmpeg" + ScreenPlayUtil::executableBinEnding(); #endif if (!QFileInfo::exists(m_ffprobeExecutable)) { @@ -732,7 +733,7 @@ QString CreateImportVideo::waitForFinished( m_process->setProcessChannelMode(processChannelMode); m_process->setArguments(args); - m_process->setWorkingDirectory(QApplication::applicationDirPath()); + m_process->setWorkingDirectory(QGuiApplication::applicationDirPath()); m_process->start(); qInfo() << m_process->workingDirectory() << m_process->program() << m_process->arguments(); diff --git a/ScreenPlay/src/monitorlistmodel.cpp b/ScreenPlay/src/monitorlistmodel.cpp index d1c2e58c..7a01d428 100644 --- a/ScreenPlay/src/monitorlistmodel.cpp +++ b/ScreenPlay/src/monitorlistmodel.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "ScreenPlay/monitorlistmodel.h" - +#include namespace ScreenPlay { /*! @@ -27,9 +27,9 @@ MonitorListModel::MonitorListModel(QObject* parent) { loadMonitors(); - auto* guiAppInst = dynamic_cast(QApplication::instance()); - connect(guiAppInst, &QApplication::screenAdded, this, &MonitorListModel::screenAdded); - connect(guiAppInst, &QApplication::screenRemoved, this, &MonitorListModel::screenRemoved); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + connect(guiAppInst, &QGuiApplication::screenAdded, this, &MonitorListModel::screenAdded); + connect(guiAppInst, &QGuiApplication::screenRemoved, this, &MonitorListModel::screenRemoved); } /*! @@ -148,8 +148,8 @@ void MonitorListModel::loadMonitors() int offsetX = 0; int offsetY = 0; - for (int i = 0; i < QApplication::screens().count(); i++) { - QScreen* screen = QApplication::screens().at(i); + for (int i = 0; i < QGuiApplication::screens().count(); i++) { + QScreen* screen = QGuiApplication::screens().at(i); if (screen->availableGeometry().x() < 0) { offsetX += (screen->availableGeometry().x() * -1); } @@ -158,8 +158,8 @@ void MonitorListModel::loadMonitors() } } - for (int i = 0; i < QApplication::screens().count(); i++) { - QScreen* screen = QApplication::screens().at(i); + for (int i = 0; i < QGuiApplication::screens().count(); i++) { + QScreen* screen = QGuiApplication::screens().at(i); // Sometimes we get invalid monitors on Windows. I don't know why... if (screen->geometry().width() == 0 || screen->geometry().height() == 0) @@ -222,8 +222,8 @@ void MonitorListModel::closeWallpaper(const QString& appID) */ QRect MonitorListModel::absoluteDesktopSize() const { - auto* app = static_cast(QGuiApplication::instance()); - return app->screens().at(0)->availableVirtualGeometry(); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + return guiAppInst->screens().at(0)->availableVirtualGeometry(); } /*! diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index 7b52ab28..78b5165b 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -1,10 +1,9 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "ScreenPlay/screenplaymanager.h" +#include "ScreenPlay/util.h" + #include - -#include "util.h" - namespace ScreenPlay { /*! diff --git a/ScreenPlay/src/settings.cpp b/ScreenPlay/src/settings.cpp index 21096788..4f617bcf 100644 --- a/ScreenPlay/src/settings.cpp +++ b/ScreenPlay/src/settings.cpp @@ -241,7 +241,7 @@ void Settings::initInstalledPath() */ void Settings::initSteamInstalledPath() { - QString appBasePath = QApplication::instance()->applicationDirPath(); + QString appBasePath = QGuiApplication::instance()->applicationDirPath(); if (desktopEnvironment() == DesktopEnvironment::OSX) { appBasePath += "/../../.."; } @@ -293,14 +293,14 @@ bool Settings::retranslateUI() QString langCode = fixLanguageCode(QVariant::fromValue(language()).toString()); QFile tsFile; - const QString qmPath = QApplication::applicationDirPath() + "/translations/ScreenPlay_" + langCode + ".qm"; + const QString qmPath = QGuiApplication::applicationDirPath() + "/translations/ScreenPlay_" + langCode + ".qm"; if (tsFile.exists(qmPath)) { if (!m_translator.load(qmPath)) { qWarning() << "Unable to load translation file: " << qmPath; return false; } - auto* app = static_cast(QApplication::instance()); - app->installTranslator(&m_translator); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + guiAppInst->installTranslator(&m_translator); emit requestRetranslation(); if (language() == Settings::Language::Ko_KR) { diff --git a/ScreenPlay/src/util.cpp b/ScreenPlay/src/util.cpp index a435b0b6..f264c94c 100644 --- a/ScreenPlay/src/util.cpp +++ b/ScreenPlay/src/util.cpp @@ -4,7 +4,9 @@ #include "qarchive_enums.hpp" #include "qarchivediskcompressor.hpp" #include "qarchivediskextractor.hpp" + #include +#include #if defined(Q_OS_WIN) #include @@ -26,7 +28,8 @@ Util::Util() { // Fix log access vilation on quit utilPointer = this; - QObject::connect(QGuiApplication::instance(), &QGuiApplication::aboutToQuit, this, []() { utilPointer = nullptr; }); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + QObject::connect(guiAppInst, &QGuiApplication::aboutToQuit, this, []() { utilPointer = nullptr; }); m_extractor = std::make_unique(); m_compressor = std::make_unique(); @@ -58,7 +61,7 @@ Util::~Util() { } */ void Util::copyToClipboard(const QString& text) const { - auto* clipboard = QApplication::clipboard(); + auto* clipboard = QGuiApplication::clipboard(); clipboard->setText(text); } diff --git a/ScreenPlay/tests/tst_main.cpp b/ScreenPlay/tests/tst_main.cpp index 5fb4e6ad..e60d9def 100644 --- a/ScreenPlay/tests/tst_main.cpp +++ b/ScreenPlay/tests/tst_main.cpp @@ -2,7 +2,7 @@ #include "ScreenPlay/app.h" #include "ScreenPlay/create.h" -#include + #include #include #include diff --git a/ScreenPlayWallpaper/main.cpp b/ScreenPlayWallpaper/main.cpp index 4f70cada..3515a322 100644 --- a/ScreenPlayWallpaper/main.cpp +++ b/ScreenPlayWallpaper/main.cpp @@ -1,9 +1,10 @@ -#include + #include #include #include #include #include +#include #include "ScreenPlayUtil/exitcodes.h" #include "ScreenPlayUtil/util.h" @@ -23,13 +24,13 @@ int main(int argc, char* argv[]) { #if !defined(Q_OS_LINUX) - qputenv("QT_MEDIA_BACKEND", "ffmpeg"); + qputenv("QT_MEDIA_BACKEND", "windows"); #endif - QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); + QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts); QtWebEngineQuick::initialize(); - QApplication app(argc, argv); + QGuiApplication app(argc, argv); #if defined(Q_OS_WIN) WinWindow window; @@ -46,8 +47,8 @@ int main(int argc, char* argv[]) // For testing purposes when starting the ScreenPlayWallpaper directly. if (argumentList.length() == 1) { window.setActiveScreensList({ 0 }); - window.setProjectPath("test"); - // window.setProjectPath("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/19112022140605-Horde 1980"); + //window.setProjectPath("test"); + window.setProjectPath("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/particles"); window.setAppID("test"); window.setVolume(1); window.setFillMode("fill"); diff --git a/ScreenPlayWallpaper/src/MacBridge.mm b/ScreenPlayWallpaper/src/MacBridge.mm index 11187e03..89f259e6 100644 --- a/ScreenPlayWallpaper/src/MacBridge.mm +++ b/ScreenPlayWallpaper/src/MacBridge.mm @@ -2,7 +2,7 @@ #include "macbridge.h" #import -#include + #include #import diff --git a/ScreenPlayWallpaper/src/basewindow.cpp b/ScreenPlayWallpaper/src/basewindow.cpp index 6f93642b..7295ff65 100644 --- a/ScreenPlayWallpaper/src/basewindow.cpp +++ b/ScreenPlayWallpaper/src/basewindow.cpp @@ -4,6 +4,9 @@ #include "ScreenPlayUtil/projectfile.h" #include "ScreenPlayUtil/util.h" +#include + + /*! \module ScreenPlayWallpaper \title ScreenPlayWallpaper @@ -18,7 +21,7 @@ BaseWindow::BaseWindow() { - QApplication::instance()->installEventFilter(this); + QGuiApplication::instance()->installEventFilter(this); qRegisterMetaType(); qmlRegisterUncreatableMetaObject(ScreenPlay::InstalledType::staticMetaObject, @@ -196,7 +199,7 @@ QString BaseWindow::loadFromFile(const QString& filename) */ QString BaseWindow::getApplicationPath() { - return QApplication::applicationDirPath(); + return QGuiApplication::applicationDirPath(); } /*! diff --git a/ScreenPlayWallpaper/src/basewindow.h b/ScreenPlayWallpaper/src/basewindow.h index 5d7fa842..e701f76e 100644 --- a/ScreenPlayWallpaper/src/basewindow.h +++ b/ScreenPlayWallpaper/src/basewindow.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlayWallpaper/src/linuxx11window.cpp b/ScreenPlayWallpaper/src/linuxx11window.cpp index 7005db69..a7c586ad 100644 --- a/ScreenPlayWallpaper/src/linuxx11window.cpp +++ b/ScreenPlayWallpaper/src/linuxx11window.cpp @@ -16,6 +16,8 @@ #include #include +#include + #define WIDTH 512 #define HEIGHT 384 #define OPAQUE 0xffffffff diff --git a/ScreenPlayWallpaper/src/linuxx11window.h b/ScreenPlayWallpaper/src/linuxx11window.h index 7f6e0860..25261e51 100644 --- a/ScreenPlayWallpaper/src/linuxx11window.h +++ b/ScreenPlayWallpaper/src/linuxx11window.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlayWallpaper/src/macbridge.h b/ScreenPlayWallpaper/src/macbridge.h index 39514db7..c2b3d03b 100644 --- a/ScreenPlayWallpaper/src/macbridge.h +++ b/ScreenPlayWallpaper/src/macbridge.h @@ -2,7 +2,7 @@ #pragma once -#include + class MacBridge : public QObject { Q_OBJECT diff --git a/ScreenPlayWallpaper/src/macintegration.h b/ScreenPlayWallpaper/src/macintegration.h index 8775630b..44e1fc56 100644 --- a/ScreenPlayWallpaper/src/macintegration.h +++ b/ScreenPlayWallpaper/src/macintegration.h @@ -2,7 +2,7 @@ #pragma once -#include + class MacIntegration : public QObject { Q_OBJECT diff --git a/ScreenPlayWallpaper/src/macwindow.cpp b/ScreenPlayWallpaper/src/macwindow.cpp index 9b1ed75c..8c8ff0b3 100644 --- a/ScreenPlayWallpaper/src/macwindow.cpp +++ b/ScreenPlayWallpaper/src/macwindow.cpp @@ -1,6 +1,8 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "macwindow.h" +#include + ScreenPlay::WallpaperExitCode MacWindow::start() { auto* screen = QGuiApplication::screens().at(activeScreensList().at(0)); diff --git a/ScreenPlayWallpaper/src/macwindow.h b/ScreenPlayWallpaper/src/macwindow.h index 0000a556..05b9f073 100644 --- a/ScreenPlayWallpaper/src/macwindow.h +++ b/ScreenPlayWallpaper/src/macwindow.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlayWallpaper/src/winwindow.cpp b/ScreenPlayWallpaper/src/winwindow.cpp index b203ce64..2a9bce8f 100644 --- a/ScreenPlayWallpaper/src/winwindow.cpp +++ b/ScreenPlayWallpaper/src/winwindow.cpp @@ -1,7 +1,8 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only -#include "winwindow.h" #include "ScreenPlayUtil/projectfile.h" -#include "qqml.h" +#include "winwindow.h" +#include +#include #include #include #include @@ -77,15 +78,15 @@ LRESULT __stdcall MouseHookCallback(int nCode, WPARAM wParam, LPARAM lParam) auto event = QMouseEvent(type, g_LastMousePosition, mouseButton, mouseButtons, keyboardModifier); - QApplication::sendEvent(g_winGlobalHook, &event); + QGuiApplication::sendEvent(g_winGlobalHook, &event); if (type == QMouseEvent::Type::MouseButtonPress) { } QTimer::singleShot(100, [&]() { // auto eventPress = QMouseEvent(QMouseEvent::Type::MouseButtonPress, g_LastMousePosition, mouseButton, mouseButtons, {}); - // qInfo() << mouseButton << QApplication::sendEvent(g_winGlobalHook, &eventPress) << g_globalOffset.x() << g_globalOffset.y(); + // qInfo() << mouseButton << QGuiApplication::sendEvent(g_winGlobalHook, &eventPress) << g_globalOffset.x() << g_globalOffset.y(); auto eventRelease = QMouseEvent(QMouseEvent::Type::MouseButtonRelease, g_LastMousePosition, mouseButton, mouseButtons, {}); - QApplication::sendEvent(g_winGlobalHook, &eventRelease); + QGuiApplication::sendEvent(g_winGlobalHook, &eventRelease); }); return CallNextHookEx(g_mouseHook, nCode, wParam, lParam); @@ -120,17 +121,17 @@ ScreenPlay::WallpaperExitCode WinWindow::start() } }, Qt::QueuedConnection); - auto* guiAppInst = dynamic_cast(QApplication::instance()); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); if (!debugMode()) { connect(m_sdk.get(), &ScreenPlaySDK::sdkDisconnected, this, &WinWindow::destroyThis); } - connect(guiAppInst, &QApplication::screenAdded, this, &WinWindow::configureWindowGeometry); - connect(guiAppInst, &QApplication::screenRemoved, this, &WinWindow::configureWindowGeometry); - connect(guiAppInst, &QApplication::primaryScreenChanged, this, &WinWindow::configureWindowGeometry); + connect(guiAppInst, &QGuiApplication::screenAdded, this, &WinWindow::configureWindowGeometry); + connect(guiAppInst, &QGuiApplication::screenRemoved, this, &WinWindow::configureWindowGeometry); + connect(guiAppInst, &QGuiApplication::primaryScreenChanged, this, &WinWindow::configureWindowGeometry); connect(this, &BaseWindow::reloadQML, this, &WinWindow::clearComponentCache); connect(&m_checkForFullScreenWindowTimer, &QTimer::timeout, this, &WinWindow::checkForFullScreenWindow); - const auto screens = QApplication::screens(); + const auto screens = QGuiApplication::screens(); for (const auto& screen : screens) { connect(screen, &QScreen::geometryChanged, this, &WinWindow::configureWindowGeometry); } @@ -209,7 +210,7 @@ BOOL CALLBACK GetMonitorByIndex(HMONITOR hMonitor, HDC hdcMonitor, LPRECT lprcMo void WinWindow::setupWallpaperForOneScreen(int activeScreen) { - const QRect screenRect = QApplication::screens().at(activeScreen)->geometry(); + const QRect screenRect = QGuiApplication::screens().at(activeScreen)->geometry(); const int boderWidth = 2; const float scaling = getScaling(activeScreen); const int borderOffset = -1; @@ -291,7 +292,7 @@ void WinWindow::setupWallpaperForMultipleScreens(const QVector& activeScree QScreen* upperLeftScreen { nullptr }; // Check for the upper left screen first so we get x and y positions for (const int screen : activeScreensList) { - QScreen* screenTmp = QApplication::screens().at(screen); + QScreen* screenTmp = QGuiApplication::screens().at(screen); if (upperLeftScreen != nullptr) { if (screenTmp->geometry().x() < upperLeftScreen->geometry().x() || screenTmp->geometry().y() < upperLeftScreen->geometry().y()) { upperLeftScreen = screenTmp; @@ -338,7 +339,7 @@ bool WinWindow::searchWorkerWindowToParentTo() */ float WinWindow::getScaling(const int monitorIndex) { - QScreen* screen = QApplication::screens().at(monitorIndex); + QScreen* screen = QGuiApplication::screens().at(monitorIndex); const int factor = screen->physicalDotsPerInch(); switch (factor) { case 72: @@ -359,7 +360,7 @@ float WinWindow::getScaling(const int monitorIndex) */ bool WinWindow::hasWindowScaling() { - const auto screens = QApplication::screens(); + const auto screens = QGuiApplication::screens(); for (int i = 0; i < screens.count(); i++) { if (getScaling(i) != 1) { return true; @@ -394,7 +395,7 @@ void WinWindow::configureWindowGeometry() SetWindowLongPtr(m_windowHandle, GWL_STYLE, WS_POPUPWINDOW); // Ether for one Screen or for all - if ((QApplication::screens().length() == activeScreensList().length()) && (activeScreensList().length() != 1)) { + if ((QGuiApplication::screens().length() == activeScreensList().length()) && (activeScreensList().length() != 1)) { setupWallpaperForAllScreens(); } else if (activeScreensList().length() == 1) { setupWallpaperForOneScreen(activeScreensList().at(0)); @@ -494,7 +495,7 @@ void WinWindow::terminate() ShowWindow(m_windowHandleWorker, SW_HIDE); ShowWindow(m_windowHandleWorker, SW_SHOW); - QApplication::quit(); + QGuiApplication::quit(); } /*! diff --git a/ScreenPlayWallpaper/src/winwindow.h b/ScreenPlayWallpaper/src/winwindow.h index 01e577b6..e5035a77 100644 --- a/ScreenPlayWallpaper/src/winwindow.h +++ b/ScreenPlayWallpaper/src/winwindow.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include diff --git a/ScreenPlayWidget/main.cpp b/ScreenPlayWidget/main.cpp index 05dd8f96..8469bc14 100644 --- a/ScreenPlayWidget/main.cpp +++ b/ScreenPlayWidget/main.cpp @@ -1,8 +1,9 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only -#include + #include #include #include +#include #include "src/widgetwindow.h" @@ -20,9 +21,9 @@ int main(int argc, char* argv[]) #endif QtWebEngineQuick::initialize(); - QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); + QGuiApplication::setAttribute(Qt::AA_ShareOpenGLContexts); - QApplication app(argc, argv); + QGuiApplication app(argc, argv); const QStringList argumentList = app.arguments(); diff --git a/ScreenPlayWidget/src/widgetwindow.cpp b/ScreenPlayWidget/src/widgetwindow.cpp index bf7b9bb6..0b3ec2fb 100644 --- a/ScreenPlayWidget/src/widgetwindow.cpp +++ b/ScreenPlayWidget/src/widgetwindow.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: LicenseRef-EliasSteurerTachiom OR AGPL-3.0-only #include "widgetwindow.h" -#include +#include #include #include "ScreenPlayUtil/contenttypes.h" @@ -76,8 +76,8 @@ WidgetWindow::WidgetWindow( qWarning() << "Cannot parse Wallpaper type from value" << m_project.value("type"); } } - - m_window.engine()->addImportPath(qGuiApp->applicationDirPath() + "/qml"); + auto* guiAppInst = dynamic_cast(QGuiApplication::instance()); + m_window.engine()->addImportPath(guiAppInst->applicationDirPath() + "/qml"); m_window.setTextRenderType(QQuickWindow::TextRenderType::NativeTextRendering); m_window.setResizeMode(QQuickView::ResizeMode::SizeViewToRootObject); m_window.setSource(QUrl("qrc:/qml/ScreenPlayWidget/qml/Widget.qml")); diff --git a/ScreenPlayWidget/src/widgetwindow.h b/ScreenPlayWidget/src/widgetwindow.h index 39c0ff78..fd6385c6 100644 --- a/ScreenPlayWidget/src/widgetwindow.h +++ b/ScreenPlayWidget/src/widgetwindow.h @@ -2,7 +2,7 @@ #pragma once -#include + #include #include #include