From 1edc633c01379f7c3b1db7386144af964a198509 Mon Sep 17 00:00:00 2001 From: Aleix Pol Date: Sat, 25 Nov 2017 02:25:43 +0100 Subject: [PATCH] Properly use QCLP to get the theme name Summary: Instead of guessing it will be the first argument, which leads to very weird behavior. Test Plan: Checked the kcm still works Played around with it Reviewers: #plasma, davidedmundson Reviewed By: #plasma, davidedmundson Subscribers: davidedmundson, plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D8993 --- ksplash/ksplashqml/splashapp.cpp | 4 +++- ksplash/ksplashqml/splashapp.h | 1 + ksplash/ksplashqml/splashwindow.cpp | 14 +++++++------- ksplash/ksplashqml/splashwindow.h | 7 ++++--- 4 files changed, 15 insertions(+), 11 deletions(-) diff --git a/ksplash/ksplashqml/splashapp.cpp b/ksplash/ksplashqml/splashapp.cpp index facf7f094..3b2b730ee 100644 --- a/ksplash/ksplashqml/splashapp.cpp +++ b/ksplash/ksplashqml/splashapp.cpp @@ -57,11 +57,13 @@ SplashApp::SplashApp(int &argc, char ** argv) parser.addOption(QCommandLineOption(QStringLiteral("window"), QStringLiteral("Run in windowed mode"))); parser.addOption(QCommandLineOption(QStringLiteral("nofork"), QStringLiteral("Don't fork"))); parser.addOption(QCommandLineOption(QStringLiteral("pid"), QStringLiteral("Print the pid of the child process"))); + parser.addPositionalArgument(QStringLiteral("theme"), QStringLiteral("Path to the theme to test")); parser.addHelpOption(); parser.process(*this); m_testing = parser.isSet(QStringLiteral("test")); m_window = parser.isSet(QStringLiteral("window")); + m_theme = parser.positionalArguments().value(0); setupWaylandIntegration(); @@ -134,7 +136,7 @@ void SplashApp::setStage(int stage) void SplashApp::adoptScreen(QScreen* screen) { - SplashWindow *w = new SplashWindow(m_testing, m_window); + SplashWindow *w = new SplashWindow(m_testing, m_window, m_theme); w->setGeometry(screen->geometry()); w->setStage(m_stage); w->setVisible(true); diff --git a/ksplash/ksplashqml/splashapp.h b/ksplash/ksplashqml/splashapp.h index ae95be7b7..1cef922aa 100644 --- a/ksplash/ksplashqml/splashapp.h +++ b/ksplash/ksplashqml/splashapp.h @@ -64,6 +64,7 @@ private: bool m_window; QStringList m_stages; QBasicTimer m_timer; + QString m_theme; KWayland::Client::PlasmaShell *m_waylandPlasmaShell = nullptr; diff --git a/ksplash/ksplashqml/splashwindow.cpp b/ksplash/ksplashqml/splashwindow.cpp index 5df357b8b..0ba65dfe2 100644 --- a/ksplash/ksplashqml/splashwindow.cpp +++ b/ksplash/ksplashqml/splashwindow.cpp @@ -20,7 +20,6 @@ #include "splashwindow.h" #include "splashapp.h" -#include #include #include #include @@ -38,11 +37,12 @@ #include #include -SplashWindow::SplashWindow(bool testing, bool window) +SplashWindow::SplashWindow(bool testing, bool window, const QString &theme) : KQuickAddons::QuickViewSharedEngine(), m_stage(0), m_testing(testing), - m_window(window) + m_window(window), + m_theme(theme) { setColor(Qt::transparent); setDefaultAlphaBuffer(true); @@ -126,13 +126,13 @@ void SplashWindow::setGeometry(const QRect& rect) const QString packageName = cg.readEntry("LookAndFeelPackage", QString()); if (!packageName.isEmpty()) { package.setPath(packageName); - }; + } - const QString theme = QGuiApplication::arguments().at(1); - if (!theme.startsWith(QLatin1String("--"))) { - package.setPath(theme); + if (!m_theme.isEmpty()) { + package.setPath(m_theme); } + Q_ASSERT(package.isValid()); setSource(QUrl::fromLocalFile(package.filePath("splashmainscript"))); } diff --git a/ksplash/ksplashqml/splashwindow.h b/ksplash/ksplashqml/splashwindow.h index 253676428..d26c8c2d0 100644 --- a/ksplash/ksplashqml/splashwindow.h +++ b/ksplash/ksplashqml/splashwindow.h @@ -37,7 +37,7 @@ class PlasmaShellSurface; class SplashWindow: public KQuickAddons::QuickViewSharedEngine { public: - SplashWindow(bool testing = false, bool window = false); + SplashWindow(bool testing, bool window, const QString &theme); void setStage(int stage); virtual void setGeometry(const QRect &rect); @@ -50,8 +50,9 @@ protected: private: void setupWaylandIntegration(); int m_stage; - bool m_testing; - bool m_window; + const bool m_testing; + const bool m_window; + const QString m_theme; KWayland::Client::PlasmaShellSurface *m_shellSurface = nullptr; };