Corona::setPackage(QString) uses a Package

* symmetrical api in Corona
* there is no default package
wilder-5.14
Marco Martin 13 years ago
parent 40a557d312
commit 852b8017bd
  1. 23
      qmlpackages/desktop/contents/loader.qml
  2. 16
      shellcorona.cpp
  3. 2
      view.cpp

@ -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
}
}
}

@ -29,6 +29,7 @@
#include <KLocalizedString>
#include <Plasma/Package>
#include <Plasma/PluginLoader>
#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();

@ -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);

Loading…
Cancel
Save