updated -> dataUpdated to make it really clear what's going on. there are too many update* methods, esp in applets where there is update() and updated()... a painful change, but it will only get worse if it happens any later.

svn path=/trunk/KDE/kdebase/workspace/libs/plasma/; revision=733314
This commit is contained in:
Aaron J. Seigo 2007-11-06 07:20:08 +00:00
parent d83f52e2db
commit b9b99b4fd2
13 changed files with 42 additions and 34 deletions

View File

@ -70,7 +70,7 @@ void DataContainer::clearData()
void DataContainer::checkForUpdate()
{
if (d->dirty) {
emit updated(objectName(), d->data);
emit dataUpdated(objectName(), d->data);
foreach (SignalRelay* relay, d->relays) {
relay->checkQueueing();
@ -103,7 +103,7 @@ bool DataContainer::hasUpdates() const
void DataContainer::checkUsage()
{
if (d->relays.count() < 1 &&
receivers(SIGNAL(updated(QString, Plasma::DataEngine::Data))) < 1) {
receivers(SIGNAL(dataUpdated(QString, Plasma::DataEngine::Data))) < 1) {
// DO NOT CALL ANYTHING AFTER THIS LINE AS IT MAY GET DELETED!
emit unused(objectName());
}
@ -120,8 +120,8 @@ void DataContainer::connectVisualization(QObject* visualization, uint updateInte
SignalRelay *relay = objIt.value();
if (relay) {
// connected to a relay
disconnect(relay, SIGNAL(updated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(updated(QString,Plasma::DataEngine::Data)));
disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
if (relay->isUnused()) {
d->relays.remove(relay->m_interval);
@ -135,8 +135,8 @@ void DataContainer::connectVisualization(QObject* visualization, uint updateInte
//kDebug() << " already connected, nothing to do";
return;
} else {
disconnect(this, SIGNAL(updated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(updated(QString,Plasma::DataEngine::Data)));
disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
}
}
@ -149,13 +149,13 @@ void DataContainer::connectVisualization(QObject* visualization, uint updateInte
if (updateInterval < 1) {
// kDebug() << " connecting directly";
connect(this, SIGNAL(updated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(updated(QString,Plasma::DataEngine::Data)));
connect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
} else {
// kDebug() << " connecting to a relay";
connect(d->signalRelay(this, visualization, updateInterval, alignment),
SIGNAL(updated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(updated(QString,Plasma::DataEngine::Data)));
SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
}
}
@ -165,12 +165,12 @@ void DataContainer::disconnectVisualization(QObject* visualization)
if (objIt == d->relayObjects.end() || !objIt.value()) {
// it is connected directly to the DataContainer itself
disconnect(this, SIGNAL(updated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(updated(QString,Plasma::DataEngine::Data)));
disconnect(this, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
} else {
SignalRelay *relay = objIt.value();
disconnect(relay, SIGNAL(updated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(updated(QString,Plasma::DataEngine::Data)));
disconnect(relay, SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data)),
visualization, SLOT(dataUpdated(QString,Plasma::DataEngine::Data)));
if (relay->isUnused()) {
d->relays.remove(relay->m_interval);

View File

@ -118,7 +118,7 @@ class PLASMA_EXPORT DataContainer : public QObject
* Emitted when the data has been updated, allowing visualization to
* reflect the new data.
**/
void updated(const QString& source, const Plasma::DataEngine::Data& data);
void dataUpdated(const QString& source, const Plasma::DataEngine::Data& data);
/**
* Emitted when this source becomes unused

View File

@ -69,7 +69,7 @@ public:
bool isUnused()
{
return receivers(SIGNAL(updated(QString,Plasma::DataEngine::Data))) < 1;
return receivers(SIGNAL(dataUpdated(QString,Plasma::DataEngine::Data))) < 1;
}
void checkAlignment()
@ -100,7 +100,7 @@ public:
void checkQueueing() {
if (m_queued) {
emit updated(dc->objectName(), d->data);
emit dataUpdated(dc->objectName(), d->data);
m_queued = false;
//TODO: should we re-align our timer at this point, to avoid
// constant queueing due to more-or-less constant time
@ -126,7 +126,7 @@ public:
bool m_queued;
signals:
void updated(const QString&, const Plasma::DataEngine::Data&);
void dataUpdated(const QString&, const Plasma::DataEngine::Data&);
protected:
void timerEvent(QTimerEvent *event)
@ -144,10 +144,10 @@ protected:
emit dc->requestUpdate(dc);
if (!dc->hasUpdates()) {
// the source wasn't actually updated; so let's put ourselves in the queue
// so we get an updated() when the data does arrive
// so we get an dataUpdated() when the data does arrive
m_queued = true;
} else {
emit updated(dc->objectName(), d->data);
emit dataUpdated(dc->objectName(), d->data);
}
event->accept();
}

View File

@ -101,7 +101,7 @@ class DataEngine::Private
s->connectVisualization(visualization, updateInterval, align);
QMetaObject::invokeMethod(visualization, "updated",
QMetaObject::invokeMethod(visualization, "dataUpdated",
Q_ARG(QString, s->objectName()),
Q_ARG(Plasma::DataEngine::Data, s->data()));
}

View File

@ -81,7 +81,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* Connects a source to an object for data updates. The object must
* have a slot with the following signature:
*
* updated(const QString &sourceName, const Plasma::DataEngine::Data &data)
* dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data)
*
* The data is a QHash of QVariants keyed by QString names, allowing
* one data source to provide sets of related data.
@ -105,7 +105,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* Connects all sources to an object for data updates. The object must
* have a slot with the following signature:
*
* SLOT(updated(QString, Plasma::DataEngine::Data))
* SLOT(dataUpdated(QString, Plasma::DataEngine::Data))
*
* The data is a QHash of QVariants keyed by QString names, allowing
* one data source to provide sets of related data.
@ -137,7 +137,7 @@ class PLASMA_EXPORT DataEngine : public QObject
* Retrevies a pointer to the DataContainer for a given source. This method
* should not be used if possible. An exception is for script engines that
* can not provide a QMetaObject as required by connectSource for the initial
* call to updated(). Using this method, such engines can provide their own
* call to dataUpdated. Using this method, such engines can provide their own
* connectSource API.
*
* @arg source the name of the source.
@ -371,7 +371,7 @@ class PLASMA_EXPORT DataEngine : public QObject
/**
* Call this method when you call setData directly on a DataContainer instead
* of using the DataEngine::setData methods.
* If this method is not called, no updated(..) signals will be emitted!
* If this method is not called, no dataUpdated(..) signals will be emitted!
*/
void checkForUpdates();

View File

@ -119,7 +119,7 @@ void CheckBox::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *op
widget-> style()->drawControl(QStyle::CE_CheckBox, &options, painter, widget);
}
void CheckBox::updated(const QString&, const DataEngine::Data& data)
void CheckBox::dataUpdated(const QString&, const DataEngine::Data& data)
{
foreach (const QVariant& variant, data) {
if (variant.canConvert(QVariant::Bool)) {

View File

@ -100,7 +100,7 @@ public:
*/
public Q_SLOTS:
void updated(const QString&, const DataEngine::Data&);
void dataUpdated(const QString&, const DataEngine::Data&);
Q_SIGNALS:
/**

View File

@ -97,7 +97,7 @@ void LineEdit::paintWidget(QPainter *painter, const QStyleOptionGraphicsItem *op
QGraphicsTextItem::paint(painter, style, widget);
}
void LineEdit::updated(const QString&, const DataEngine::Data& data)
void LineEdit::dataUpdated(const QString&, const DataEngine::Data& data)
{
DataEngine::DataIterator it(data);

View File

@ -88,7 +88,7 @@ class PLASMA_EXPORT LineEdit : public QGraphicsTextItem, public LayoutItem
void textChanged(const QString &text);
public Q_SLOTS:
void updated(const QString&, const Plasma::DataEngine::Data&);
void dataUpdated(const QString&, const Plasma::DataEngine::Data&);
private:
class Private;

View File

@ -205,7 +205,7 @@ Qt::Alignment Meter::labelAlignment(int index) const
return d->alignments[index];
}
void Meter::updated(QString sourceName, Plasma::DataEngine::Data data)
void Meter::dataUpdated(QString sourceName, Plasma::DataEngine::Data data)
{
Q_UNUSED(sourceName)

View File

@ -192,7 +192,7 @@ public Q_SLOTS:
/**
* Used when connecting to a DataEngine
*/
void updated(QString sourceName, Plasma::DataEngine::Data data);
void dataUpdated(QString sourceName, Plasma::DataEngine::Data data);
protected:
/**

View File

@ -149,9 +149,17 @@ void RadioButton::setText(const QString &text)
update();
}
void RadioButton::updated(const QString&, const Plasma::DataEngine::Data &data)
void RadioButton::dataUpdated(const QString&, const Plasma::DataEngine::Data &data)
{
Q_UNUSED(data);
DataEngine::DataIterator it(data);
while (it.hasNext()) {
it.next();
if (it.value().canConvert(QVariant::Bool)) {
setChecked(it.value().toBool());
return;
}
}
}
void RadioButton::mousePressEvent(QGraphicsSceneMouseEvent *event)

View File

@ -71,7 +71,7 @@ public:
void setText(const QString &text);
public Q_SLOTS:
void updated(const QString&, const Plasma::DataEngine::Data &data);
void dataUpdated(const QString&, const Plasma::DataEngine::Data &data);
Q_SIGNALS:
void clicked();