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

Plasma

  • 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
34namespace Plasma
35{
36
37class DataContainer;
38class DataEngineScript;
39class Package;
40class Service;
41class DataEnginePrivate;
42
58class 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 =
169NoAlignment) 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) \
518K_PLUGIN_FACTORY(factory, registerPlugin<classname>();) \
519K_EXPORT_PLUGIN(factory("plasma_engine_" #libname)) \
520K_EXPORT_PLUGIN_VERSION(PLASMA_VERSION)
521
522Q_DECLARE_METATYPE(Plasma::DataEngine*)
523
524#endif // multiple inclusion guard
Plasma::DataContainer
A set of data exported via a DataEngine.
Definition: datacontainer.h:64
Plasma::DataEngineManager
DataEngine loader and life time manager.
Definition: dataenginemanager.h:43
Plasma::DataEngineScript
Provides a restricted interface for scripting a DataEngine.
Definition: dataenginescript.h:42
Plasma::DataEngine
Data provider for plasmoids (Plasma plugins)
Definition: dataengine.h:59
Plasma::DataEngine::sourceRemoved
void sourceRemoved(const QString &source)
Emitted when a data source is removed.
Plasma::DataEngine::DataIterator
QHashIterator< QString, QVariant > DataIterator
Definition: dataengine.h:69
Plasma::DataEngine::Dict
QHash< QString, DataEngine * > Dict
Definition: dataengine.h:67
Plasma::DataEngine::SourceDict
QHash< QString, DataContainer * > SourceDict
Definition: dataengine.h:70
Plasma::DataEngine::Data
QHash< QString, QVariant > Data
Definition: dataengine.h:68
Plasma::DataEngine::sourceAdded
void sourceAdded(const QString &source)
Emitted when a new data source is created.
Plasma::Package
object representing an installed Plasmagik package
Definition: package.h:43
Plasma::Service
This class provides a generic API for write access to settings or services.
Definition: service.h:92
QObject
Plasma
Namespace for everything in libplasma.
Definition: abstractdialogmanager.cpp:25
Plasma::IntervalAlignment
IntervalAlignment
Possible timing alignments.
Definition: plasma.h:181
plasma.h
service.h
version.h
<Plasma/Version>
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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