Changeset View
Changeset View
Standalone View
Standalone View
src/plasma/dataengine.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | #include "private/service_p.h" | 44 | #include "private/service_p.h" | ||
45 | #include "private/storage_p.h" | 45 | #include "private/storage_p.h" | ||
46 | #include "config-plasma.h" | 46 | #include "config-plasma.h" | ||
47 | 47 | | |||
48 | namespace Plasma | 48 | namespace Plasma | ||
49 | { | 49 | { | ||
50 | 50 | | |||
51 | DataEngine::DataEngine(const KPluginInfo &plugin, QObject *parent) | 51 | DataEngine::DataEngine(const KPluginInfo &plugin, QObject *parent) | ||
52 | : DataEngine(plugin.toMetaData(), parent) | ||||
53 | {} | ||||
54 | | ||||
55 | DataEngine::DataEngine(const KPluginMetaData &plugin, QObject *parent) | ||||
52 | : QObject(parent), | 56 | : QObject(parent), | ||
53 | d(new DataEnginePrivate(this, plugin)) | 57 | d(new DataEnginePrivate(this, plugin)) | ||
54 | { | 58 | { | ||
55 | if (d->script) { | 59 | if (d->script) { | ||
56 | d->setupScriptSupport(); | 60 | d->setupScriptSupport(); | ||
57 | d->script->init(); | 61 | d->script->init(); | ||
58 | } else { | 62 | } else { | ||
59 | // default implementation does nothing. this is for engines that have to | 63 | // default implementation does nothing. this is for engines that have to | ||
60 | // start things in motion external to themselves before they can work | 64 | // start things in motion external to themselves before they can work | ||
61 | } | 65 | } | ||
62 | } | 66 | } | ||
63 | 67 | | |||
64 | DataEngine::DataEngine(QObject *parent, const QVariantList &args) | 68 | DataEngine::DataEngine(QObject *parent, const QVariantList &args) | ||
65 | : QObject(parent), | 69 | : QObject(parent), | ||
66 | d(new DataEnginePrivate(this, KPluginInfo(args), args)) | 70 | d(new DataEnginePrivate(this, KPluginInfo(args).toMetaData(), args)) | ||
broulik: Where is this constructor used? | |||||
apol: Unsure, but we can't remove symbols anyway... | |||||
67 | { | 71 | { | ||
68 | if (d->script) { | 72 | if (d->script) { | ||
69 | d->setupScriptSupport(); | 73 | d->setupScriptSupport(); | ||
70 | d->script->init(); | 74 | d->script->init(); | ||
71 | } | 75 | } | ||
72 | } | 76 | } | ||
73 | 77 | | |||
74 | DataEngine::~DataEngine() | 78 | DataEngine::~DataEngine() | ||
Show All 20 Lines | 95 | if (d->script) { | |||
95 | } | 99 | } | ||
96 | } | 100 | } | ||
97 | 101 | | |||
98 | return new NullService(source, this); | 102 | return new NullService(source, this); | ||
99 | } | 103 | } | ||
100 | 104 | | |||
101 | KPluginInfo DataEngine::pluginInfo() const | 105 | KPluginInfo DataEngine::pluginInfo() const | ||
102 | { | 106 | { | ||
107 | return KPluginInfo(d->dataEngineDescription); | ||||
108 | } | ||||
109 | | ||||
110 | KPluginMetaData DataEngine::metadata() const | ||||
111 | { | ||||
103 | return d->dataEngineDescription; | 112 | return d->dataEngineDescription; | ||
104 | } | 113 | } | ||
105 | 114 | | |||
106 | void DataEngine::connectSource(const QString &source, QObject *visualization, | 115 | void DataEngine::connectSource(const QString &source, QObject *visualization, | ||
107 | uint pollingInterval, | 116 | uint pollingInterval, | ||
108 | Plasma::Types::IntervalAlignment intervalAlignment) const | 117 | Plasma::Types::IntervalAlignment intervalAlignment) const | ||
109 | { | 118 | { | ||
110 | //qCDebug(LOG_PLASMA) << "connectSource" << source; | 119 | //qCDebug(LOG_PLASMA) << "connectSource" << source; | ||
▲ Show 20 Lines • Show All 292 Lines • ▼ Show 20 Line(s) | |||||
403 | { | 412 | { | ||
404 | DataContainer *s = d->source(source, false); | 413 | DataContainer *s = d->source(source, false); | ||
405 | if (s) { | 414 | if (s) { | ||
406 | s->setStorageEnabled(store); | 415 | s->setStorageEnabled(store); | ||
407 | } | 416 | } | ||
408 | } | 417 | } | ||
409 | 418 | | |||
410 | // Private class implementations | 419 | // Private class implementations | ||
411 | DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info, const QVariantList &args) | 420 | DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginMetaData &md, const QVariantList &args) | ||
412 | : q(e), | 421 | : q(e), | ||
413 | dataEngineDescription(info), | 422 | dataEngineDescription(md), | ||
414 | refCount(-1), // first ref | 423 | refCount(-1), // first ref | ||
415 | checkSourcesTimerId(0), | 424 | checkSourcesTimerId(0), | ||
416 | updateTimerId(0), | 425 | updateTimerId(0), | ||
417 | minPollingInterval(-1), | 426 | minPollingInterval(-1), | ||
418 | valid(false), | 427 | valid(false), | ||
419 | script(nullptr), | 428 | script(nullptr), | ||
420 | package(nullptr) | 429 | package(nullptr) | ||
421 | { | 430 | { | ||
422 | updateTimer.start(); | 431 | updateTimer.start(); | ||
423 | 432 | | |||
424 | if (dataEngineDescription.isValid()) { | 433 | if (dataEngineDescription.isValid()) { | ||
425 | valid = true; | 434 | valid = true; | ||
426 | e->setObjectName(dataEngineDescription.name()); | 435 | e->setObjectName(dataEngineDescription.name()); | ||
427 | } | 436 | } | ||
428 | 437 | | |||
429 | if (dataEngineDescription.isValid()) { | 438 | if (dataEngineDescription.isValid()) { | ||
430 | QString api = dataEngineDescription.property(QStringLiteral("X-Plasma-API")).toString(); | 439 | QString api = dataEngineDescription.value(QStringLiteral("X-Plasma-API")); | ||
431 | 440 | | |||
432 | if (!api.isEmpty()) { | 441 | if (!api.isEmpty()) { | ||
433 | const QString path = | 442 | const QString path = | ||
434 | QStandardPaths::locate(QStandardPaths::GenericDataLocation, | 443 | QStandardPaths::locate(QStandardPaths::GenericDataLocation, | ||
435 | QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/") + dataEngineDescription.pluginName(), | 444 | QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/") + dataEngineDescription.pluginId(), | ||
436 | QStandardPaths::LocateDirectory); | 445 | QStandardPaths::LocateDirectory); | ||
437 | package = new Package(PluginLoader::self()->loadPackage(QStringLiteral("Plasma/DataEngine"), api)); | 446 | package = new Package(PluginLoader::self()->loadPackage(QStringLiteral("Plasma/DataEngine"), api)); | ||
438 | package->setPath(path); | 447 | package->setPath(path); | ||
439 | 448 | | |||
440 | if (package->isValid()) { | 449 | if (package->isValid()) { | ||
441 | script = Plasma::loadScriptEngine(api, q, args); | 450 | script = Plasma::loadScriptEngine(api, q, args); | ||
442 | } | 451 | } | ||
443 | 452 | | |||
▲ Show 20 Lines • Show All 201 Lines • Show Last 20 Lines |
Where is this constructor used?