fix(app): avoid crash if calls window is disabled

This commit is contained in:
Ronan Abhamon 2018-08-03 17:37:57 +02:00
parent 927b1e10c7
commit a3dc41ec55
4 changed files with 24 additions and 15 deletions

View file

@ -125,8 +125,11 @@ static void cliInitiateConference (QHash<QString, QString> &args) {
const QString id = args["conference-id"];
auto updateCallsWindow = []() {
// TODO: Set the view to the "waiting call view".
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (!callsWindow)
return;
// TODO: Set the view to the "waiting call view".
if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();

View file

@ -339,12 +339,13 @@ void CallModel::accept (bool withVideo) {
setRecordFile(params);
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (coreManager->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
if (callsWindow) {
if (coreManager->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
}
mCall->acceptWithParams(params);
}

View file

@ -230,11 +230,13 @@ bool CallsListModel::removeRows (int row, int count, const QModelIndex &parent)
void CallsListModel::addCall (const shared_ptr<linphone::Call> &call) {
if (call->getDir() == linphone::CallDirOutgoing) {
QQuickWindow *callsWindow = App::getInstance()->getCallsWindow();
if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
if (callsWindow) {
if (CoreManager::getInstance()->getSettingsModel()->getKeepCallsWindowInBackground()) {
if (!callsWindow->isVisible())
callsWindow->showMinimized();
} else
App::smartShowWindow(callsWindow);
}
}
CallModel *callModel = new CallModel(call);

View file

@ -69,9 +69,12 @@ ChatProxyModel::ChatProxyModel (QObject *parent) : QSortFilterProxyModel(parent)
QObject::connect(app->getMainWindow(), &QWindow::activeChanged, this, [this]() {
handleIsActiveChanged(App::getInstance()->getMainWindow());
});
QObject::connect(app->getCallsWindow(), &QWindow::activeChanged, this, [this]() {
handleIsActiveChanged(App::getInstance()->getCallsWindow());
});
QQuickWindow *callsWindow = app->getCallsWindow();
if (callsWindow)
QObject::connect(callsWindow, &QWindow::activeChanged, this, [this, callsWindow]() {
handleIsActiveChanged(callsWindow);
});
}
// -----------------------------------------------------------------------------