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

This commit is contained in:
Ronan Abhamon 2018-06-21 14:02:08 +02:00
parent 7f62ae905a
commit bd6072b2de
3 changed files with 19 additions and 14 deletions

View file

@ -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__

View file

@ -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)));

View file

@ -43,6 +43,7 @@ DesktopPopup {
anchors.fill: parent
}
Icon {
id: iconSign
@ -53,6 +54,5 @@ DesktopPopup {
iconSize: NotificationStyle.iconSize
}
}
}