diff --git a/ksplash/ksplashqml/splashapp.h b/ksplash/ksplashqml/splashapp.h --- a/ksplash/ksplashqml/splashapp.h +++ b/ksplash/ksplashqml/splashapp.h @@ -64,6 +64,7 @@ bool m_window; QStringList m_stages; QBasicTimer m_timer; + QString m_theme; KWayland::Client::PlasmaShell *m_waylandPlasmaShell = nullptr; diff --git a/ksplash/ksplashqml/splashapp.cpp b/ksplash/ksplashqml/splashapp.cpp --- a/ksplash/ksplashqml/splashapp.cpp +++ b/ksplash/ksplashqml/splashapp.cpp @@ -57,11 +57,13 @@ 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::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/splashwindow.h b/ksplash/ksplashqml/splashwindow.h --- a/ksplash/ksplashqml/splashwindow.h +++ b/ksplash/ksplashqml/splashwindow.h @@ -37,7 +37,7 @@ 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 @@ 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; }; diff --git a/ksplash/ksplashqml/splashwindow.cpp b/ksplash/ksplashqml/splashwindow.cpp --- 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 @@ 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"))); }