summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/app.pri3
-rw-r--r--app/app.pro24
-rw-r--r--app/main.cpp44
3 files changed, 17 insertions, 54 deletions
diff --git a/app/app.pri b/app/app.pri
deleted file mode 100644
index f22f540..0000000
--- a/app/app.pri
+++ /dev/null
@@ -1,3 +0,0 @@
-TEMPLATE = app
-
-DESTDIR = $${OUT_PWD}/../package/root/bin
diff --git a/app/app.pro b/app/app.pro
index f4ab212..7d3fb4a 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -1,24 +1,26 @@
+TEMPLATE = app
TARGET = hvac
-QT = quick qml websockets
+QT = qml quick
+CONFIG += c++11 link_pkgconfig
+
+PKGCONFIG += qtappfw-hvac
HEADERS += \
translator.h
-SOURCES = main.cpp \
+SOURCES = \
+ main.cpp \
translator.cpp
-CONFIG += c++11 link_pkgconfig
-PKGCONFIG += qtappfw-hvac
-
-CONFIG(release, debug|release) {
- QMAKE_POST_LINK = $(STRIP) --strip-unneeded $(TARGET)
-}
-
RESOURCES += \
hvac.qrc \
images/images.qrc
-include(app.pri)
-
LANGUAGES = ja_JP fr_FR
include(translations.pri)
+
+target.path = $${PREFIX}/usr/bin
+target.files += $${OUT_PWD}/$${TARGET}
+target.CONFIG = no_check_exist executable
+
+INSTALLS += target
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")));