88
89
* @param source the name of the data source
89
90
* @param visualization the object to connect the data source to
91
Q_INVOKABLE void connectSource(const QString& source, QObject* visualization) const;
91
* @param updateInterval the frequency, in milliseconds, with which to signal updates;
92
* a value of 0 (the default) means to update only
93
* when there is new data spontaneously generated
94
* (e.g. by the engine); any other value results in
95
* periodic updates from this source. This value is
96
* per-visualization and can be handy for items that require
97
* constant updates such as scrolling graphs or clocks.
98
* @param intervalAlignedTo the number of ms to aling the interval to
100
Q_INVOKABLE void connectSource(const QString& source, QObject* visualization,
101
uint updateInterval = 0,
102
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
105
* Connects all sources to an object for data updates. The object must
106
* have a slot with the following signature:
108
* SLOT(updated(QString, Plasma::DataEngine::Data))
110
* The data is a QHash of QVariants keyed by QString names, allowing
111
* one data source to provide sets of related data.
113
* This method may be called multiple times for the same visualization
114
* without side-effects. This can be useful to change the updateInterval.
116
* @param visualization the object to connect the data source to
117
* @param updateInterval the frequency, in milliseconds, with which to signal updates;
118
* a value of 0 (the default) means to update only
119
* when there is new data spontaneously generated
120
* (e.g. by the engine); any other value results in
121
* periodic updates from this source. This value is
122
* per-visualization and can be handy for items that require
123
* constant updates such as scrolling graphs or clocks.
125
Q_INVOKABLE void connectAllSources(QObject* viualization, uint updateInterval = 0,
126
Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
94
129
* Disconnects a source to an object that was receiving data updates.
99
134
Q_INVOKABLE void disconnectSource(const QString& source, QObject* visualization) const;
102
* Connects all sources to an object for data updates. The object must
103
* have a slot with the following signature:
105
* SLOT(updated(QString, Plasma::DataEngine::Data))
107
* The data is a QHash of QVariants keyed by QString names, allowing
108
* one data source to provide sets of related data.
110
* @param visualization the object to connect the data source to
112
Q_INVOKABLE void connectAllSources(QObject* viualization) const;
115
137
* Retrevies a pointer to the DataContainer for a given source. This method
116
138
* should not be used if possible. An exception is for script engines that
117
139
* can not provide a QMetaObject as required by connectSource for the initial
202
224
* otherwise the requesting visualization may not receive notice of a
227
* If the source can not be populated with data immediately (e.g. due to
228
* an asynchronous data acquisition method such as an HTTP request)
229
* the source must still be created, even if it is empty. This can
230
* be accomplished in these cases with the follow line:
232
* setData(name, DataEngine::Data());
205
234
* @return true if a DataContainer was set up, false otherwise
207
236
virtual bool sourceRequested(const QString &name);
239
* Called by internal updating mechanisms to trigger the engine
240
* to refresh the data contained in a given source. Reimplement this
241
* method when using facilities such as setUpdateInterval.
242
* @see setUpdateInterval
244
* @param source the name of the source that should be updated
245
* @return true if the data was changed, or false if there was no
246
* change or if the change will occur later
248
virtual bool updateSource(const QString& source);
210
251
* Sets a value for a data source. If the source
211
252
* doesn't exist then it is created.
266
307
void setSourceLimit(uint limit);
268
/* DataContainer* domain(const QString &domain);
269
void createDataContainer(const QString& source,
270
const QString& domain = QString());*/
310
* Sets the minimum amount of time, in milliseconds, that must pass between
311
* successive updates of data. This can help prevent too many updates happening
312
* due to multiple update requests coming in, which can be useful for
313
* expensive (time- or resource-wise) update mechanisms.
315
* @arg minimumMs the minimum time lapse, in milliseconds, between updates.
316
* A value less than 0 means to never perform automatic updates,
317
* a value of 0 means update immediately on every update request,
318
* a value >0 will result in a minimum time lapse being enforced.
320
void setMinimumUpdateInterval(int minimumMs);
323
* @return the minimum time between updates. @see setMinimumupdateInterval
325
int minimumUpdateInterval() const;
328
* Sets up an internal update tick for all data sources. On every update,
329
* updateSource will be called for each applicable source.
332
* @param frequency the time, in milliseconds, between updates. A value of 0
333
* will stop internally triggered updates.
335
void setUpdateInterval(uint frequency);
338
* Returns the current update frequency.
339
* @see setUpdateInterval
340
NOTE: This is not implemented to prevent having to store the value internally.
341
When there is a good use case for needing access to this value, we can
342
add another member to the Private class and add this method.
343
uint updateInterval();
273
347
* Removes all data sources