From b32a42c8e83c729ffc738c8f8c178ccbb22b7de3 Mon Sep 17 00:00:00 2001 From: Marco Martin Date: Mon, 2 Sep 2013 18:04:22 +0200 Subject: [PATCH] Corona::setPackage(QString) uses a Package * symmetrical api in Corona * there is no default package --- src/plasma/corona.cpp | 6 ++--- src/plasma/corona.h | 2 +- .../qmlpackages/desktop/contents/loader.qml | 23 ------------------- src/shell/shellcorona.cpp | 16 +++++++++---- src/shell/view.cpp | 2 ++ 5 files changed, 17 insertions(+), 32 deletions(-) diff --git a/src/plasma/corona.cpp b/src/plasma/corona.cpp index cd9fa1b19..f9a3f9c76 100644 --- a/src/plasma/corona.cpp +++ b/src/plasma/corona.cpp @@ -70,9 +70,9 @@ Plasma::Package Corona::package() const return d->package; } -void Corona::setPackage(const QString & package) +void Corona::setPackage(const Plasma::Package &package) { - d->package.setPath(package); + d->package = package; } void Corona::saveLayout(const QString &configName) const @@ -291,8 +291,6 @@ CoronaPrivate::CoronaPrivate(Corona *corona) { //TODO: make Package path configurable KConfigGroup config(KSharedConfig::openConfig(), "General"); - package = Plasma::PluginLoader::self()->loadPackage("Plasma/Shell"); - package.setPath(config.readEntry("shell", "org.kde.desktop")); if (QCoreApplication::instance()) { configName = QCoreApplication::instance()->applicationName() + "-appletsrc"; diff --git a/src/plasma/corona.h b/src/plasma/corona.h index 57c0861c5..7176c1b9f 100644 --- a/src/plasma/corona.h +++ b/src/plasma/corona.h @@ -61,7 +61,7 @@ public: /** * Setting the package name */ - void setPackage(const QString & package); + void setPackage(const Plasma::Package &package); /** * @return all containments on this Corona diff --git a/src/shell/qmlpackages/desktop/contents/loader.qml b/src/shell/qmlpackages/desktop/contents/loader.qml index dc2fc67de..74b829509 100644 --- a/src/shell/qmlpackages/desktop/contents/loader.qml +++ b/src/shell/qmlpackages/desktop/contents/loader.qml @@ -37,28 +37,5 @@ Item { id: keyboards query: "IS Keyboard" } - - // TODO: This is not needed - just for testing purposes - Window { - id: desktopDialog - - visible: main.loaded - - width: 500 - height: 500 - - Rectangle { - anchors.fill: parent - color: "white" - } - - Text { - anchors.fill: parent - font.pointSize: 32 - text: "Desktop" - horizontalAlignment: Text.AlignHCenter - verticalAlignment: Text.AlignVCenter - } - } } diff --git a/src/shell/shellcorona.cpp b/src/shell/shellcorona.cpp index ffdbfe842..32ebd42ab 100644 --- a/src/shell/shellcorona.cpp +++ b/src/shell/shellcorona.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "containmentconfigview.h" #include "panelview.h" @@ -95,8 +96,6 @@ ShellCorona::ShellCorona(QObject *parent) connect(d->scriptEngine, &WorkspaceScripting::ScriptEngine::print, this, &ShellCorona::printScriptMessage); - checkViews(); - //QTimer::singleShot(600, this, SLOT(showWidgetExplorer())); // just for easier debugging } @@ -104,14 +103,17 @@ ShellCorona::~ShellCorona() { } -void ShellCorona::setShell(const QString & shell) +void ShellCorona::setShell(const QString &shell) { if (d->shell == shell) return; unload(); - setPackage(shell); d->shell = shell; + KConfigGroup config(KSharedConfig::openConfig(), "General"); + Plasma::Package package = Plasma::PluginLoader::self()->loadPackage("Plasma/Shell"); + package.setPath(shell); + setPackage(package); load(); } @@ -125,6 +127,7 @@ void ShellCorona::load() { if (d->shell.isEmpty()) return; + checkViews(); loadLayout(d->shell); if (containments().isEmpty()) { @@ -174,6 +177,7 @@ void ShellCorona::processUpdateScripts() void ShellCorona::checkScreens(bool signalWhenExists) { + checkViews(); // quick sanity check to ensure we have containments for each screen int num = numScreens(); for (int i = 0; i < num; ++i) { @@ -290,10 +294,14 @@ void ShellCorona::workAreaResized(int screen) void ShellCorona::checkViews() { + if (d->shell.isEmpty()) { + return; + } if (d->views.count() == d->desktopWidget->screenCount()) { return; } else if (d->views.count() < d->desktopWidget->screenCount()) { for (int i = d->views.count(); i < d->desktopWidget->screenCount(); ++i) { + View *view = new View(this); QSurfaceFormat format; view->show(); diff --git a/src/shell/view.cpp b/src/shell/view.cpp index a0c61686c..df3d6a16d 100644 --- a/src/shell/view.cpp +++ b/src/shell/view.cpp @@ -38,7 +38,9 @@ View::View(Plasma::Corona *corona, QWindow *parent) //Probably is an architectural problem QSurfaceFormat format; format.setAlphaBufferSize(8); + setFormat(format); + setColor(Qt::transparent); connect(screen(), &QScreen::virtualGeometryChanged, this, &View::screenGeometryChanged);