2 * Copyright (C) 2016 The Qt Company Ltd.
3 * Copyright (C) 2016,2017 Konsulko Group
4 * Copyright (C) 2018 IoT.bzh
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 #include <QGuiApplication>
20 #include <QtCore/QCommandLineParser>
21 #include <QtCore/QUrlQuery>
22 #include <QtGui/QGuiApplication>
23 #include <QtQml/QQmlContext>
24 #include <QtQml/QQmlApplicationEngine>
25 #include <QtQml/qqml.h>
29 #include "audiorole.hpp"
31 int main(int argc, char *argv[])
33 QGuiApplication app(argc, argv);
34 app.setDesktopFileName("mixer");
36 QQmlApplicationEngine engine;
37 QQmlContext *context = engine.rootContext();
39 QCommandLineParser parser;
40 parser.addPositionalArgument("port", app.translate("main", "port for binding"));
41 parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
42 parser.addHelpOption();
43 parser.addVersionOption();
45 QStringList positionalArguments = parser.positionalArguments();
47 if (positionalArguments.length() == 2) {
48 int port = positionalArguments.takeFirst().toInt();
49 QString secret = positionalArguments.takeFirst();
54 bindingAddress.setScheme(QStringLiteral("ws"));
55 bindingAddress.setHost(QStringLiteral("localhost"));
56 bindingAddress.setPort(port);
57 bindingAddress.setPath(QStringLiteral("/api"));
60 query.addQueryItem(QStringLiteral("token"), secret);
61 bindingAddress.setQuery(query);
62 context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
64 qmlRegisterType<Mixer>("Mixer", 1, 0, "Mixer");
67 engine.load(QUrl(QStringLiteral("qrc:/Mixer.qml")));