summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2021-12-16 16:49:22 -0500
committerScott Murray <scott.murray@konsulko.com>2021-12-16 16:53:08 -0500
commit8b8c003e0be89baef3715c7f905ba32213bdb853 (patch)
tree143ecba776377a86527caaf2750a66fd22160db1 /app/main.cpp
parentff0e7f9777118469203fe48663f4226d82ecc58b (diff)
Update for app framework removal
Changes: - Remove the autobuild scripts and config.xml used by the app framework widget build. - Update the qmake files to just build a "settings" binary and install it into /usr/bin by default. - Remove the code in main.cpp that handled reading the WebSocket command-line arguments and passing them to binding related code. - Tweak the Bluetooth QML to call into the new start call in the libqtappfw-bt Bluetooth object that replaces the previous WebSocket onConnected hook. - Remove the voice related code as it is not likely to be re-enabled anytime soon. Bug-AGL: SPEC-4182 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I8d3272b62aa403a71adadd26c545c1ed33281e5f
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp37
1 files changed, 4 insertions, 33 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 40d0d55..4c989ae 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -24,10 +24,8 @@
#include <QtQml/QQmlContext>
#include <QtQuickControls2/QQuickStyle>
#include <QQuickWindow>
-#include <QtQrCodeQuickItem.hpp>
#include <bluetooth.h>
#include <network.h>
-#include <voice.h>
int main(int argc, char *argv[])
{
@@ -45,39 +43,13 @@ int main(int argc, char *argv[])
QQuickStyle::setStyle("AGL");
- QCommandLineParser parser;
- parser.addPositionalArgument("port", app.translate("main", "port for binding"));
- parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
- parser.addHelpOption();
- parser.addVersionOption();
- parser.process(app);
- QStringList positionalArguments = parser.positionalArguments();
-
QQmlApplicationEngine engine;
- if (positionalArguments.length() != 2) {
- exit(EXIT_FAILURE);
- }
- int port = positionalArguments.takeFirst().toInt();
- QString secret = positionalArguments.takeFirst();
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("token"), secret);
-
- QUrl bindingAddressWS;
- bindingAddressWS.setScheme(QStringLiteral("ws"));
- bindingAddressWS.setHost(QStringLiteral("localhost"));
- bindingAddressWS.setPort(port);
- bindingAddressWS.setPath(QStringLiteral("/api"));
- bindingAddressWS.setQuery(query);
QQmlContext *context = engine.rootContext();
- context->setContextProperty(QStringLiteral("bindingAddressWS"), bindingAddressWS);
- context->setContextProperty("network", new Network(bindingAddressWS, context));
-
- std::string token = secret.toStdString();
QFile version("/proc/version");
if (version.open(QFile::ReadOnly)) {
QStringList data = QString::fromLocal8Bit(version.readAll()).split(QLatin1Char(' '));
- engine.rootContext()->setContextProperty("kernel", data.at(2));
+ context->setContextProperty("kernel", data.at(2));
version.close();
} else {
qWarning() << version.errorString();
@@ -87,15 +59,14 @@ int main(int argc, char *argv[])
if (aglversion.open(QFile::ReadOnly)) {
QStringList data = QString::fromLocal8Bit(aglversion.readAll()).split(QLatin1Char('\n'));
QStringList data2 = data.at(2).split(QLatin1Char('"'));
- engine.rootContext()->setContextProperty("ucb", data2.at(1));
+ context->setContextProperty("ucb", data2.at(1));
aglversion.close();
} else {
qWarning() << aglversion.errorString();
}
- QtQrCodeQuickItem::registerQmlTypes();
- engine.rootContext()->setContextProperty("bluetooth", new Bluetooth(bindingAddressWS, context));
- engine.rootContext()->setContextProperty("voice", new Voice(bindingAddressWS, context));
+ context->setContextProperty("bluetooth", new Bluetooth(true, context));
+ context->setContextProperty("network", new Network(true, context));
engine.load(QUrl(QStringLiteral("qrc:/Settings.qml")));