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
dataenginemanager.cpp
datasource.cpp
datavisualization.cpp
plasma.cpp
interface.cpp
svg.cpp
@ -41,7 +40,6 @@ install( FILES
dataengine.h
dataenginemanager.h
datasource.h
datavisualization.h
interface.h
plasma.h
plasma_export.h
@ -63,7 +61,6 @@ install( FILES
includes/DataEngine
includes/DataEngineManager
includes/DataSource
includes/DataVisualization
includes/Svg
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 <QGraphicsSceneMouseEvent>
#include "checkbox.moc"
namespace Plasma
{
@ -53,9 +51,9 @@ class CheckBox::Private
};
CheckBox::CheckBox(QGraphicsItem *parent)
: DataVisualization(),
QGraphicsItem(parent),
d(new Private)
: QObject(),
QGraphicsItem(parent),
d(new Private)
{
setAcceptedMouseButtons(Qt::LeftButton);
setAcceptsHoverEvents(true);
@ -95,7 +93,7 @@ void CheckBox::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
options.rect = boundingRect().toRect();
options.text = text();
options.state |= (d->state == Qt::Checked)? QStyle::State_On : QStyle::State_Off;
//if (d->down) {
// options.state |= QStyle::State_Sunken;
// }
@ -248,3 +246,7 @@ event->accept();
} // namespace Plasma
#include "checkbox.moc"

View File

@ -24,8 +24,7 @@
#include <kdemacros.h>
#include "datavisualization.h"
#include <dataengine.h>
//TODO
//Please Document this class
@ -35,7 +34,7 @@ namespace 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
public:

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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