From 80e643e82ac7bfb0070fe166c6355483bb82c29d Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Wed, 16 Nov 2016 10:58:43 +0100 Subject: [PATCH] fix(components/notifier): use a start offset --- tests/src/app/App.cpp | 8 ++++++-- tests/src/components/notifier/Notifier.cpp | 10 ++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tests/src/app/App.cpp b/tests/src/app/App.cpp index dcb762333..e7e71ff7e 100644 --- a/tests/src/app/App.cpp +++ b/tests/src/app/App.cpp @@ -14,6 +14,10 @@ #define LANGUAGES_PATH ":/languages/" #define WINDOW_ICON_PATH ":/assets/images/linphone.png" +// The two main windows of Linphone desktop. +#define QML_VIEW_MAIN_WINDOW "qrc:/ui/views/App/MainWindow/MainWindow.qml" +#define QML_VIEW_CALL_WINDOW "qrc:/ui/views/App/Calls/Calls.qml" + // =================================================================== App *App::m_instance = nullptr; @@ -47,7 +51,7 @@ void App::initContentApp () { addContextProperties(); // Load main view. - m_engine.load(QUrl("qrc:/ui/views/App/MainWindow/MainWindow.qml")); + m_engine.load(QUrl(QML_VIEW_MAIN_WINDOW)); if (m_engine.rootObjects().isEmpty()) qFatal("Unable to open main window."); @@ -80,7 +84,7 @@ void App::registerTypes () { void App::addContextProperties () { QQmlContext *context = m_engine.rootContext(); - QQmlComponent component(&m_engine, QUrl("qrc:/ui/views/App/Calls/Calls.qml")); + QQmlComponent component(&m_engine, QUrl(QML_VIEW_CALL_WINDOW)); // Windows. if (component.isError()) { diff --git a/tests/src/components/notifier/Notifier.cpp b/tests/src/components/notifier/Notifier.cpp index a29322bf7..0caccfe3a 100644 --- a/tests/src/components/notifier/Notifier.cpp +++ b/tests/src/components/notifier/Notifier.cpp @@ -4,14 +4,16 @@ #include "../../app/App.hpp" #include "Notifier.hpp" +// Notifications QML properties/methods. #define NOTIFICATION_SHOW_METHOD_NAME "show" #define NOTIFICATION_EDGE_PROPERTY_NAME "edge" #define NOTIFICATION_HEIGHT_PROPERTY "popupHeight" #define NOTIFICATION_OFFSET_PROPERTY_NAME "edgeOffset" +// Arbitrary hardcoded values. #define NOTIFICATION_SPACING 10 - +#define NOTIFICATION_START_OFFSET 30 #define N_MAX_NOTIFICATIONS 3 // =================================================================== @@ -45,7 +47,7 @@ bool setProperty (QObject &object, const char *property, const T &value) { // ------------------------------------------------------------------- Notifier::Notifier (QObject *parent) : - QObject(parent) { + QObject(parent), m_offset(NOTIFICATION_START_OFFSET) { QQmlEngine *engine = App::getInstance()->getEngine(); // Build components. @@ -101,7 +103,7 @@ void Notifier::showCallMessage ( return; } - m_offset = (m_n_instances == 0 ? offset : offset + m_offset) + NOTIFICATION_SPACING; + m_offset = (offset + m_offset) + NOTIFICATION_SPACING; m_n_instances++; m_mutex.unlock(); @@ -117,7 +119,7 @@ void Notifier::showCallMessage ( m_n_instances--; if (m_n_instances == 0) - m_offset = 0; + m_offset = NOTIFICATION_START_OFFSET; m_mutex.unlock(); });