Commit 80e643e8 authored by Ronan Abhamon's avatar Ronan Abhamon

fix(components/notifier): use a start offset

parent 4d91eb4a
...@@ -14,6 +14,10 @@ ...@@ -14,6 +14,10 @@
#define LANGUAGES_PATH ":/languages/" #define LANGUAGES_PATH ":/languages/"
#define WINDOW_ICON_PATH ":/assets/images/linphone.png" #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; App *App::m_instance = nullptr;
...@@ -47,7 +51,7 @@ void App::initContentApp () { ...@@ -47,7 +51,7 @@ void App::initContentApp () {
addContextProperties(); addContextProperties();
// Load main view. // 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()) if (m_engine.rootObjects().isEmpty())
qFatal("Unable to open main window."); qFatal("Unable to open main window.");
...@@ -80,7 +84,7 @@ void App::registerTypes () { ...@@ -80,7 +84,7 @@ void App::registerTypes () {
void App::addContextProperties () { void App::addContextProperties () {
QQmlContext *context = m_engine.rootContext(); 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. // Windows.
if (component.isError()) { if (component.isError()) {
......
...@@ -4,14 +4,16 @@ ...@@ -4,14 +4,16 @@
#include "../../app/App.hpp" #include "../../app/App.hpp"
#include "Notifier.hpp" #include "Notifier.hpp"
// Notifications QML properties/methods.
#define NOTIFICATION_SHOW_METHOD_NAME "show" #define NOTIFICATION_SHOW_METHOD_NAME "show"
#define NOTIFICATION_EDGE_PROPERTY_NAME "edge" #define NOTIFICATION_EDGE_PROPERTY_NAME "edge"
#define NOTIFICATION_HEIGHT_PROPERTY "popupHeight" #define NOTIFICATION_HEIGHT_PROPERTY "popupHeight"
#define NOTIFICATION_OFFSET_PROPERTY_NAME "edgeOffset" #define NOTIFICATION_OFFSET_PROPERTY_NAME "edgeOffset"
// Arbitrary hardcoded values.
#define NOTIFICATION_SPACING 10 #define NOTIFICATION_SPACING 10
#define NOTIFICATION_START_OFFSET 30
#define N_MAX_NOTIFICATIONS 3 #define N_MAX_NOTIFICATIONS 3
// =================================================================== // ===================================================================
...@@ -45,7 +47,7 @@ bool setProperty (QObject &object, const char *property, const T &value) { ...@@ -45,7 +47,7 @@ bool setProperty (QObject &object, const char *property, const T &value) {
// ------------------------------------------------------------------- // -------------------------------------------------------------------
Notifier::Notifier (QObject *parent) : Notifier::Notifier (QObject *parent) :
QObject(parent) { QObject(parent), m_offset(NOTIFICATION_START_OFFSET) {
QQmlEngine *engine = App::getInstance()->getEngine(); QQmlEngine *engine = App::getInstance()->getEngine();
// Build components. // Build components.
...@@ -101,7 +103,7 @@ void Notifier::showCallMessage ( ...@@ -101,7 +103,7 @@ void Notifier::showCallMessage (
return; return;
} }
m_offset = (m_n_instances == 0 ? offset : offset + m_offset) + NOTIFICATION_SPACING; m_offset = (offset + m_offset) + NOTIFICATION_SPACING;
m_n_instances++; m_n_instances++;
m_mutex.unlock(); m_mutex.unlock();
...@@ -117,7 +119,7 @@ void Notifier::showCallMessage ( ...@@ -117,7 +119,7 @@ void Notifier::showCallMessage (
m_n_instances--; m_n_instances--;
if (m_n_instances == 0) if (m_n_instances == 0)
m_offset = 0; m_offset = NOTIFICATION_START_OFFSET;
m_mutex.unlock(); m_mutex.unlock();
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment