• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

Plasma

  • sources
  • kde-4.12
  • kdelibs
  • plasma
dataengine.h
Go to the documentation of this file.
1 /*
2  * Copyright 2006-2007 Aaron Seigo <aseigo@kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Library General Public License as
6  * published by the Free Software Foundation; either version 2, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef PLASMA_DATAENGINE_H
21 #define PLASMA_DATAENGINE_H
22 
23 #include <QtCore/QHash>
24 #include <QtCore/QObject>
25 #include <QtCore/QStringList>
26 
27 #include <kgenericfactory.h>
28 #include <kservice.h>
29 
30 #include <plasma/version.h>
31 #include <plasma/plasma.h>
32 #include <plasma/service.h>
33 
34 namespace Plasma
35 {
36 
37 class DataContainer;
38 class DataEngineScript;
39 class Package;
40 class Service;
41 class DataEnginePrivate;
42 
58 class PLASMA_EXPORT DataEngine : public QObject
59 {
60  Q_OBJECT
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)
65 
66  public:
67  typedef QHash<QString, DataEngine*> Dict;
68  typedef QHash<QString, QVariant> Data;
69  typedef QHashIterator<QString, QVariant> DataIterator;
70  typedef QHash<QString, DataContainer*> SourceDict;
71 
78  explicit DataEngine(QObject *parent = 0, KService::Ptr service = KService::Ptr(0));
79  DataEngine(QObject *parent, const QVariantList &args);
80  ~DataEngine();
81 
91  virtual void init();
92 
99  virtual QStringList sources() const;
100 
107  Q_INVOKABLE virtual Service *serviceForSource(const QString &source);
108 
112  QString name() const;
113 
135  Q_INVOKABLE void connectSource(
136  const QString &source, QObject *visualization,
137  uint pollingInterval = 0,
138  Plasma::IntervalAlignment intervalAlignment = NoAlignment) const;
139 
167  Q_INVOKABLE void connectAllSources(QObject *visualization, uint pollingInterval = 0,
168  Plasma::IntervalAlignment intervalAlignment =
169 NoAlignment) const;
170 
177  Q_INVOKABLE void disconnectSource(const QString &source, QObject *visualization) const;
178 
189  Q_INVOKABLE DataContainer *containerForSource(const QString &source);
190 
201  Q_INVOKABLE DataEngine::Data query(const QString &source) const;
202 
208  bool isValid() const;
209 
216  bool isEmpty() const;
217 
224  uint maxSourceCount() const;
225 
230  QString icon() const;
231 
237  const Package *package() const;
238 
242  QString pluginName() const;
243 
255  Q_INVOKABLE Service* createDefaultService(QObject *parent = 0);
256 
257  Q_SIGNALS:
268  void sourceAdded(const QString &source);
269 
280  void sourceRemoved(const QString &source);
281 
282  protected:
303  virtual bool sourceRequestEvent(const QString &source);
304 
315  virtual bool updateSourceEvent(const QString &source);
316 
324  void setData(const QString &source, const QVariant &value);
325 
334  void setData(const QString &source, const QString &key, const QVariant &value);
335 
343  void setData(const QString &source, const Data &data);
344 
350  void removeAllData(const QString &source);
351 
358  void removeData(const QString &source, const QString &key);
359 
367  void addSource(DataContainer *source);
368 
376  void setMaxSourceCount(uint limit);
377 
391  void setMinimumPollingInterval(int minimumMs);
392 
396  int minimumPollingInterval() const;
397 
406  void setPollingInterval(uint frequency);
407 
411  void removeAllSources();
412 
420  void setValid(bool valid);
421 
425  SourceDict containerDict() const;
426 
430  void timerEvent(QTimerEvent *event);
431 
435  void setName(const QString &name);
436 
440  void setIcon(const QString &icon);
441 
456  void setDefaultService(const QString &serviceName);
457 
466  void setStorageEnabled(const QString &source, bool store);
467 
468  protected Q_SLOTS:
474  void scheduleSourcesUpdated();
475 
480  void removeSource(const QString &source);
481 
485  void updateAllSources();
486 
497  void forceImmediateUpdateOfAllVisualizations();
498 
499  private:
500  friend class DataEnginePrivate;
501  friend class DataEngineScript;
502  friend class DataEngineManager;
503  friend class PlasmoidServiceJob;
504  friend class NullEngine;
505 
506  Q_PRIVATE_SLOT(d, void internalUpdateSource(DataContainer *source))
507  Q_PRIVATE_SLOT(d, void sourceDestroyed(QObject *object))
508 
509  DataEnginePrivate *const d;
510 };
511 
512 } // Plasma namespace
513 
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)
521 
522 Q_DECLARE_METATYPE(Plasma::DataEngine*)
523 
524 #endif // multiple inclusion guard
Plasma::DataEngine::Dict
QHash< QString, DataEngine * > Dict
Definition: dataengine.h:67
Plasma::DataEngine::SourceDict
QHash< QString, DataContainer * > SourceDict
Definition: dataengine.h:70
Plasma::DataEngine::DataIterator
QHashIterator< QString, QVariant > DataIterator
Definition: dataengine.h:69
Plasma::DataEngine::Data
QHash< QString, QVariant > Data
Definition: dataengine.h:68
QObject
Plasma::DataEngineManager
DataEngine loader and life time manager.
Definition: dataenginemanager.h:42
Plasma::Service
This class provides a generic API for write access to settings or services.
Definition: service.h:91
Plasma::IntervalAlignment
IntervalAlignment
Possible timing alignments.
Definition: plasma.h:181
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition: dataengine.h:58
Plasma::DataEngineScript
Provides a restricted interface for scripting a DataEngine.
Definition: dataenginescript.h:41
Plasma::Package
object representing an installed Plasmagik package
Definition: package.h:42
version.h
plasma.h
service.h
Plasma::DataContainer
A set of data exported via a DataEngine.
Definition: datacontainer.h:63
Plasma::NoAlignment
No alignment.
Definition: plasma.h:182
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:48:33 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal