File indexing completed on 2024-06-16 10:44:15

0001 /*
0002     SPDX-FileCopyrightText: 2018 David Rosca <nowrep@gmail.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 #include <QGuiApplication>
0007 #include <QQmlApplicationEngine>
0008 
0009 #include "models.h"
0010 #include "port.h"
0011 
0012 class Enums : public QObject
0013 {
0014     Q_OBJECT
0015 public:
0016     Q_INVOKABLE QString portTypeToString(int type)
0017     {
0018         QMetaObject metaObject = PulseAudioQt::Port::staticMetaObject;
0019         QMetaEnum metaEnum = metaObject.enumerator(metaObject.indexOfEnumerator("Type"));
0020 
0021         return QString(metaEnum.valueToKey(type));
0022     }
0023 };
0024 
0025 int main(int argc, char *argv[])
0026 {
0027     QGuiApplication app(argc, argv);
0028 
0029     const char *uri = "org.kde.pulseaudioqt.tests";
0030 
0031     qmlRegisterType<PulseAudioQt::CardModel>(uri, 0, 1, "CardModel");
0032     qmlRegisterType<PulseAudioQt::SinkModel>(uri, 0, 1, "SinkModel");
0033     qmlRegisterType<PulseAudioQt::SinkInputModel>(uri, 0, 1, "SinkInputModel");
0034     qmlRegisterType<PulseAudioQt::SourceModel>(uri, 0, 1, "SourceModel");
0035     qmlRegisterType<PulseAudioQt::SourceOutputModel>(uri, 0, 1, "SourceOutputModel");
0036     qmlRegisterType<PulseAudioQt::StreamRestoreModel>(uri, 0, 1, "StreamRestoreModel");
0037     qmlRegisterType<PulseAudioQt::ModuleModel>(uri, 0, 1, "ModuleModel");
0038 
0039     Enums e;
0040     qmlRegisterSingletonInstance("org.kde.pulseaudioqt.painspector", 1, 0, "Enums", &e);
0041 
0042     QQmlApplicationEngine engine(QUrl(QStringLiteral("qrc:/main.qml")));
0043     return app.exec();
0044 }
0045 
0046 #include "main.moc"