DataVisualization remained anemic: it was only offering a single SLOT, and it was pure virtual at that. to keep the inheritance tree sane, it has been removed.

Widget remains problematic as it uses QGraphicsItem API, but it needs to be subclassed by items that are already QGraphicsItems. ugh.

svn path=/trunk/KDE/kdebase/workspace/plasma/lib/; revision=668083
This commit is contained in:
Aaron J. Seigo 2007-05-25 02:27:33 +00:00
parent 449a7e6d13
commit 8288d58356
13 changed files with 30 additions and 147 deletions

View File

@ -8,7 +8,6 @@ set(plasma_LIB_SRCS
dataengine.cpp dataengine.cpp
dataenginemanager.cpp dataenginemanager.cpp
datasource.cpp datasource.cpp
datavisualization.cpp
plasma.cpp plasma.cpp
interface.cpp interface.cpp
svg.cpp svg.cpp
@ -41,7 +40,6 @@ install( FILES
dataengine.h dataengine.h
dataenginemanager.h dataenginemanager.h
datasource.h datasource.h
datavisualization.h
interface.h interface.h
plasma.h plasma.h
plasma_export.h plasma_export.h
@ -63,7 +61,6 @@ install( FILES
includes/DataEngine includes/DataEngine
includes/DataEngineManager includes/DataEngineManager
includes/DataSource includes/DataSource
includes/DataVisualization
includes/Svg includes/Svg
DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma ) DESTINATION ${INCLUDE_INSTALL_DIR}/KDE/Plasma )

View File

@ -1,44 +0,0 @@
/*
* Copyright (C) 2007 Alexander Wiedenbruch <mail@wiedenbruch.de>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "datavisualization.h"
namespace Plasma
{
class DataVisualization::Private
{
};
DataVisualization::DataVisualization(QObject *parent)
: QObject(parent),
d(new Private)
{
}
DataVisualization::~DataVisualization()
{
delete d;
}
} // Plasma namespace
#include "datavisualization.moc"

View File

@ -1,47 +0,0 @@
/*
* Copyright (C) 2006 Aaron Seigo <aseigo@kde.org>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License version 2 as
* published by the Free Software Foundation
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details
*
* You should have received a copy of the GNU Library General Public
* License along with this program; if not, write to the
* Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef PLASMA_DATAVISUALIZATION_H
#define PLASMA_DATAVISUALIZATION_H
#include <QtCore/QObject>
#include <dataengine.h>
namespace Plasma
{
// this will end up being multiple-inherited?
class PLASMA_EXPORT DataVisualization : public QObject
{
Q_OBJECT
public:
DataVisualization(QObject* parent = 0);
virtual ~DataVisualization();
public Q_SLOTS:
virtual void updated(const QString& source, const Plasma::DataEngine::Data&) = 0;
private:
class Private;
Private* const d;
};
} // Plasma namespace
#endif // multiple inclusion guard

View File

@ -1 +0,0 @@
#include "../../plasma/datavisualization.h"

View File

@ -24,8 +24,6 @@
#include <QPainter> #include <QPainter>
#include <QGraphicsSceneMouseEvent> #include <QGraphicsSceneMouseEvent>
#include "checkbox.moc"
namespace Plasma namespace Plasma
{ {
@ -53,9 +51,9 @@ class CheckBox::Private
}; };
CheckBox::CheckBox(QGraphicsItem *parent) CheckBox::CheckBox(QGraphicsItem *parent)
: DataVisualization(), : QObject(),
QGraphicsItem(parent), QGraphicsItem(parent),
d(new Private) d(new Private)
{ {
setAcceptedMouseButtons(Qt::LeftButton); setAcceptedMouseButtons(Qt::LeftButton);
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);
@ -248,3 +246,7 @@ event->accept();
} // namespace Plasma } // namespace Plasma
#include "checkbox.moc"

View File

@ -24,8 +24,7 @@
#include <kdemacros.h> #include <kdemacros.h>
#include "datavisualization.h" #include <dataengine.h>
//TODO //TODO
//Please Document this class //Please Document this class
@ -35,7 +34,7 @@ namespace Plasma
/** /**
* Class that emulates a QCheckBox inside plasma * Class that emulates a QCheckBox inside plasma
*/ */
class KDE_EXPORT CheckBox : public DataVisualization,public QGraphicsItem class KDE_EXPORT CheckBox : public QObject, public QGraphicsItem
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@ -19,11 +19,12 @@
#ifndef LINEEDIT_H #ifndef LINEEDIT_H
#define LINEEDIT_H #define LINEEDIT_H
#include <QtCore/QObject>
#include <QtGui/QGraphicsTextItem> #include <QtGui/QGraphicsTextItem>
#include <kdemacros.h> #include <kdemacros.h>
#include "datavisualization.h" #include <dataengine.h>
namespace Plasma namespace Plasma
{ {

View File

@ -55,9 +55,10 @@ class PushButton::Private
}; };
PushButton::PushButton(QGraphicsItem *parent) PushButton::PushButton(QGraphicsItem *parent)
: QGraphicsItem(parent), : QObject(),
QLayoutItem (Qt::AlignHCenter), QGraphicsItem(parent),
d(new Private) QLayoutItem (Qt::AlignHCenter),
d(new Private)
{ {
setAcceptedMouseButtons(Qt::LeftButton); setAcceptedMouseButtons(Qt::LeftButton);
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);

View File

@ -22,9 +22,10 @@
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QtGui/QGraphicsTextItem> #include <QtGui/QGraphicsTextItem>
#include <QtGui/QLayoutItem> #include <QtGui/QLayoutItem>
#include <kdemacros.h> #include <kdemacros.h>
#include "datavisualization.h" #include <dataengine.h>
//TODO //TODO
//Please Document this class //Please Document this class
@ -35,11 +36,11 @@ namespace Plasma
/** /**
* Class that emulates a QPushButton inside plasma * Class that emulates a QPushButton inside plasma
*/ */
class KDE_EXPORT PushButton : public DataVisualization, class KDE_EXPORT PushButton : public QObject,
public QGraphicsItem, public QGraphicsItem,
public QLayoutItem public QLayoutItem
{ {
Q_OBJECT Q_OBJECT
public: public:
enum ButtonShape enum ButtonShape
{ {
@ -91,7 +92,7 @@ class KDE_EXPORT PushButton : public DataVisualization,
void clicked(); void clicked();
public Q_SLOTS: public Q_SLOTS:
virtual void updated(const QString&, const DataEngine::Data &); void updated(const QString&, const DataEngine::Data &);
protected: protected:
bool isDown(); bool isDown();

View File

@ -61,9 +61,9 @@ RadioButton::Private::~Private()
RadioButton::RadioButton(QGraphicsItem *parent) RadioButton::RadioButton(QGraphicsItem *parent)
: DataVisualization() : QObject(),
, QGraphicsItem(parent) QGraphicsItem(parent),
, d(new Private) d(new Private)
{ {
setAcceptedMouseButtons(Qt::LeftButton); setAcceptedMouseButtons(Qt::LeftButton);
setAcceptsHoverEvents(true); setAcceptsHoverEvents(true);

View File

@ -26,14 +26,11 @@
// KDE includes // KDE includes
#include <kdemacros.h> #include <kdemacros.h>
// Plasma includes #include <dataengine.h>
#include "datavisualization.h"
namespace Plasma namespace Plasma
{ {
/** /**
* This class emulates a QRadioButton. * This class emulates a QRadioButton.
* *
@ -50,8 +47,7 @@ namespace Plasma
*/ */
class KDE_EXPORT RadioButton : public DataVisualization class KDE_EXPORT RadioButton : public QObject, public QGraphicsItem
, public QGraphicsItem
{ {
Q_OBJECT Q_OBJECT
@ -72,7 +68,6 @@ public:
void setText(const QString &text); void setText(const QString &text);
public Q_SLOTS: public Q_SLOTS:
// DataVisualization overridden virtual slots
void updated(const QString&, const Plasma::DataEngine::Data &data); void updated(const QString&, const Plasma::DataEngine::Data &data);
Q_SIGNALS: Q_SIGNALS:

View File

@ -17,13 +17,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/ */
#include "widget.h"
#include "widget.moc"
#include <QtCore/QList> #include <QtCore/QList>
#include "layout.h" #include "layout.h"
#include "widget.h"
namespace Plasma namespace Plasma
{ {
@ -43,8 +41,7 @@ class Widget::Private
Widget::Widget(Widget *parent) Widget::Widget(Widget *parent)
: DataVisualization(), : QGraphicsItem(parent),
QGraphicsItem(parent),
d(new Private) d(new Private)
{ {
d->parent = parent; d->parent = parent;
@ -52,7 +49,6 @@ Widget::Widget(Widget *parent)
if(parent) { if(parent) {
parent->addChild(this); parent->addChild(this);
parent->setGeometry(QRectF(QPointF(0.0, 0.0), parent->size())); parent->setGeometry(QRectF(QPointF(0.0, 0.0), parent->size()));
} }
} }
@ -157,12 +153,6 @@ void Widget::resize(qreal w, qreal h)
resize(QSizeF(w, h)); resize(QSizeF(w, h));
} }
void Widget::updated(const QString& source, const Plasma::DataEngine::Data& data)
{
Q_UNUSED(source);
Q_UNUSED(data);
}
void Widget::setLayout(Layout *l) void Widget::setLayout(Layout *l)
{ {
d->layout = l; d->layout = l;
@ -185,8 +175,6 @@ void Widget::addChild(Widget *w)
} }
w->reparent(this); w->reparent(this);
w->setParentItem(this);
d->childList.append(w); d->childList.append(w);
qDebug("Added Child Widget : %p", (void*)w); qDebug("Added Child Widget : %p", (void*)w);
@ -202,7 +190,7 @@ void Widget::addChild(Widget *w)
void Widget::reparent(Widget *w) void Widget::reparent(Widget *w)
{ {
d->parent = w; d->parent = w;
setParentItem(w);
update(); update();
} }

View File

@ -27,7 +27,6 @@
#include <kdemacros.h> #include <kdemacros.h>
#include "datavisualization.h"
#include "layoutitem.h" #include "layoutitem.h"
namespace Plasma namespace Plasma
@ -38,12 +37,8 @@ class Layout;
/** /**
* Class that emulates a QWidget inside plasma * Class that emulates a QWidget inside plasma
*/ */
class KDE_EXPORT Widget : public DataVisualization, class KDE_EXPORT Widget : public QGraphicsItem, public LayoutItem
public QGraphicsItem,
public LayoutItem
{ {
Q_OBJECT
public: public:
Widget(Widget *parent = 0); Widget(Widget *parent = 0);
virtual ~Widget(); virtual ~Widget();
@ -83,10 +78,6 @@ class KDE_EXPORT Widget : public DataVisualization,
void addChild(Widget *w); void addChild(Widget *w);
public Q_SLOTS:
virtual void updated(const QString& source, const Plasma::DataEngine::Data&);
private: private:
class Private; class Private;
Private *const d; Private *const d;