summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorTasuku Suzuki <tasuku.suzuki@qt.io>2016-12-22 17:27:58 +0900
committerTasuku Suzuki <tasuku.suzuki@qt.io>2016-12-22 17:37:12 +0900
commit54028f6c8e856ac44e6833328b22d7b90fd4fbd7 (patch)
tree4bcb0b3e04be87e2452361654b9b287ec8bd06e1 /app/main.cpp
parent91bc9fbdcf73222e5c000ad91e10d6e446cb5c55 (diff)
Wifi & Bluetooth: use binding address defined in main.cpp
Change-Id: I37927e3287cc63531e58aedec0fee67eb4331e47 Signed-off-by: Tasuku Suzuki <tasuku.suzuki@qt.io>
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp29
1 files changed, 15 insertions, 14 deletions
diff --git a/app/main.cpp b/app/main.cpp
index fd8201e..a55ebad 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
QCommandLineParser parser;
parser.addPositionalArgument("port", app.translate("main", "port for binding"));
- parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
+// parser.addPositionalArgument("secret", app.translate("main", "secret for binding"));
parser.addHelpOption();
parser.addVersionOption();
parser.process(app);
@@ -75,20 +75,21 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
- if (positionalArguments.length() == 2) {
- int port = positionalArguments.takeFirst().toInt();
- QString secret = positionalArguments.takeFirst();
- QUrl bindingAddress;
- bindingAddress.setScheme(QStringLiteral("ws"));
- bindingAddress.setHost(QStringLiteral("localhost"));
- bindingAddress.setPort(port);
- bindingAddress.setPath(QStringLiteral("/api"));
- QUrlQuery query;
- query.addQueryItem(QStringLiteral("token"), secret);
- bindingAddress.setQuery(query);
- QQmlContext *context = engine.rootContext();
- context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
+ int port = 0;
+ if (!positionalArguments.isEmpty()) {
+ port = positionalArguments.takeFirst().toInt();
}
+// QString secret = positionalArguments.takeFirst();
+ QUrl bindingAddress;
+ bindingAddress.setScheme(QStringLiteral("http"));
+ bindingAddress.setHost(QStringLiteral("localhost"));
+ bindingAddress.setPort(port);
+ bindingAddress.setPath(QStringLiteral("/api"));
+// QUrlQuery query;
+// query.addQueryItem(QStringLiteral("token"), secret);
+// bindingAddress.setQuery(query);
+ QQmlContext *context = engine.rootContext();
+ context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
QFile version("/proc/version");
if (version.open(QFile::ReadOnly)) {