use a QmlWallpaper package type for wallpapers
This commit is contained in:
parent
2e14e707fe
commit
800298935f
@ -93,8 +93,7 @@ void WallpaperInterface::syncWallpaperPackage()
|
||||
m_qmlObject->setInitializationDelayed(true);
|
||||
}
|
||||
|
||||
m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||
m_pkg.setDefaultPackageRoot("plasma/wallpapers");
|
||||
m_pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/QmlWallpaper");
|
||||
m_pkg.setPath(m_wallpaperPlugin);
|
||||
|
||||
m_configLoader->deleteLater();
|
||||
|
@ -71,7 +71,7 @@ add_executable(plasma-shell
|
||||
panelview.cpp
|
||||
shellpluginloader.cpp
|
||||
shellmanager.cpp
|
||||
lookandfeelpackage.cpp
|
||||
packages.cpp
|
||||
view.cpp
|
||||
panelconfigview.cpp
|
||||
${scripting_SRC}
|
||||
|
@ -52,8 +52,7 @@ ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow
|
||||
engine()->rootContext()->setContextProperty("configDialog", this);
|
||||
setCurrentWallpaper(cont->containment()->wallpaper());
|
||||
|
||||
Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||
pkg.setDefaultPackageRoot("plasma/wallpapers");
|
||||
Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/QmlWallpaper");
|
||||
pkg.setPath(m_containment->wallpaper());
|
||||
QFile file(pkg.filePath("config", "main.xml"));
|
||||
KConfigGroup cfg = m_containment->config();
|
||||
|
@ -49,7 +49,7 @@ int main(int argc, char** argv)
|
||||
QQmlDebuggingEnabler enabler;
|
||||
}
|
||||
|
||||
// Plasma::PluginLoader::setPluginLoader(new ShellPluginLoader);
|
||||
Plasma::PluginLoader::setPluginLoader(new ShellPluginLoader);
|
||||
// DesktopCorona *corona = new DesktopCorona();
|
||||
// corona->loadLayout();
|
||||
// if (corona->containments().isEmpty()) {
|
||||
|
@ -18,14 +18,17 @@
|
||||
* Boston, MA 02110-1301, USA. *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "lookandfeelpackage.h"
|
||||
#include "packages.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <KLocalizedString>
|
||||
#include <kdeclarative.h>
|
||||
|
||||
#include <Plasma/Package>
|
||||
|
||||
|
||||
void LookAndFeelPackageStructure::initPackage(Plasma::Package *package)
|
||||
void LookAndFeelPackage::initPackage(Plasma::Package *package)
|
||||
{
|
||||
// http://community.kde.org/Plasma/lookAndFeelPackage#
|
||||
|
||||
@ -71,4 +74,47 @@ void LookAndFeelPackageStructure::initPackage(Plasma::Package *package)
|
||||
|
||||
}
|
||||
|
||||
void QmlWallpaperPackage::initPackage(Plasma::Package *package)
|
||||
{
|
||||
package->addFileDefinition("mainscript", "ui/main.qml", i18n("Main Script File"));
|
||||
//FIXME: why setting it required doesn't work?
|
||||
//package->setRequired("mainscript", true);
|
||||
|
||||
|
||||
QStringList platform = KDeclarative::runtimePlatform();
|
||||
if (!platform.isEmpty()) {
|
||||
QMutableStringListIterator it(platform);
|
||||
while (it.hasNext()) {
|
||||
it.next();
|
||||
it.setValue("platformcontents/" + it.value());
|
||||
}
|
||||
|
||||
platform.append("contents");
|
||||
package->setContentsPrefixPaths(platform);
|
||||
}
|
||||
|
||||
package->setDefaultPackageRoot("plasma/wallpapers/");
|
||||
|
||||
package->addDirectoryDefinition("images", "images", i18n("Images"));
|
||||
package->addDirectoryDefinition("theme", "theme", i18n("Themed Images"));
|
||||
QStringList mimetypes;
|
||||
mimetypes << "image/svg+xml" << "image/png" << "image/jpeg";
|
||||
package->setMimeTypes("images", mimetypes);
|
||||
package->setMimeTypes("theme", mimetypes);
|
||||
|
||||
package->addDirectoryDefinition("config", "config", i18n("Configuration Definitions"));
|
||||
mimetypes.clear();
|
||||
mimetypes << "text/xml";
|
||||
package->setMimeTypes("config", mimetypes);
|
||||
|
||||
package->addDirectoryDefinition("ui", "ui", i18n("User Interface"));
|
||||
|
||||
package->addDirectoryDefinition("data", "data", i18n("Data Files"));
|
||||
|
||||
package->addDirectoryDefinition("scripts", "code", i18n("Executable Scripts"));
|
||||
mimetypes.clear();
|
||||
mimetypes << "text/plain";
|
||||
package->setMimeTypes("scripts", mimetypes);
|
||||
|
||||
package->addDirectoryDefinition("translations", "locale", i18n("Translations"));
|
||||
}
|
@ -19,19 +19,24 @@
|
||||
* Boston, MA 02110-1301, USA. *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef SHELLPACKAGE_H
|
||||
#define SHELLPACKAGE_H
|
||||
#ifndef SHELLPACKAGES_H
|
||||
#define SHELLPACKAGES_H
|
||||
|
||||
#include <Plasma/PackageStructure>
|
||||
#include <Plasma/Plasma>
|
||||
|
||||
|
||||
|
||||
class LookAndFeelPackageStructure : public Plasma::PackageStructure
|
||||
class LookAndFeelPackage : public Plasma::PackageStructure
|
||||
{
|
||||
public:
|
||||
void initPackage(Plasma::Package *package);
|
||||
};
|
||||
|
||||
class QmlWallpaperPackage : public Plasma::PackageStructure
|
||||
{
|
||||
public:
|
||||
void initPackage(Plasma::Package *package);
|
||||
};
|
||||
|
||||
#endif // LOOKANDFEELPACKAGE_H
|
@ -18,8 +18,9 @@
|
||||
*/
|
||||
|
||||
#include "shellpluginloader.h"
|
||||
#include "lookandfeelpackage.h"
|
||||
#include "packages.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
ShellPluginLoader::ShellPluginLoader()
|
||||
: Plasma::PluginLoader()
|
||||
@ -35,7 +36,10 @@ Plasma::Package ShellPluginLoader::internalLoadPackage(const QString &packageFor
|
||||
Q_UNUSED(specialization)
|
||||
|
||||
if (packageFormat.endsWith("/LookAndFeel")) {
|
||||
Plasma::PackageStructure *structure = new LookAndFeelPackageStructure();
|
||||
Plasma::PackageStructure *structure = new LookAndFeelPackage();
|
||||
return Plasma::Package(structure);
|
||||
} else if (packageFormat.endsWith("/QmlWallpaper")) {
|
||||
Plasma::PackageStructure *structure = new QmlWallpaperPackage();
|
||||
return Plasma::Package(structure);
|
||||
} else {
|
||||
return Plasma::Package();
|
||||
|
Loading…
Reference in New Issue
Block a user