mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 14:48:15 +00:00
fix(components/notifier): use a start offset
This commit is contained in:
parent
4d91eb4a85
commit
80e643e82a
2 changed files with 12 additions and 6 deletions
|
|
@ -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()) {
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue