use a namespace in libplasmaquick

right now only the library builds
This commit is contained in:
Marco Martin 2014-02-19 19:37:30 +01:00
parent c9ac5ebefb
commit 5bb4761c73
13 changed files with 93 additions and 40 deletions

View File

@ -38,6 +38,9 @@
#include <packageurlinterceptor.h> #include <packageurlinterceptor.h>
namespace PlasmaQuick
{
QHash<QObject *, AppletQuickItem *> AppletQuickItemPrivate::s_rootObjects = QHash<QObject *, AppletQuickItem *>(); QHash<QObject *, AppletQuickItem *> AppletQuickItemPrivate::s_rootObjects = QHash<QObject *, AppletQuickItem *>();
AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickItem *item) AppletQuickItemPrivate::AppletQuickItemPrivate(Plasma::Applet *a, AppletQuickItem *item)
@ -660,7 +663,7 @@ void AppletQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
QQuickItem::itemChange(change, value); QQuickItem::itemChange(change, value);
} }
}
#include "moc_appletquickitem.cpp" #include "moc_appletquickitem.cpp"

View File

@ -39,6 +39,8 @@ namespace KDeclarative {
} }
namespace PlasmaQuick {
class AppletQuickItemPrivate; class AppletQuickItemPrivate;
class PLASMAQUICK_EXPORT AppletQuickItem : public QQuickItem class PLASMAQUICK_EXPORT AppletQuickItem : public QQuickItem
@ -146,6 +148,9 @@ private:
Q_PRIVATE_SLOT(d, void fillHeightChanged()) Q_PRIVATE_SLOT(d, void fillHeightChanged())
}; };
QML_DECLARE_TYPEINFO(AppletQuickItem, QML_HAS_ATTACHED_PROPERTIES) }
QML_DECLARE_TYPEINFO(PlasmaQuick::AppletQuickItem, QML_HAS_ATTACHED_PROPERTIES)
#endif #endif

View File

@ -38,6 +38,7 @@
#include <Plasma/Corona> #include <Plasma/Corona>
#include <Plasma/PluginLoader> #include <Plasma/PluginLoader>
namespace PlasmaQuick {
//////////////////////////////ConfigModel //////////////////////////////ConfigModel
@ -242,5 +243,6 @@ QQmlListProperty<ConfigCategory> ConfigModel::categories()
} }
}
#include "moc_configmodel.cpp" #include "moc_configmodel.cpp"

View File

@ -30,6 +30,9 @@ namespace Plasma {
class Applet; class Applet;
} }
namespace PlasmaQuick
{
class ConfigPropertyMap; class ConfigPropertyMap;
class ConfigCategoryPrivate; class ConfigCategoryPrivate;
@ -100,4 +103,6 @@ private:
ConfigModelPrivate *const d; ConfigModelPrivate *const d;
}; };
}
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -39,6 +39,8 @@
#include <Plasma/PluginLoader> #include <Plasma/PluginLoader>
namespace PlasmaQuick
{
//////////////////////////////ConfigView //////////////////////////////ConfigView
@ -156,4 +158,6 @@ void ConfigView::resizeEvent(QResizeEvent *re)
QQuickWindow::resizeEvent(re); QQuickWindow::resizeEvent(re);
} }
}
#include "moc_configview.cpp" #include "moc_configview.cpp"

View File

@ -29,6 +29,9 @@ namespace Plasma {
class Applet; class Applet;
} }
namespace PlasmaQuick
{
class ConfigViewPrivate; class ConfigViewPrivate;
class ConfigModel; class ConfigModel;
@ -68,4 +71,6 @@ private:
ConfigViewPrivate *const d; ConfigViewPrivate *const d;
}; };
}
#endif // multiple inclusion guard #endif // multiple inclusion guard

View File

