20 #ifndef PLASMA_DATAENGINE_H
21 #define PLASMA_DATAENGINE_H
23 #include <QtCore/QHash>
24 #include <QtCore/QObject>
25 #include <QtCore/QStringList>
27 #include <kgenericfactory.h>
38 class DataEngineScript;
41 class DataEnginePrivate;
61 Q_PROPERTY(QStringList sources READ sources)
62 Q_PROPERTY(
bool valid READ isValid)
63 Q_PROPERTY(QString icon READ icon WRITE setIcon)
64 Q_PROPERTY(QString name READ name)
68 typedef QHash<QString, QVariant>
Data;
78 explicit
DataEngine(
QObject *parent = 0, KService::Ptr service = KService::Ptr(0));
99 virtual QStringList sources() const;
107 Q_INVOKABLE virtual
Service *serviceForSource(const QString &source);
112 QString name() const;
135 Q_INVOKABLE
void connectSource(
136 const QString &source,
QObject *visualization,
137 uint pollingInterval = 0,
167 Q_INVOKABLE
void connectAllSources(
QObject *visualization, uint pollingInterval = 0,
177 Q_INVOKABLE
void disconnectSource(const QString &source,
QObject *visualization) const;
189 Q_INVOKABLE
DataContainer *containerForSource(const QString &source);
201 Q_INVOKABLE
DataEngine::Data query(const QString &source) const;
208 bool isValid() const;
216 bool isEmpty() const;
224 uint maxSourceCount() const;
230 QString icon() const;
237 const
Package *package() const;
242 QString pluginName() const;
268 void sourceAdded(const QString &source);
280 void sourceRemoved(const QString &source);
303 virtual
bool sourceRequestEvent(const QString &source);
315 virtual
bool updateSourceEvent(const QString &source);
324 void setData(const QString &source, const QVariant &value);
334 void setData(const QString &source, const QString &key, const QVariant &value);
343 void setData(const QString &source, const Data &data);
350 void removeAllData(const QString &source);
358 void removeData(const QString &source, const QString &key);
376 void setMaxSourceCount(uint limit);
391 void setMinimumPollingInterval(
int minimumMs);
396 int minimumPollingInterval() const;
406 void setPollingInterval(uint frequency);
411 void removeAllSources();
420 void setValid(
bool valid);
425 SourceDict containerDict() const;
430 void timerEvent(QTimerEvent *event);
435 void setName(const QString &name);
440 void setIcon(const QString &icon);
456 void setDefaultService(const QString &serviceName);
466 void setStorageEnabled(const QString &source,
bool store);
474 void scheduleSourcesUpdated();
480 void removeSource(const QString &source);
485 void updateAllSources();
497 void forceImmediateUpdateOfAllVisualizations();
500 friend class DataEnginePrivate;
503 friend class PlasmoidServiceJob;
504 friend class NullEngine;
506 Q_PRIVATE_SLOT(d,
void internalUpdateSource(
DataContainer *source))
507 Q_PRIVATE_SLOT(d,
void sourceDestroyed(
QObject *
object))
509 DataEnginePrivate *const d;
517 #define K_EXPORT_PLASMA_DATAENGINE(libname, classname) \
518 K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
519 K_EXPORT_PLUGIN(factory("plasma_engine_" #libname)) \
520 K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
524 #endif // multiple inclusion guard
QHash< QString, DataEngine * > Dict
QHash< QString, DataContainer * > SourceDict
QHashIterator< QString, QVariant > DataIterator
QHash< QString, QVariant > Data
DataEngine loader and life time manager.
This class provides a generic API for write access to settings or services.
IntervalAlignment
Possible timing alignments.
Data provider for plasmoids (Plasma plugins)
Provides a restricted interface for scripting a DataEngine.
object representing an installed Plasmagik package
A set of data exported via a DataEngine.