-
Notifications
You must be signed in to change notification settings - Fork 5
/
plugin.cpp
53 lines (42 loc) · 1.57 KB
/
plugin.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include <QDir>
#include <QJSEngine>
#include <QLoggingCategory>
#include <QQmlEngine>
#include <QQmlExtensionPlugin>
#include <QtQml>
#include "influxdb.h"
#include "lmsensors.h"
#include "linegraph.h"
Q_LOGGING_CATEGORY(lcRegistration, "org.ecloud.charts.registration")
static const char *ModuleName = "org.ecloud.charts";
static QObject *LmSensorsSingleton(QQmlEngine *engine, QJSEngine *scriptEngine)
{
Q_UNUSED(engine)
Q_UNUSED(scriptEngine)
LmSensors *ret = new LmSensors();
return ret;
}
class ChartsPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface/1.0")
public:
ChartsPlugin() : QQmlExtensionPlugin() { }
virtual void initializeEngine(QQmlEngine *engine, const char * uri) {
Q_UNUSED(engine)
qCDebug(lcRegistration) << uri;
}
virtual void registerTypes(const char *uri) {
qCDebug(lcRegistration) << uri;
Q_ASSERT(uri == QLatin1String(ModuleName));
qmlRegisterType<LineGraph>(uri, 1, 0, "LineGraph");
qmlRegisterType<LineGraphModel>(uri, 1, 0, "LineGraphModel");
qmlRegisterSingletonType<LmSensors>(uri, 1, 0, "LmSensors", LmSensorsSingleton);
qmlRegisterType<Sensor>(uri, 1, 0, "Sensor");
qmlRegisterType<InfluxQuery>(uri, 1, 0, "InfluxQuery");
qmlRegisterUncreatableType<InfluxValueSeries>(uri, 1, 0, "InfluxValueSeries", "InfluxValueSeries is only available from InfluxQuery");
// qmlRegisterType<InfluxValueSeries>(uri, 1, 0, "InfluxValueSeries");
}
};
QT_END_NAMESPACE
#include "plugin.moc"