diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/app.pri | 10 | ||||
-rw-r--r-- | app/app.pro | 23 | ||||
-rw-r--r-- | app/config.tests/libhomescreen/libhomescreen.cpp | 8 | ||||
-rw-r--r-- | app/config.tests/libhomescreen/libhomescreen.pro | 5 | ||||
-rw-r--r-- | app/fileplayer.cpp | 4 | ||||
-rw-r--r-- | app/main.cpp | 49 |
6 files changed, 27 insertions, 72 deletions
diff --git a/app/app.pri b/app/app.pri deleted file mode 100644 index d7380bb..0000000 --- a/app/app.pri +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app -QMAKE_LFLAGS += "-Wl,--hash-style=gnu -Wl,--as-needed" - -DESTDIR = $${OUT_PWD}/../package/root/bin - -copy_ringtone.target = $$DESTDIR/Phone.wav -copy_ringtone.depends = $$_PRO_FILE_PWD_/Phone.wav -copy_ringtone.commands = $(COPY_FILE) \"$$replace(copy_ringtone.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_ringtone.target, /, $$QMAKE_DIR_SEP)\" -QMAKE_EXTRA_TARGETS += copy_ringtone -PRE_TARGETDEPS += $$copy_ringtone.target diff --git a/app/app.pro b/app/app.pro index ae6b62e..4b9d1e2 100644 --- a/app/app.pro +++ b/app/app.pro @@ -1,18 +1,23 @@ +TEMPLATE = app TARGET = phone -QT = quickcontrols2 +QT = qml quickcontrols2 +CONFIG += c++11 link_pkgconfig -SOURCES = main.cpp phone.cpp fileplayer.cpp -HEADERS = phone.h numbertype.h fileplayer.h - -CONFIG += link_pkgconfig PKGCONFIG += qtappfw-phone qtappfw-bt-pbap gstreamer-1.0 -CONFIG(release, debug|release) { - QMAKE_POST_LINK = $(STRIP) --strip-unneeded $(TARGET) -} +SOURCES = main.cpp phone.cpp fileplayer.cpp +HEADERS = phone.h numbertype.h fileplayer.h RESOURCES += \ phone.qrc \ images/images.qrc -include(app.pri) +target.path = /usr/bin +target.files += $${OUT_PWD}/$${TARGET} +target.CONFIG = no_check_exist executable + +ringtone.path = /usr/share/sounds/ringtones +ringtone.files = $$_PRO_FILE_PWD_/Phone.wav +ringtone.CONFIG = no_check_exist + +INSTALLS += target ringtone diff --git a/app/config.tests/libhomescreen/libhomescreen.cpp b/app/config.tests/libhomescreen/libhomescreen.cpp deleted file mode 100644 index d698b05..0000000 --- a/app/config.tests/libhomescreen/libhomescreen.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include <libhomescreen.hpp> - -int main(int argc,char **argv) -{ - LibHomeScreen libHomeScreen; - return 0; -} - diff --git a/app/config.tests/libhomescreen/libhomescreen.pro b/app/config.tests/libhomescreen/libhomescreen.pro deleted file mode 100644 index eb4e8f3..0000000 --- a/app/config.tests/libhomescreen/libhomescreen.pro +++ /dev/null @@ -1,5 +0,0 @@ -SOURCES = libhomescreen.cpp - -CONFIG -= qt -CONFIG += link_pkgconfig -PKGCONFIG += homescreen diff --git a/app/fileplayer.cpp b/app/fileplayer.cpp index a91d609..1bcd2f3 100644 --- a/app/fileplayer.cpp +++ b/app/fileplayer.cpp @@ -22,7 +22,7 @@ #undef DEBUG -static void *gst_loop_thread(GMainLoop *loop) +static void gst_loop_thread(GMainLoop *loop) { if(loop) g_main_loop_run(loop); @@ -116,7 +116,7 @@ gboolean FilePlayer::gstreamer_bus_callback(GstBus *bus, GstMessage *msg, gpoint return static_cast<FilePlayer*>(data)->bus_callback(bus, msg); } -gboolean FilePlayer::bus_callback(GstBus *bus, GstMessage *msg) +gboolean FilePlayer::bus_callback(__attribute__((unused)) GstBus *bus, GstMessage *msg) { switch (GST_MESSAGE_TYPE(msg)) { case GST_MESSAGE_EOS: 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(); } |