Load the time engine and get data out of it.
This commit is contained in:
parent
a05373595d
commit
dac60f8ab8
@ -56,7 +56,7 @@ find_package(kdeqt5staging REQUIRED NO_MODULE)
|
||||
# Load CMake, Compiler and InstallDirs settings from KF5 and the following are already somewhat "done" tier1/tier2 libs from kdelibs:
|
||||
find_package(KF5 MODULE REQUIRED COMPONENTS CMake Compiler InstallDirs
|
||||
XmlGui KIdleTime ItemModels KWidgetsAddons KWindowSystem KCodecs KArchive KCoreAddons Solid ThreadWeaver
|
||||
KConfig KAuth kjs KWallet
|
||||
KConfig KAuth kjs KWallet
|
||||
ki18n kguiaddons kservice kwidgets ItemViews KNotifications KCompletion KJobWidgets KConfigWidgets KIconThemes)
|
||||
#find_package(KF5Transitional REQUIRED)
|
||||
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "plugintest.h"
|
||||
|
||||
#include <kqpluginfactoryinterface.h>
|
||||
|
||||
#include <kdebug.h>
|
||||
#include <kservice.h>
|
||||
#include <kservicetypetrader.h>
|
||||
@ -43,6 +45,7 @@
|
||||
#include <QStandardPaths>
|
||||
#include <QStringList>
|
||||
#include <QTimer>
|
||||
#include <QJsonObject>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
@ -72,11 +75,45 @@ PluginTest::~PluginTest()
|
||||
void PluginTest::runMain()
|
||||
{
|
||||
qDebug() << "plugin test runs: ";
|
||||
loadDataEngine();
|
||||
//loadDataEngine();
|
||||
qDebug() << " libs are in: " << QCoreApplication::libraryPaths();
|
||||
qDebug() << " - - - -- - - - - ------------------------------------\n";
|
||||
loadKQPlugin();
|
||||
exit(0);
|
||||
return;
|
||||
}
|
||||
|
||||
void PluginTest::loadKQPlugin()
|
||||
{
|
||||
qDebug() << "Load KQPlugin";
|
||||
QString pluginPath = "/home/sebas/kf5/install/lib/x86_64-linux-gnu/kplugins/";
|
||||
QCoreApplication::addLibraryPath(pluginPath);
|
||||
//QPluginLoader loader("/home/sebas/kf5/install/lib/x86_64-linux-gnu/kplugins/libkqpluginfactory.so", this);
|
||||
QPluginLoader loader("/home/sebas/kf5/install/lib/x86_64-linux-gnu/plugins/kf5/kplugins/libplasma_engine_time.so", this);
|
||||
KQPluginFactoryInterface *factory = qobject_cast<KQPluginFactoryInterface*>(loader.instance());
|
||||
//QObject *factory = loader.instance();
|
||||
if (factory) {
|
||||
qDebug() << "loaded successfully and cast";
|
||||
qDebug() << "metadata: " << loader.metaData();
|
||||
QObject *o = factory->createPlugin("time");
|
||||
qDebug() << " objec name:" << o->objectName();
|
||||
Plasma::DataEngine *time_engine = qobject_cast<Plasma::DataEngine*>(o);
|
||||
if (time_engine) {
|
||||
qDebug() << "Successfully loaded timeengine";
|
||||
time_engine->connectSource("Europe/Amsterdam", this);
|
||||
qDebug() << "SOURCE: " << time_engine->sources();
|
||||
} else {
|
||||
qDebug() << "Timeengine failed to load. :(";
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
qDebug() << "loading failed somehow";
|
||||
}
|
||||
//KQPluginFactory* factory = new KQPluginFactory(KPluginInfo(), this);
|
||||
|
||||
}
|
||||
|
||||
void PluginTest::loadDataEngine(const QString &name)
|
||||
{
|
||||
// DataEngine *engine = d->isDefaultLoader ? 0 : internalLoadDataEngine(name);
|
||||
@ -148,9 +185,6 @@ void PluginTest::dataUpdated(QString s, Plasma::DataEngine::Data d)
|
||||
qDebug() << "new data for source: " << s << d;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
} // namespace Plasma
|
||||
|
@ -45,6 +45,7 @@ class PluginTest : public QApplication
|
||||
|
||||
public Q_SLOTS:
|
||||
void runMain();
|
||||
void loadKQPlugin();
|
||||
void loadDataEngine(const QString &name = QString());
|
||||
void dataUpdated(QString s, Plasma::DataEngine::Data d);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user