put namespace around KDeclarative

This commit is contained in:
Marco Martin 2014-01-13 21:21:14 +01:00
parent 4235ec4842
commit 92fe107329
16 changed files with 49 additions and 38 deletions

View File

@ -60,7 +60,7 @@ void CoreBindingsPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
context->setContextProperty("theme", theme);
if (!engine->rootContext()->contextObject()) {
KDeclarative kdeclarative;
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(engine);
kdeclarative.setupBindings();
}

View File

@ -63,7 +63,7 @@ ToolTipDialog::~ToolTipDialog()
QQuickItem *ToolTipDialog::loadDefaultItem()
{
if (!m_qmlObject) {
m_qmlObject = new QmlObject(this);
m_qmlObject = new KDeclarative::QmlObject(this);
}
if (!m_qmlObject->rootObject()) {

View File

@ -29,9 +29,13 @@
class QQuickItem;
class QGraphicsWidget;
class QmlObject;
class QPropertyAnimation;
namespace KDeclarative
{
class QmlObject;
}
/**
* QML wrapper for kdelibs Plasma::ToolTipDialog
*
@ -69,7 +73,7 @@ private Q_SLOTS:
void valueChanged(const QVariant &value);
private:
QmlObject *m_qmlObject;
KDeclarative::QmlObject *m_qmlObject;
QTimer *m_showTimer;
QPropertyAnimation *m_animation;
int m_hideTimeout;

View File

@ -94,8 +94,8 @@ void PlasmaComponentsPlugin::registerTypes(const char *uri)
Q_ASSERT(uri == QLatin1String("org.kde.plasma.components"));
//platform specific c++ components
const QString target = KDeclarative::componentsTarget();
if (target == KDeclarative::defaultComponentsTarget()) {
const QString target = KDeclarative::KDeclarative::componentsTarget();
if (target == KDeclarative::KDeclarative::defaultComponentsTarget()) {
qmlRegisterType<QMenuProxy>(uri, 2, 0, "Menu");
qmlRegisterType<QMenuItem>(uri, 2, 0, "MenuItem");
} else {

View File

@ -67,7 +67,7 @@ void GenericPackage::initPackage(Package *package)
{
ChangeableMainScriptPackage::initPackage(package);
QStringList platform = KDeclarative::runtimePlatform();
QStringList platform = KDeclarative::KDeclarative::runtimePlatform();
if (!platform.isEmpty()) {
QMutableStringListIterator it(platform);
while (it.hasNext()) {

View File

@ -64,7 +64,7 @@ void ConfigViewPrivate::init()
{
applet->setUserConfiguring(true);
KDeclarative kdeclarative;
KDeclarative::KDeclarative kdeclarative;
kdeclarative.setDeclarativeEngine(q->engine());
kdeclarative.setupBindings();
qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel");

View File

@ -117,7 +117,7 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
//qDebug() << "Found allowed, access granted" << path;
//check if there is a platform specific file that overrides this allowed
foreach (const QString &platform, KDeclarative::runtimePlatform()) {
foreach (const QString &platform, KDeclarative::KDeclarative::runtimePlatform()) {
//qDebug() << "Trying" << platform;
//search for a platformqml/ path sibling of this allowed path

View File

@ -86,7 +86,7 @@ AppletInterface::AppletInterface(DeclarativeAppletScript *script, QQuickItem *pa
this, &ContainmentInterface::screenChanged);
}
m_qmlObject = new QmlObject(this);
m_qmlObject = new KDeclarative::QmlObject(this);
m_qmlObject->setInitializationDelayed(true);
m_collapseTimer = new QTimer(this);
@ -104,7 +104,7 @@ void AppletInterface::init()
return;
}
m_configuration = new ConfigPropertyMap(applet()->configScheme(), this);
m_configuration = new KDeclarative::ConfigPropertyMap(applet()->configScheme(), this);
//use our own custom network access manager that will access Plasma packages and to manage security (i.e. deny access to remote stuff when the proper extension isn't enabled
QQmlEngine *engine = m_qmlObject->engine();
@ -837,7 +837,7 @@ void AppletInterface::itemChange(ItemChange change, const ItemChangeData &value)
QQuickItem::itemChange(change, value);
}
QmlObject *AppletInterface::qmlObject()
KDeclarative::QmlObject *AppletInterface::qmlObject()
{
return m_qmlObject;
}

View File

@ -36,10 +36,12 @@ class QmlAppletScript;
class QSignalMapper;
class QSizeF;
class ConfigPropertyMap;
class ConfigView;
namespace KDeclarative {
class ConfigPropertyMap;
class QmlObject;
}
namespace Plasma
{
@ -172,7 +174,7 @@ public:
~AppletInterface();
//API not intended for the QML part
QmlObject *qmlObject();
KDeclarative::QmlObject *qmlObject();
QList<QAction*> contextualActions() const;
@ -346,10 +348,10 @@ private:
QMap<QString, Plasma::ConfigLoader*> m_configs;
ConfigPropertyMap *m_configuration;
KDeclarative::ConfigPropertyMap *m_configuration;
//UI-specific members ------------------
QmlObject *m_qmlObject;
KDeclarative::QmlObject *m_qmlObject;
QWeakPointer<QObject> m_compactUiObject;
QTimer *m_collapseTimer;

View File

@ -55,7 +55,7 @@ DeclarativeAppletScript::DeclarativeAppletScript(QObject *parent, const QVariant
m_interface(0)
{
qmlRegisterType<AppletInterface>();
qmlRegisterType<ConfigPropertyMap>();
qmlRegisterType<KDeclarative::ConfigPropertyMap>();
Q_UNUSED(args);
}

View File

@ -28,8 +28,6 @@
class AppletInterface;
class QmlObject;
class DeclarativeAppletScript : public Plasma::AppletScript
{
Q_OBJECT

View File

@ -74,7 +74,7 @@ Plasma::Package WallpaperInterface::package() const
return m_pkg;
}
ConfigPropertyMap *WallpaperInterface::configuration() const
KDeclarative::ConfigPropertyMap *WallpaperInterface::configuration() const
{
return m_configuration;
}
@ -108,7 +108,7 @@ void WallpaperInterface::syncWallpaperPackage()
m_wallpaperPlugin = m_containmentInterface->containment()->wallpaper();
if (!m_qmlObject) {
m_qmlObject = new QmlObject(this);
m_qmlObject = new KDeclarative::QmlObject(this);
m_qmlObject->setInitializationDelayed(true);
}
@ -121,7 +121,7 @@ void WallpaperInterface::syncWallpaperPackage()
m_configLoader = 0;
m_configuration = 0;
if (configScheme()) {
m_configuration = new ConfigPropertyMap(configScheme(), this);
m_configuration = new KDeclarative::ConfigPropertyMap(configScheme(), this);
}

View File

@ -31,16 +31,20 @@ namespace Plasma {
class KActionCollection;
class ContainmentInterface;
class QSignalMapper;
namespace KDeclarative {
class ConfigPropertyMap;
class QmlObject;
class QSignalMapper;
}
class WallpaperInterface : public QQuickItem
{
Q_OBJECT
//Q_PROPERTY(QString plugin READ plugin WRITE setPlugin NOTIFY pluginChanged)
Q_PROPERTY(ConfigPropertyMap *configuration READ configuration NOTIFY configurationChanged)
Q_PROPERTY(KDeclarative::ConfigPropertyMap *configuration READ configuration NOTIFY configurationChanged)
public:
WallpaperInterface(ContainmentInterface *parent = 0);
@ -57,7 +61,7 @@ public:
Plasma::Package package() const;
ConfigPropertyMap *configuration() const;
KDeclarative::ConfigPropertyMap *configuration() const;
Plasma::ConfigLoader *configScheme();
@ -85,9 +89,9 @@ private Q_SLOTS:
private:
QString m_wallpaperPlugin;
ContainmentInterface *m_containmentInterface;
QmlObject *m_qmlObject;
KDeclarative::QmlObject *m_qmlObject;
Plasma::Package m_pkg;
ConfigPropertyMap *m_configuration;
KDeclarative::ConfigPropertyMap *m_configuration;
Plasma::ConfigLoader *m_configLoader;
KActionCollection *m_actions;
QSignalMapper *m_actionSignals;

View File

@ -124,7 +124,7 @@ ConfigModel *ContainmentConfigView::wallpaperConfigModel()
return m_wallpaperConfigModel;
}
ConfigPropertyMap *ContainmentConfigView::wallpaperConfiguration() const
KDeclarative::ConfigPropertyMap *ContainmentConfigView::wallpaperConfiguration() const
{
return m_currentWallpaperConfig;
}
@ -154,7 +154,7 @@ void ContainmentConfigView::setCurrentWallpaper(const QString &wallpaper)
QFile file(pkg.filePath("config", "main.xml"));
KConfigGroup cfg = m_containment->config();
cfg = KConfigGroup(&cfg, "Wallpaper");
m_currentWallpaperConfig = m_ownWallpaperConfig = new ConfigPropertyMap(new Plasma::ConfigLoader(&cfg, &file), this);
m_currentWallpaperConfig = m_ownWallpaperConfig = new KDeclarative::ConfigPropertyMap(new Plasma::ConfigLoader(&cfg, &file), this);
}
m_currentWallpaper = wallpaper;
@ -179,7 +179,7 @@ void ContainmentConfigView::syncWallpaperObjects()
engine()->rootContext()->setContextProperty("wallpaper", wallpaperGraphicsObject);
//FIXME: why m_wallpaperGraphicsObject->property("configuration").value<ConfigPropertyMap *>() doesn't work?
m_currentWallpaperConfig = static_cast<ConfigPropertyMap *>(wallpaperGraphicsObject->property("configuration").value<QObject *>());
m_currentWallpaperConfig = static_cast<KDeclarative::ConfigPropertyMap *>(wallpaperGraphicsObject->property("configuration").value<QObject *>());
}
#include "private/moc_containmentconfigview.cpp"

View File

@ -29,9 +29,12 @@ namespace Plasma {
}
class QAbstractItemModel;
class ConfigPropertyMap;
class CurrentContainmentActionsModel;
namespace KDeclarative {
class ConfigPropertyMap;
}
//TODO: out of the library?
class ContainmentConfigView : public ConfigView
{
@ -39,7 +42,7 @@ class ContainmentConfigView : public ConfigView
Q_PROPERTY(ConfigModel *containmentActionConfigModel READ containmentActionConfigModel CONSTANT)
Q_PROPERTY(QAbstractItemModel *currentContainmentActionsModel READ currentContainmentActionsModel CONSTANT)
Q_PROPERTY(ConfigModel *wallpaperConfigModel READ wallpaperConfigModel CONSTANT)
Q_PROPERTY(ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged)
Q_PROPERTY(KDeclarative::ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged)
Q_PROPERTY(QString currentWallpaper READ currentWallpaper WRITE setCurrentWallpaper NOTIFY currentWallpaperChanged)
public:
@ -53,7 +56,7 @@ public:
ConfigModel *wallpaperConfigModel();
QString currentWallpaper() const;
void setCurrentWallpaper(const QString &wallpaper);
ConfigPropertyMap *wallpaperConfiguration() const;
KDeclarative::ConfigPropertyMap *wallpaperConfiguration() const;
Q_INVOKABLE void applyWallpaper();
@ -70,8 +73,8 @@ private:
ConfigModel *m_containmentActionConfigModel;
CurrentContainmentActionsModel *m_currentContainmentActionsModel;
QString m_currentWallpaper;
ConfigPropertyMap *m_currentWallpaperConfig;
ConfigPropertyMap *m_ownWallpaperConfig;
KDeclarative::ConfigPropertyMap *m_currentWallpaperConfig;
KDeclarative::ConfigPropertyMap *m_ownWallpaperConfig;
};
#endif // multiple inclusion guard

View File

@ -81,7 +81,7 @@ void QmlWallpaperPackage::initPackage(Plasma::Package *package)
//package->setRequired("mainscript", true);
QStringList platform = KDeclarative::runtimePlatform();
QStringList platform = KDeclarative::KDeclarative::runtimePlatform();
if (!platform.isEmpty()) {
QMutableStringListIterator it(platform);
while (it.hasNext()) {