@ -25,6 +25,9 @@
#include <kdeclarative/kdeclarative.h> #include <kdeclarative/kdeclarative.h>
namespace PlasmaQuick
{
PackageUrlInterceptor::PackageUrlInterceptor(QQmlEngine *engine, const Plasma::Package &p) PackageUrlInterceptor::PackageUrlInterceptor(QQmlEngine *engine, const Plasma::Package &p)
: QQmlAbstractUrlInterceptor(), : QQmlAbstractUrlInterceptor(),
m_package(p), m_package(p),
@ -138,6 +141,6 @@ QUrl PackageUrlInterceptor::intercept(const QUrl &path, QQmlAbstractUrlIntercept
return QUrl(); return QUrl();
} }
}

View File

@ -28,6 +28,9 @@
class QQmlEngine; class QQmlEngine;
namespace PlasmaQuick
{
//depends from https://codereview.qt-project.org/#change,65626 //depends from https://codereview.qt-project.org/#change,65626
class PLASMAQUICK_EXPORT PackageUrlInterceptor: public QQmlAbstractUrlInterceptor class PLASMAQUICK_EXPORT PackageUrlInterceptor: public QQmlAbstractUrlInterceptor
{ {
@ -76,5 +79,6 @@ private:
QQmlEngine *m_engine; QQmlEngine *m_engine;
}; };
}
#endif #endif

View File

