mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-02-03 12:49:29 +00:00
fix(App): do not create windows later to avoid warning and abort (QQmlComponent: Cannot create new component instance before completing the previous)
This commit is contained in:
parent
4f908efd12
commit
70f47b01d3
2 changed files with 21 additions and 23 deletions
|
|
@ -146,8 +146,6 @@ void App::initContentApp () {
|
|||
qInfo() << QStringLiteral("Restarting app...");
|
||||
delete mEngine;
|
||||
|
||||
mCallsWindow = nullptr;
|
||||
mSettingsWindow = nullptr;
|
||||
mNotifier = nullptr;
|
||||
mColors = nullptr;
|
||||
mSystemTrayIcon = nullptr;
|
||||
|
|
@ -228,10 +226,24 @@ void App::initContentApp () {
|
|||
if (mEngine->rootObjects().isEmpty())
|
||||
qFatal("Unable to open main window.");
|
||||
|
||||
QObject::connect(CoreManager::getInstance()->getHandlers().get(),
|
||||
&CoreHandlers::coreStarted, [this, mustBeIconified]() {
|
||||
QObject::connect(
|
||||
CoreManager::getInstance()->getHandlers().get(),
|
||||
&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());
|
||||
}
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
|
@ -263,15 +275,12 @@ QString App::getCommandArgument () {
|
|||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
QQuickWindow *App::getCallsWindow () {
|
||||
QQuickWindow *App::getCallsWindow () const {
|
||||
if (CoreManager::getInstance()->getCore()->getConfig()->getInt(
|
||||
SettingsModel::UiSection, "disable_calls_window", 0
|
||||
))
|
||||
return nullptr;
|
||||
|
||||
if (!mCallsWindow)
|
||||
mCallsWindow = createSubWindow(mEngine, QmlViewCallsWindow);
|
||||
|
||||
return mCallsWindow;
|
||||
}
|
||||
|
||||
|
|
@ -281,18 +290,7 @@ QQuickWindow *App::getMainWindow () const {
|
|||
);
|
||||
}
|
||||
|
||||
QQuickWindow *App::getSettingsWindow () {
|
||||
if (!mSettingsWindow) {
|
||||
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 *App::getSettingsWindow () const {
|
||||
return mSettingsWindow;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ public:
|
|||
exit(RestartCode);
|
||||
}
|
||||
|
||||
Q_INVOKABLE QQuickWindow *getCallsWindow ();
|
||||
Q_INVOKABLE QQuickWindow *getSettingsWindow ();
|
||||
Q_INVOKABLE QQuickWindow *getCallsWindow () const;
|
||||
Q_INVOKABLE QQuickWindow *getSettingsWindow () const;
|
||||
|
||||
Q_INVOKABLE static void smartShowWindow (QQuickWindow *window);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue