Corona::setPackage(QString) uses a Package
* symmetrical api in Corona * there is no default package
This commit is contained in:
parent
5005f2c879
commit
b32a42c8e8
@ -70,9 +70,9 @@ Plasma::Package Corona::package() const
|
|||||||
return d->package;
|
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
|
void Corona::saveLayout(const QString &configName) const
|
||||||
@ -291,8 +291,6 @@ CoronaPrivate::CoronaPrivate(Corona *corona)
|
|||||||
{
|
{
|
||||||
//TODO: make Package path configurable
|
//TODO: make Package path configurable
|
||||||
KConfigGroup config(KSharedConfig::openConfig(), "General");
|
KConfigGroup config(KSharedConfig::openConfig(), "General");
|
||||||
package = Plasma::PluginLoader::self()->loadPackage("Plasma/Shell");
|
|
||||||
package.setPath(config.readEntry("shell", "org.kde.desktop"));
|
|
||||||
|
|
||||||
if (QCoreApplication::instance()) {
|
if (QCoreApplication::instance()) {
|
||||||
configName = QCoreApplication::instance()->applicationName() + "-appletsrc";
|
configName = QCoreApplication::instance()->applicationName() + "-appletsrc";
|
||||||
|
@ -61,7 +61,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Setting the package name
|
* Setting the package name
|
||||||
*/
|
*/
|
||||||
void setPackage(const QString & package);
|
void setPackage(const Plasma::Package &package);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return all containments on this Corona
|
* @return all containments on this Corona
|
||||||
|
@ -37,28 +37,5 @@ Item {
|
|||||||
id: keyboards
|
id: keyboards
|
||||||
query: "IS Keyboard"
|
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 <KLocalizedString>
|
||||||
#include <Plasma/Package>
|
#include <Plasma/Package>
|
||||||
|
#include <Plasma/PluginLoader>
|
||||||
|
|
||||||
#include "containmentconfigview.h"
|
#include "containmentconfigview.h"
|
||||||
#include "panelview.h"
|
#include "panelview.h"
|
||||||
@ -95,8 +96,6 @@ ShellCorona::ShellCorona(QObject *parent)
|
|||||||
connect(d->scriptEngine, &WorkspaceScripting::ScriptEngine::print,
|
connect(d->scriptEngine, &WorkspaceScripting::ScriptEngine::print,
|
||||||
this, &ShellCorona::printScriptMessage);
|
this, &ShellCorona::printScriptMessage);
|
||||||
|
|
||||||
checkViews();
|
|
||||||
|
|
||||||
//QTimer::singleShot(600, this, SLOT(showWidgetExplorer())); // just for easier debugging
|
//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;
|
if (d->shell == shell) return;
|
||||||
|
|
||||||
unload();
|
unload();
|
||||||
|
|
||||||
setPackage(shell);
|
|
||||||
d->shell = shell;
|
d->shell = shell;
|
||||||
|
KConfigGroup config(KSharedConfig::openConfig(), "General");
|
||||||
|
Plasma::Package package = Plasma::PluginLoader::self()->loadPackage("Plasma/Shell");
|
||||||
|
package.setPath(shell);
|
||||||
|
setPackage(package);
|
||||||
|
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
@ -125,6 +127,7 @@ void ShellCorona::load()
|
|||||||
{
|
{
|
||||||
if (d->shell.isEmpty()) return;
|
if (d->shell.isEmpty()) return;
|
||||||
|
|
||||||
|
checkViews();
|
||||||
loadLayout(d->shell);
|
loadLayout(d->shell);
|
||||||
|
|
||||||
if (containments().isEmpty()) {
|
if (containments().isEmpty()) {
|
||||||
@ -174,6 +177,7 @@ void ShellCorona::processUpdateScripts()
|
|||||||
|
|
||||||
void ShellCorona::checkScreens(bool signalWhenExists)
|
void ShellCorona::checkScreens(bool signalWhenExists)
|
||||||
{
|
{
|
||||||
|
checkViews();
|
||||||
// quick sanity check to ensure we have containments for each screen
|
// quick sanity check to ensure we have containments for each screen
|
||||||
int num = numScreens();
|
int num = numScreens();
|
||||||
for (int i = 0; i < num; ++i) {
|
for (int i = 0; i < num; ++i) {
|
||||||
@ -290,10 +294,14 @@ void ShellCorona::workAreaResized(int screen)
|
|||||||
|
|
||||||
void ShellCorona::checkViews()
|
void ShellCorona::checkViews()
|
||||||
{
|
{
|
||||||
|
if (d->shell.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (d->views.count() == d->desktopWidget->screenCount()) {
|
if (d->views.count() == d->desktopWidget->screenCount()) {
|
||||||
return;
|
return;
|
||||||
} else if (d->views.count() < d->desktopWidget->screenCount()) {
|
} else if (d->views.count() < d->desktopWidget->screenCount()) {
|
||||||
for (int i = d->views.count(); i < d->desktopWidget->screenCount(); ++i) {
|
for (int i = d->views.count(); i < d->desktopWidget->screenCount(); ++i) {
|
||||||
|
|
||||||
View *view = new View(this);
|
View *view = new View(this);
|
||||||
QSurfaceFormat format;
|
QSurfaceFormat format;
|
||||||
view->show();
|
view->show();
|
||||||
|
@ -38,7 +38,9 @@ View::View(Plasma::Corona *corona, QWindow *parent)
|
|||||||
//Probably is an architectural problem
|
//Probably is an architectural problem
|
||||||
QSurfaceFormat format;
|
QSurfaceFormat format;
|
||||||
format.setAlphaBufferSize(8);
|
format.setAlphaBufferSize(8);
|
||||||
|
|
||||||
setFormat(format);
|
setFormat(format);
|
||||||
|
setColor(Qt::transparent);
|
||||||
|
|
||||||
connect(screen(), &QScreen::virtualGeometryChanged,
|
connect(screen(), &QScreen::virtualGeometryChanged,
|
||||||
this, &View::screenGeometryChanged);
|
this, &View::screenGeometryChanged);
|
||||||
|
Loading…
Reference in New Issue
Block a user