@ -27,36 +27,39 @@
#include "plasma/pluginloader.h" #include "plasma/pluginloader.h"
class PlasmaQuickViewPrivate namespace PlasmaQuick
{
class ViewPrivate
{ {
public: public:
PlasmaQuickViewPrivate(Plasma::Corona *corona, PlasmaQuickView *view); ViewPrivate(Plasma::Corona *corona, View *view);
~PlasmaQuickViewPrivate(); ~ViewPrivate();
void setContainment(Plasma::Containment *cont); void setContainment(Plasma::Containment *cont);
Plasma::Types::FormFactor formFactor() const; Plasma::Types::FormFactor formFactor() const;
Plasma::Types::Location location() const; Plasma::Types::Location location() const;
void showConfigurationInterface(Plasma::Applet *applet); void showConfigurationInterface(Plasma::Applet *applet);
PlasmaQuickView *q; View *q;
friend class PlasmaQuickView; friend class View;
Plasma::Corona *corona; Plasma::Corona *corona;
QWeakPointer<Plasma::Containment> containment; QWeakPointer<Plasma::Containment> containment;
QWeakPointer<ConfigView> configView; QWeakPointer<ConfigView> configView;
}; };
PlasmaQuickViewPrivate::PlasmaQuickViewPrivate(Plasma::Corona *cor, PlasmaQuickView *view) ViewPrivate::ViewPrivate(Plasma::Corona *cor, View *view)
: q(view), : q(view),
corona(cor) corona(cor)
{ {
} }
PlasmaQuickViewPrivate::~PlasmaQuickViewPrivate() ViewPrivate::~ViewPrivate()
{ {
} }
void PlasmaQuickViewPrivate::setContainment(Plasma::Containment *cont) void ViewPrivate::setContainment(Plasma::Containment *cont)
{ {
if (containment.data() == cont) { if (containment.data() == cont) {
return; return;
@ -91,11 +94,11 @@ void PlasmaQuickViewPrivate::setContainment(Plasma::Containment *cont)
if (cont) { if (cont) {
cont->reactToScreenChange(); cont->reactToScreenChange();
QObject::connect(cont, &Plasma::Containment::locationChanged, QObject::connect(cont, &Plasma::Containment::locationChanged,
q, &PlasmaQuickView::locationChanged); q, &View::locationChanged);
QObject::connect(cont, &Plasma::Containment::formFactorChanged, QObject::connect(cont, &Plasma::Containment::formFactorChanged,
q, &PlasmaQuickView::formFactorChanged); q, &View::formFactorChanged);
QObject::connect(cont, &Plasma::Containment::configureRequested, QObject::connect(cont, &Plasma::Containment::configureRequested,
q, &PlasmaQuickView::showConfigurationInterface); q, &View::showConfigurationInterface);
} else { } else {
return; return;
} }
@ -120,7 +123,7 @@ void PlasmaQuickViewPrivate::setContainment(Plasma::Containment *cont)
} }
} }
Plasma::Types::Location PlasmaQuickViewPrivate::location() const Plasma::Types::Location ViewPrivate::location() const
{ {
if (!containment) { if (!containment) {
return Plasma::Types::Desktop; return Plasma::Types::Desktop;
@ -128,7 +131,7 @@ Plasma::Types::Location PlasmaQuickViewPrivate::location() const
return containment.data()->location(); return containment.data()->location();
} }
Plasma::Types::FormFactor PlasmaQuickViewPrivate::formFactor() const Plasma::Types::FormFactor ViewPrivate::formFactor() const
{ {
if (!containment) { if (!containment) {
return Plasma::Types::Planar; return Plasma::Types::Planar;
@ -136,7 +139,7 @@ Plasma::Types::FormFactor PlasmaQuickViewPrivate::formFactor() const
return containment.data()->formFactor(); return containment.data()->formFactor();
} }
void PlasmaQuickViewPrivate::showConfigurationInterface(Plasma::Applet *applet) void ViewPrivate::showConfigurationInterface(Plasma::Applet *applet)
{ {
if (configView) { if (configView) {
configView.data()->hide(); configView.data()->hide();
@ -156,9 +159,9 @@ void PlasmaQuickViewPrivate::showConfigurationInterface(Plasma::Applet *applet)
PlasmaQuickView::PlasmaQuickView(Plasma::Corona *corona, QWindow *parent) View::View(Plasma::Corona *corona, QWindow *parent)
: QQuickView(parent), : QQuickView(parent),
d(new PlasmaQuickViewPrivate(corona, this)) d(new ViewPrivate(corona, this))
{ {
QSurfaceFormat format; QSurfaceFormat format;
format.setAlphaBufferSize(8); format.setAlphaBufferSize(8);
@ -168,29 +171,29 @@ PlasmaQuickView::PlasmaQuickView(Plasma::Corona *corona, QWindow *parent)
QObject::connect(screen(), &QScreen::geometryChanged, QObject::connect(screen(), &QScreen::geometryChanged,
this, &PlasmaQuickView::screenGeometryChanged); this, &View::screenGeometryChanged);
if (!corona->package().isValid()) { if (!corona->package().isValid()) {
qWarning() << "Invalid home screen package"; qWarning() << "Invalid home screen package";
} }
setResizeMode(PlasmaQuickView::SizeRootObjectToView); setResizeMode(View::SizeRootObjectToView);
QObject::connect(corona, &Plasma::Corona::packageChanged, QObject::connect(corona, &Plasma::Corona::packageChanged,
this, &PlasmaQuickView::coronaPackageChanged); this, &View::coronaPackageChanged);
} }
PlasmaQuickView::~PlasmaQuickView() View::~View()
{ {
delete d; delete d;
} }
Plasma::Corona *PlasmaQuickView::corona() const Plasma::Corona *View::corona() const
{ {
return d->corona; return d->corona;
} }
KConfigGroup PlasmaQuickView::config() const KConfigGroup View::config() const
{ {
if (!containment()) { if (!containment()) {
return KConfigGroup(); return KConfigGroup();
@ -199,45 +202,47 @@ KConfigGroup PlasmaQuickView::config() const
return KConfigGroup(&views, QString::number(containment()->screen())); return KConfigGroup(&views, QString::number(containment()->screen()));
} }
void PlasmaQuickView::setContainment(Plasma::Containment *cont) void View::setContainment(Plasma::Containment *cont)
{ {
d->setContainment(cont); d->setContainment(cont);
} }
Plasma::Containment *PlasmaQuickView::containment() const Plasma::Containment *View::containment() const
{ {
return d->containment.data(); return d->containment.data();
} }
void PlasmaQuickView::setLocation(Plasma::Types::Location location) void View::setLocation(Plasma::Types::Location location)
{ {
d->containment.data()->setLocation(location); d->containment.data()->setLocation(location);
} }
Plasma::Types::Location PlasmaQuickView::location() const Plasma::Types::Location View::location() const
{ {
return d->location(); return d->location();
} }
Plasma::Types::FormFactor PlasmaQuickView::formFactor() const Plasma::Types::FormFactor View::formFactor() const
{ {
return d->formFactor(); return d->formFactor();
} }
QRectF PlasmaQuickView::screenGeometry() QRectF View::screenGeometry()
{ {
return screen()->geometry(); return screen()->geometry();
} }
void PlasmaQuickView::showConfigurationInterface(Plasma::Applet *applet) void View::showConfigurationInterface(Plasma::Applet *applet)
{ {
d->showConfigurationInterface(applet); d->showConfigurationInterface(applet);
} }
void PlasmaQuickView::coronaPackageChanged(const Plasma::Package &package) void View::coronaPackageChanged(const Plasma::Package &package)
{ {
setContainment(0); setContainment(0);
setSource(QUrl::fromLocalFile(package.filePath("views", "Desktop.qml"))); setSource(QUrl::fromLocalFile(package.filePath("views", "Desktop.qml")));
} }
}
#include "moc_plasmaquickview.cpp" #include "moc_plasmaquickview.cpp"

View File

@ -25,9 +25,13 @@
#include "plasma/corona.h" #include "plasma/corona.h"
#include "plasma/containment.h" #include "plasma/containment.h"
class PlasmaQuickViewPrivate;
class PLASMAQUICK_EXPORT PlasmaQuickView : public QQuickView namespace PlasmaQuick
{
class ViewPrivate;
class PLASMAQUICK_EXPORT View : public QQuickView
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged) Q_PROPERTY(Plasma::Types::Location location READ location WRITE setLocation NOTIFY locationChanged)
@ -39,8 +43,8 @@ public:
* @param corona the corona of this view * @param corona the corona of this view
* @param parent the QWindow this View is parented to * @param parent the QWindow this View is parented to
**/ **/
explicit PlasmaQuickView(Plasma::Corona *corona, QWindow *parent = 0); explicit View(Plasma::Corona *corona, QWindow *parent = 0);
virtual ~PlasmaQuickView(); virtual ~View();
/** /**
* @return the corona of this view * @return the corona of this view
@ -115,8 +119,10 @@ Q_SIGNALS:
void screenGeometryChanged(); void screenGeometryChanged();
private: private:
PlasmaQuickViewPrivate *const d; ViewPrivate *const d;
friend class PlasmaQuickViewPrivate; friend class ViewPrivate;
}; };
#endif // PLASMAQUICKVIEW_H }
#endif // View_H

View File

@ -30,6 +30,8 @@ namespace KDeclarative {
class QmlObject; class QmlObject;
} }
namespace PlasmaQuick {
class AppletQuickItem; class AppletQuickItem;
class AppletQuickItemPrivate class AppletQuickItemPrivate
@ -90,4 +92,6 @@ public:
static QHash<QObject *, AppletQuickItem *> s_rootObjects; static QHash<QObject *, AppletQuickItem *> s_rootObjects;
}; };
}
#endif #endif

View File

@ -38,6 +38,8 @@
#include <Plasma/Corona> #include <Plasma/Corona>
#include <Plasma/PluginLoader> #include <Plasma/PluginLoader>
namespace PlasmaQuick {
///////////////////////ConfigCategory ///////////////////////ConfigCategory
ConfigCategory::ConfigCategory(QObject *parent) ConfigCategory::ConfigCategory(QObject *parent)
@ -110,5 +112,6 @@ void ConfigCategory::setPluginName(const QString &name)
emit pluginNameChanged(); emit pluginNameChanged();
} }
}
#include "private/moc_configcategory_p.cpp" #include "private/moc_configcategory_p.cpp"

View File

@ -22,6 +22,8 @@
#include <QObject> #include <QObject>
namespace PlasmaQuick {
//This class represents a single row item of the ConfigModel model in a QML friendly manner. //This class represents a single row item of the ConfigModel model in a QML friendly manner.
//the properties contains all the data needed to represent an icon in the sidebar of a configuration dialog, of applets or containments //the properties contains all the data needed to represent an icon in the sidebar of a configuration dialog, of applets or containments
class ConfigCategory : public QObject class ConfigCategory : public QObject
@ -61,4 +63,6 @@ private:
QString m_pluginName; QString m_pluginName;
}; };
}
#endif // multiple inclusion guard #endif // multiple inclusion guard