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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,6 +22,8 @@
#include <QObject>
namespace PlasmaQuick {
//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
class ConfigCategory : public QObject
@ -61,4 +63,6 @@ private:
QString m_pluginName;
};
}
#endif // multiple inclusion guard