Commit 1edc633c authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

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
parent 57a95668
......@@ -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);
......
......@@ -64,6 +64,7 @@ private:
bool m_window;
QStringList m_stages;
QBasicTimer m_timer;
QString m_theme;
KWayland::Client::PlasmaShell *m_waylandPlasmaShell = nullptr;
......
......@@ -20,7 +20,6 @@
#include "splashwindow.h"
#include "splashapp.h"
#include <QGuiApplication>
#include <QQmlContext>
#include <QQuickItem>
#include <QKeyEvent>
......@@ -38,11 +37,12 @@
#include <KWayland/Client/plasmashell.h>
#include <KWindowSystem>
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")));
}
......
......@@ -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;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment