Commit bd6072b2 authored by Ronan's avatar Ronan

fix(App): do not open window before sub windows creation

parent 7f62ae90
......@@ -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<linphone::Core> 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<linphone::Core> core = CoreManager::getInstance()->getCore();
core->setNatPolicy(core->getNatPolicy());
}
});
QQuickWindow *mainWindow = getMainWindow();
#ifndef __APPLE__
......
......@@ -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)));
......
......@@ -43,6 +43,7 @@ DesktopPopup {
anchors.fill: parent
}
Icon {
id: iconSign
......@@ -53,6 +54,5 @@ DesktopPopup {
iconSize: NotificationStyle.iconSize
}
}
}
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