diff --git a/datacontainer.cpp b/datacontainer.cpp index 457d8c53d..15b897f0a 100644 --- a/datacontainer.cpp +++ b/datacontainer.cpp @@ -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); diff --git a/datacontainer.h b/datacontainer.h index c1963badf..55d161e89 100644 --- a/datacontainer.h +++ b/datacontainer.h @@ -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 diff --git a/datacontainer_p.h b/datacontainer_p.h index 339392e9b..22c75f3c3 100644 --- a/datacontainer_p.h +++ b/datacontainer_p.h @@ -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(); } diff --git a/dataengine.cpp b/dataengine.cpp index c5d9c2394..34c1756a7 100644 --- a/dataengine.cpp +++ b/dataengine.cpp @@ -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())); } diff --git a/dataengine.h b/dataengine.h index d7aa11e36..394ef9ee5 100644 --- a/dataengine.h +++ b/dataengine.h @@ -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(); diff --git a/widgets/checkbox.cpp b/widgets/checkbox.cpp index abffa5fac..926bb97bd 100644 --- a/widgets/checkbox.cpp +++ b/widgets/checkbox.cpp @@ -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)) { diff --git a/widgets/checkbox.h b/widgets/checkbox.h index f7144bc4b..2647e4da3 100644 --- a/widgets/checkbox.h +++ b/widgets/checkbox.h @@ -100,7 +100,7 @@ public: */ public Q_SLOTS: - void updated(const QString&, const DataEngine::Data&); + void dataUpdated(const QString&, const DataEngine::Data&); Q_SIGNALS: /** diff --git a/widgets/lineedit.cpp b/widgets/lineedit.cpp index 979d7a5dc..068b9d93c 100644 --- a/widgets/lineedit.cpp +++ b/widgets/lineedit.cpp @@ -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); diff --git a/widgets/lineedit.h b/widgets/lineedit.h index bb2035416..f43a2f309 100644 --- a/widgets/lineedit.h +++ b/widgets/lineedit.h @@ -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; diff --git a/widgets/meter.cpp b/widgets/meter.cpp index ec8988e2a..699c61e1b 100644 --- a/widgets/meter.cpp +++ b/widgets/meter.cpp @@ -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) diff --git a/widgets/meter.h b/widgets/meter.h index 84bdc7730..4c2cc1ed1 100644 --- a/widgets/meter.h +++ b/widgets/meter.h @@ -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: /** diff --git a/widgets/radiobutton.cpp b/widgets/radiobutton.cpp index efe9a4f27..640ab3f33 100644 --- a/widgets/radiobutton.cpp +++ b/widgets/radiobutton.cpp @@ -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) diff --git a/widgets/radiobutton.h b/widgets/radiobutton.h index e90037479..0f123b6bb 100644 --- a/widgets/radiobutton.h +++ b/widgets/radiobutton.h @@ -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();