Corona::setPackage(QString) uses a Package

* symmetrical api in Corona
* there is no default package
This commit is contained in:
Marco Martin 2013-09-02 18:04:22 +02:00
parent 5005f2c879
commit b32a42c8e8
5 changed files with 17 additions and 32 deletions

View File

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

View File

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

View File

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

View File

@ -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
}
@ -110,8 +109,11 @@ void ShellCorona::setShell(const QString & shell)
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();

View File

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