summaryrefslogtreecommitdiffstats
path: root/app/main.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2022-02-14 18:32:06 -0500
committerScott Murray <scott.murray@konsulko.com>2022-02-14 18:32:06 -0500
commitbfcc2fa194474a7bc317583072b62c977ae0fc14 (patch)
treebd904ec5183edf3a38d55e6197cf1898eb0c75b6 /app/main.cpp
parentf48bbcb2266ebfad46e5cafacfba01c3f6ba3924 (diff)
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. - Add initial .desktop file and icon copied from the launcher source tree, and updated .pro files to install them. Bug-AGL: SPEC-4182 Change-Id: I8a8cafc15c1dbe4e65db579bc650a8028c4aa10c Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'app/main.cpp')
-rw-r--r--app/main.cpp49
1 files changed, 11 insertions, 38 deletions
diff --git a/app/main.cpp b/app/main.cpp
index 9313c39..ccddfb8 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -16,8 +16,6 @@
*/
#include <QtCore/QDebug>
-#include <QtCore/QCommandLineParser>
-#include <QtCore/QUrlQuery>
#include <QtGui/QGuiApplication>
#include <QtQml/QQmlApplicationEngine>
#include <QtQml/QQmlContext>
@@ -32,54 +30,29 @@
int main(int argc, char *argv[])
{
- QString graphic_role = QString("phone");
+ QString graphic_role = QString("phone");
- QGuiApplication app(argc, argv);
- app.setDesktopFileName(graphic_role);
+ QGuiApplication app(argc, argv);
+ app.setDesktopFileName(graphic_role);
- QQuickStyle::setStyle("AGL");
+ QQuickStyle::setStyle("AGL");
- QQmlApplicationEngine engine;
-
- 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();
-
- 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);
+ QQmlApplicationEngine engine;
QQmlContext *context = engine.rootContext();
- context->setContextProperty(QStringLiteral("bindingAddress"), bindingAddress);
- Telephony *telephony = new Telephony(bindingAddress);
+ Telephony *telephony = new Telephony();
context->setContextProperty("telephony", telephony);
- std::string token = secret.toStdString();
- std::string install_dir = getenv("AFM_APP_INSTALL_DIR");
-
- FilePlayer *player = new FilePlayer(install_dir + "/bin/Phone.wav", std::string("phone"));
+ std::string ringtone_dir("/usr/share/sounds/ringtones");
+ FilePlayer *player = new FilePlayer(ringtone_dir + "/Phone.wav", std::string("phone"));
Phone *phone = new Phone(telephony, player);
context->setContextProperty("phone", phone);
QObject::connect(telephony, &Telephony::callStateChanged, phone, &Phone::onCallStateChanged);
- context->setContextProperty("pbap", new Pbap(bindingAddress, context));
+ context->setContextProperty("pbap", new Pbap(context));
qmlRegisterUncreatableType<NumberType>("NumberType", 1, 0, "NumberType", "Not creatable as it is an enum type");
engine.load(QUrl(QStringLiteral("qrc:/Phone.qml")));
- }
- return app.exec();
+
+ return app.exec();
}