From bd6072b2ded864a93f7dc3edf3991193c1529975 Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 21 Jun 2018 14:02:08 +0200 Subject: [PATCH] fix(App): do not open window before sub windows creation --- src/app/App.cpp | 27 +++++++++++-------- src/components/notifier/Notifier.cpp | 4 +-- .../Linphone/Notifications/Notification.qml | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/app/App.cpp b/src/app/App.cpp index 12661dd48..622dad94b 100644 --- a/src/app/App.cpp +++ b/src/app/App.cpp @@ -122,13 +122,18 @@ App::~App () { // ----------------------------------------------------------------------------- static QQuickWindow *createSubWindow (QQmlApplicationEngine *engine, const char *path) { + qInfo() << QStringLiteral("Creating subwindow: `%1`.").arg(path); + QQmlComponent component(engine, QUrl(path)); if (component.isError()) { qWarning() << component.errors(); abort(); } + qInfo() << QStringLiteral("Subwindow status: `%1`.").arg(component.status()); QObject *object = component.create(); + Q_ASSERT(object); + QQmlEngine::setObjectOwnership(object, QQmlEngine::CppOwnership); object->setParent(engine); @@ -231,17 +236,6 @@ void App::initContentApp () { &CoreHandlers::coreStarted, [this, mustBeIconified]() { openAppAfterInit(mustBeIconified); - - // Create other windows. - mCallsWindow = createSubWindow(mEngine, QmlViewCallsWindow); - mSettingsWindow = createSubWindow(mEngine, QmlViewSettingsWindow); - QObject::connect(mSettingsWindow, &QWindow::visibilityChanged, this, [](QWindow::Visibility visibility) { - if (visibility == QWindow::Hidden) { - qInfo() << QStringLiteral("Update nat policy."); - shared_ptr core = CoreManager::getInstance()->getCore(); - core->setNatPolicy(core->getNatPolicy()); - } - }); } ); } @@ -536,6 +530,17 @@ QString App::getLocale () const { void App::openAppAfterInit (bool mustBeIconified) { qInfo() << QStringLiteral("Open linphone app."); + // Create other windows. + mCallsWindow = createSubWindow(mEngine, QmlViewCallsWindow); + mSettingsWindow = createSubWindow(mEngine, QmlViewSettingsWindow); + QObject::connect(mSettingsWindow, &QWindow::visibilityChanged, this, [](QWindow::Visibility visibility) { + if (visibility == QWindow::Hidden) { + qInfo() << QStringLiteral("Update nat policy."); + shared_ptr core = CoreManager::getInstance()->getCore(); + core->setNatPolicy(core->getNatPolicy()); + } + }); + QQuickWindow *mainWindow = getMainWindow(); #ifndef __APPLE__ diff --git a/src/components/notifier/Notifier.cpp b/src/components/notifier/Notifier.cpp index 08ae420a0..5f3918622 100644 --- a/src/components/notifier/Notifier.cpp +++ b/src/components/notifier/Notifier.cpp @@ -175,8 +175,8 @@ void Notifier::showNotification (QObject *notification, int timeout) { // Destroy it after timeout. QObject::connect(timer, &QTimer::timeout, this, [this, notification]() { - deleteNotification(QVariant::fromValue(notification)); - }); + deleteNotification(QVariant::fromValue(notification)); + }); // Called explicitly (by a click on notification for example) QObject::connect(notification, SIGNAL(deleteNotification(QVariant)), this, SLOT(deleteNotification(QVariant))); diff --git a/ui/modules/Linphone/Notifications/Notification.qml b/ui/modules/Linphone/Notifications/Notification.qml index 8594788e1..a6ff2a022 100644 --- a/ui/modules/Linphone/Notifications/Notification.qml +++ b/ui/modules/Linphone/Notifications/Notification.qml @@ -43,6 +43,7 @@ DesktopPopup { anchors.fill: parent } + Icon { id: iconSign @@ -53,6 +54,5 @@ DesktopPopup { iconSize: NotificationStyle.iconSize } - } }