libplasma
Plasma::DataContainer Class Reference
#include <datacontainer.h>

Detailed Description
A set of data exported via a DataEngine.Plasma::DataContainer wraps the data exported by a DataEngine implementation, providing a generic wrapper for the data.
A DataContainer may have zero or more associated pieces of data which are keyed by strings. The data itself is stored as QVariants. This allows easy and flexible retrieval of the information associated with this object without writing DataContainer or DataEngine specific code in visualizations.
Definition at line 45 of file datacontainer.h.
Public Slots | |
void | disconnectVisualization (QObject *visualization) |
Signals | |
void | becameUnused (const QString &source) |
void | dataUpdated (const QString &source, const Plasma::DataEngine::Data &data) |
void | updateRequested (DataContainer *source) |
Public Member Functions | |
void | connectVisualization (QObject *visualization, uint pollingInterval, Plasma::IntervalAlignment alignment) |
const DataEngine::Data | data () const |
DataContainer (QObject *parent=0) | |
void | removeAllData () |
void | setData (const QString &key, const QVariant &value) |
bool | visualizationIsConnected (QObject *visualization) const |
virtual | ~DataContainer () |
Protected Slots | |
void | checkUsage () |
Protected Member Functions | |
void | checkForUpdate () |
void | setNeedsUpdate (bool update=true) |
uint | timeSinceLastUpdate () const |
Constructor & Destructor Documentation
Plasma::DataContainer::DataContainer | ( | QObject * | parent = 0 |
) | [explicit] |
Constructs a default DataContainer, which has no name or data associated with it.
Definition at line 32 of file datacontainer.cpp.
Plasma::DataContainer::~DataContainer | ( | ) | [virtual] |
Definition at line 38 of file datacontainer.cpp.
Member Function Documentation
void Plasma::DataContainer::becameUnused | ( | const QString & | source | ) | [signal] |
Emitted when this source becomes unused.
void Plasma::DataContainer::checkForUpdate | ( | ) | [protected] |
Checks for whether the data has changed and therefore an update signal needs to be emitted.
Definition at line 158 of file datacontainer.cpp.
void Plasma::DataContainer::checkUsage | ( | ) | [protected, slot] |
Check if the DataContainer is still in use.
If not the signal "becameUnused" will be emitted. Warning: The DataContainer may be invalid after calling this function.
Definition at line 183 of file datacontainer.cpp.
void Plasma::DataContainer::connectVisualization | ( | QObject * | visualization, | |
uint | pollingInterval, | |||
Plasma::IntervalAlignment | alignment | |||
) |
Connects an object to this DataContainer.
May be called repeatedly for the same visualization without side effects
- Parameters:
-
visualization the object to connect to this DataContainer pollingInterval the time in milliseconds between updates
Definition at line 77 of file datacontainer.cpp.
const DataEngine::Data Plasma::DataContainer::data | ( | ) | const |
void Plasma::DataContainer::dataUpdated | ( | const QString & | source, | |
const Plasma::DataEngine::Data & | data | |||
) | [signal] |
Emitted when the data has been updated, allowing visualization to reflect the new data.
void Plasma::DataContainer::disconnectVisualization | ( | QObject * | visualization | ) | [slot] |
void Plasma::DataContainer::removeAllData | ( | ) |
Removes all data currently associated with this source.
Definition at line 60 of file datacontainer.cpp.
Set a value for a key.
This also marks this source as needing to signal an update. After calling this, a call to checkForUpdate() is done by the engine. This allows for batching updates.
- Parameters:
-
key a string used as the key for the data value a QVariant holding the actual data. If a null or invalid QVariant is passed in and the key currently exists in the data, then the data entry is removed
Definition at line 48 of file datacontainer.cpp.
void Plasma::DataContainer::setNeedsUpdate | ( | bool | update = true |
) | [protected] |
Indicates that the data should be treated as dirty the next time hasUpdates() is called.
why? because if one SignalRelay times out just after another, the minimum update interval stops a real update from being done - but that relay still needs to be given data, because it won't have been in the queue and won't have gotten that last update. when it checks hasUpdates() we'll lie, and then everything will return to normal.
Definition at line 178 of file datacontainer.cpp.
uint Plasma::DataContainer::timeSinceLastUpdate | ( | ) | const [protected] |
Returns how long ago, in msecs, that the data in this container was last updated.
Definition at line 171 of file datacontainer.cpp.
void Plasma::DataContainer::updateRequested | ( | DataContainer * | source | ) | [signal] |
Emitted when the source, usually due to an internal timer firing, requests to be updated.
bool Plasma::DataContainer::visualizationIsConnected | ( | QObject * | visualization | ) | const |
- Returns:
- true if the visualization is currently connected
Definition at line 72 of file datacontainer.cpp.
The documentation for this class was generated from the following files: