summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2021-12-16 16:04:44 -0500
committerScott Murray <scott.murray@konsulko.com>2021-12-16 16:25:15 -0500
commit95d837913ecb41577980345aeb8a1b3eb710ea2a (patch)
treefab37d74084c8fcd1a1cd0a9dd1a0721a6a4b572 /app/main.cpp
parentb814a465a9583aa81ae7335d7adfd9df54db59cb (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 "hvac" 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. - Add setenv of QT_QUICK_CONTROLS_STYLE to "AGL" to get the AGL styling used. This replaces a global environment variable definition tied to the old app framework, and makes it more obvious that the style is required for the app to properly work. Bug-AGL: SPEC-4182 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I6634a611741b442597dca2978a8dd0a6b6b75341
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp44
1 files changed, 4 insertions, 40 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 94b46ad..c320ef8 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -14,57 +14,21 @@
* limitations under the License.
*/
-#include <QtGui/QGuiApplication>
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
#include <QDebug>
-#include <QUrlQuery>
-#include <QCommandLineParser>
-#include <QtQml/QQmlApplicationEngine>
#include <hvac.h>
-#include <QtQml/QQmlContext>
#include "translator.h"
int main(int argc, char *argv[])
{
- setenv("QT_QPA_PLATFORM", "wayland", 1);
- int port;
- QString token;
+ setenv("QT_QUICK_CONTROLS_STYLE", "AGL", 1);
- QCommandLineParser parser;
QGuiApplication app(argc, argv);
- 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();
-
- if (positionalArguments.length() == 2) {
- port = positionalArguments.takeFirst().toInt();
- token = positionalArguments.takeFirst();
- qInfo() << "setting port:" << port << ", token:" << token;
- } else {
- qInfo() << "Need to specify port and token";
- exit(EXIT_FAILURE);
- }
-
- QUrl bindingAddress;
- bindingAddress.setScheme(QStringLiteral("ws"));
- bindingAddress.setHost(QStringLiteral("localhost"));
- bindingAddress.setPort(port);
- bindingAddress.setPath(QStringLiteral("/api"));
-
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("token"), token);
- bindingAddress.setQuery(query);
-
QQmlApplicationEngine engine;
- engine.rootContext()->setContextProperty("bindingAddress", bindingAddress);
- engine.rootContext()->setContextProperty("hvac", new HVAC(bindingAddress));
+ engine.rootContext()->setContextProperty("hvac", new HVAC());
qmlRegisterType<Translator>("Translator", 1, 0, "Translator");
engine.load(QUrl(QStringLiteral("qrc:/HVAC.qml")));