diff options
author | Scott Murray <scott.murray@konsulko.com> | 2022-02-14 18:32:06 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2022-02-14 18:32:06 -0500 |
commit | bfcc2fa194474a7bc317583072b62c977ae0fc14 (patch) | |
tree | bd904ec5183edf3a38d55e6197cf1898eb0c75b6 /app/main.cpp | |
parent | f48bbcb2266ebfad46e5cafacfba01c3f6ba3924 (diff) |
Update for app framework removalneedlefish_13.93.0needlefish/13.93.0marlin_12.93.0marlin/12.93.013.93.012.93.0
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.cpp | 49 |
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(); } |