Changeset View
Changeset View
Standalone View
Standalone View
src/qml/plugin.cpp
Show All 20 Lines | |||||
21 | #include "plugin.h" | 21 | #include "plugin.h" | ||
22 | 22 | | |||
23 | #include <QtQml> | 23 | #include <QtQml> | ||
24 | 24 | | |||
25 | #include "pulseaudio.h" | 25 | #include "pulseaudio.h" | ||
26 | #include "client.h" | 26 | #include "client.h" | ||
27 | #include "sink.h" | 27 | #include "sink.h" | ||
28 | #include "source.h" | 28 | #include "source.h" | ||
29 | #include "context.h" | ||||
29 | 30 | | |||
30 | #include "globalactioncollection.h" | 31 | #include "globalactioncollection.h" | ||
31 | #include "volumeosd.h" | 32 | #include "volumeosd.h" | ||
32 | 33 | | |||
34 | static QJSValue pulseaudio_singleton(QQmlEngine *engine, QJSEngine *scriptEngine) | ||||
35 | { | ||||
36 | Q_UNUSED(engine) | ||||
37 | | ||||
38 | QJSValue object = scriptEngine->newObject(); | ||||
39 | object.setProperty(QStringLiteral("NormalVolume"), (double) QPulseAudio::Context::NormalVolume); | ||||
40 | object.setProperty(QStringLiteral("MinimalVolume"), (double) QPulseAudio::Context::MinimalVolume); | ||||
41 | object.setProperty(QStringLiteral("MaximalVolume"), (double) QPulseAudio::Context::MaximalVolume); | ||||
42 | return object; | ||||
43 | } | ||||
44 | | ||||
33 | void Plugin::registerTypes(const char* uri) | 45 | void Plugin::registerTypes(const char* uri) | ||
34 | { | 46 | { | ||
35 | qmlRegisterType<QPulseAudio::CardModel>(uri, 0, 1, "CardModel"); | 47 | qmlRegisterType<QPulseAudio::CardModel>(uri, 0, 1, "CardModel"); | ||
36 | qmlRegisterType<QPulseAudio::SinkModel>(uri, 0, 1, "SinkModel"); | 48 | qmlRegisterType<QPulseAudio::SinkModel>(uri, 0, 1, "SinkModel"); | ||
37 | qmlRegisterType<QPulseAudio::SinkInputModel>(uri, 0, 1, "SinkInputModel"); | 49 | qmlRegisterType<QPulseAudio::SinkInputModel>(uri, 0, 1, "SinkInputModel"); | ||
38 | qmlRegisterType<QPulseAudio::SourceModel>(uri, 0, 1, "SourceModel"); | 50 | qmlRegisterType<QPulseAudio::SourceModel>(uri, 0, 1, "SourceModel"); | ||
39 | qmlRegisterType<QPulseAudio::SourceOutputModel>(uri, 0, 1, "SourceOutputModel"); | 51 | qmlRegisterType<QPulseAudio::SourceOutputModel>(uri, 0, 1, "SourceOutputModel"); | ||
40 | qmlRegisterType<GlobalAction>(uri, 0, 1, "GlobalAction"); | 52 | qmlRegisterType<GlobalAction>(uri, 0, 1, "GlobalAction"); | ||
41 | qmlRegisterType<GlobalActionCollection>(uri, 0, 1, "GlobalActionCollection"); | 53 | qmlRegisterType<GlobalActionCollection>(uri, 0, 1, "GlobalActionCollection"); | ||
42 | qmlRegisterType<VolumeOSD>(uri, 0, 1, "VolumeOSD"); | 54 | qmlRegisterType<VolumeOSD>(uri, 0, 1, "VolumeOSD"); | ||
55 | qmlRegisterSingletonType(uri, 0, 1, "PulseAudio", pulseaudio_singleton); | ||||
43 | 56 | | |||
44 | qmlRegisterType<QPulseAudio::Client>(); | 57 | qmlRegisterType<QPulseAudio::Client>(); | ||
45 | qmlRegisterType<QPulseAudio::Sink>(); | 58 | qmlRegisterType<QPulseAudio::Sink>(); | ||
46 | qmlRegisterType<QPulseAudio::Source>(); | 59 | qmlRegisterType<QPulseAudio::Source>(); | ||
47 | } | 60 | } |