diff --git a/linphone-app/src/components/assistant/AssistantModel.cpp b/linphone-app/src/components/assistant/AssistantModel.cpp index d53591662..4bc0aac2c 100644 --- a/linphone-app/src/components/assistant/AssistantModel.cpp +++ b/linphone-app/src/components/assistant/AssistantModel.cpp @@ -27,6 +27,8 @@ #include "AssistantModel.hpp" +#include + // ============================================================================= using namespace std; diff --git a/linphone-app/src/components/conference/ConferenceAddModel.cpp b/linphone-app/src/components/conference/ConferenceAddModel.cpp index a65536814..898597314 100644 --- a/linphone-app/src/components/conference/ConferenceAddModel.cpp +++ b/linphone-app/src/components/conference/ConferenceAddModel.cpp @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#include + #include "components/core/CoreManager.hpp" #include "components/sip-addresses/SipAddressesModel.hpp" #include "utils/Utils.hpp" @@ -139,8 +141,10 @@ void ConferenceHelperModel::ConferenceAddModel::update () { linphoneAddresses.push_back(linphoneAddress); } - shared_ptr conference = mConferenceHelperModel->mConference; - + shared_ptr conference = mConferenceHelperModel->mCore->getConference(); + if(!conference) + conference = mConferenceHelperModel->mCore->createConferenceWithParams(mConferenceHelperModel->mCore->createConferenceParams()); + // Remove sip addresses if necessary. for (const auto &call : CoreManager::getInstance()->getCore()->getCalls()) { if (!call->getParams()->getLocalConferenceMode()) diff --git a/linphone-app/src/components/conference/ConferenceHelperModel.cpp b/linphone-app/src/components/conference/ConferenceHelperModel.cpp index f7db0b264..1525632b7 100644 --- a/linphone-app/src/components/conference/ConferenceHelperModel.cpp +++ b/linphone-app/src/components/conference/ConferenceHelperModel.cpp @@ -35,10 +35,6 @@ using namespace std; ConferenceHelperModel::ConferenceHelperModel (QObject *parent) : QSortFilterProxyModel(parent) { mCore = CoreManager::getInstance()->getCore(); - mConference = mCore->getConference(); - if (!mConference) - mConference = mCore->createConferenceWithParams(mCore->createConferenceParams()); - mConferenceAddModel = new ConferenceAddModel(this); App::getInstance()->getEngine()->setObjectOwnership(mConferenceAddModel, QQmlEngine::CppOwnership); diff --git a/linphone-app/src/components/conference/ConferenceHelperModel.hpp b/linphone-app/src/components/conference/ConferenceHelperModel.hpp index fffcef6d9..67b93860a 100644 --- a/linphone-app/src/components/conference/ConferenceHelperModel.hpp +++ b/linphone-app/src/components/conference/ConferenceHelperModel.hpp @@ -64,7 +64,6 @@ private: ConferenceAddModel *mConferenceAddModel = nullptr; std::shared_ptr mCore; - std::shared_ptr mConference; }; #endif // CONFERENCE_HELPER_MODEL_H_ diff --git a/linphone-app/src/components/conference/ConferenceModel.cpp b/linphone-app/src/components/conference/ConferenceModel.cpp index d795bd77d..360146385 100644 --- a/linphone-app/src/components/conference/ConferenceModel.cpp +++ b/linphone-app/src/components/conference/ConferenceModel.cpp @@ -19,6 +19,7 @@ */ #include +#include #include "components/call/CallModel.hpp" #include "components/calls/CallsListModel.hpp" @@ -36,13 +37,12 @@ using namespace std; ConferenceModel::ConferenceModel (QObject *parent) : QSortFilterProxyModel(parent) { - QObject::connect(this, &ConferenceModel::rowsRemoved, [this] { + QObject::connect(this, &ConferenceModel::rowsRemoved, [this] { // Warning : called before model remove its items emit countChanged(rowCount()); }); QObject::connect(this, &ConferenceModel::rowsInserted, [this] { emit countChanged(rowCount()); }); - setSourceModel(CoreManager::getInstance()->getCallsListModel()); emit conferenceChanged(); @@ -52,12 +52,10 @@ ConferenceModel::ConferenceModel (QObject *parent) : QSortFilterProxyModel(paren } bool ConferenceModel::filterAcceptsRow (int sourceRow, const QModelIndex &sourceParent) const { - const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent); - const CallModel *callModel = index.data().value(); - - return callModel->getCall()->getParams()->getLocalConferenceMode(); + Q_UNUSED(sourceRow) + Q_UNUSED(sourceParent) + return true; } - // ----------------------------------------------------------------------------- void ConferenceModel::terminate () { diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 714cf304f..9380f414a 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -67,48 +67,39 @@ namespace { CoreManager *CoreManager::mInstance; CoreManager::CoreManager (QObject *parent, const QString &configPath) : - QObject(parent), mHandlers(make_shared(this)) { - mPromiseBuild = QtConcurrent::run(this, &CoreManager::createLinphoneCore, configPath); + QObject(parent), mHandlers(make_shared(this)) { + QTimer * delayedCreationTimer = new QTimer(); + delayedCreationTimer->setSingleShot(true); + QObject::connect(delayedCreationTimer, &QTimer::timeout, this , [configPath, this, delayedCreationTimer]{ + delayedCreationTimer->deleteLater(); + createLinphoneCore(configPath); + qInfo() << QStringLiteral("Core created. Enable iterate."); + mInstance->mCbsTimer->start(); + emit mInstance->coreCreated(); + }); - QObject::connect(&mPromiseWatcher, &QFutureWatcher::finished, this, [] { - qInfo() << QStringLiteral("Core created. Enable iterate."); - mInstance->mCbsTimer->start(); + CoreHandlers *coreHandlers = mHandlers.get(); - emit mInstance->coreCreated(); - }); - - CoreHandlers *coreHandlers = mHandlers.get(); - - QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] { + QObject::connect(coreHandlers, &CoreHandlers::coreStarted, this, [] { // Do not change this order. :) (Or pray.) - mInstance->mCallsListModel = new CallsListModel(mInstance); - mInstance->mContactsListModel = new ContactsListModel(mInstance); - mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance); - mInstance->mSettingsModel = new SettingsModel(mInstance); - mInstance->mSipAddressesModel = new SipAddressesModel(mInstance); + mInstance->mCallsListModel = new CallsListModel(mInstance); + mInstance->mContactsListModel = new ContactsListModel(mInstance); + mInstance->mAccountSettingsModel = new AccountSettingsModel(mInstance); + mInstance->mSettingsModel = new SettingsModel(mInstance); + mInstance->mSipAddressesModel = new SipAddressesModel(mInstance); + EventCountNotifier *eventCountNotifier = new EventCountNotifier(mInstance); + eventCountNotifier->updateUnreadMessageCount(); + QObject::connect(eventCountNotifier, &EventCountNotifier::eventCountChanged, + mInstance, &CoreManager::eventCountChanged + ); + mInstance->mEventCountNotifier = eventCountNotifier; + mInstance->migrate(); + mInstance->mStarted = true; + emit mInstance->coreStarted(); + }); - { - EventCountNotifier *eventCountNotifier = new EventCountNotifier(mInstance); - eventCountNotifier->updateUnreadMessageCount(); - QObject::connect( - eventCountNotifier, &EventCountNotifier::eventCountChanged, - mInstance, &CoreManager::eventCountChanged - ); - mInstance->mEventCountNotifier = eventCountNotifier; - } - - mInstance->migrate(); - - mInstance->mStarted = true; - emit mInstance->coreStarted(); - }); - - QObject::connect( - coreHandlers, &CoreHandlers::logsUploadStateChanged, - this, &CoreManager::handleLogsUploadStateChanged - ); - - mPromiseWatcher.setFuture(mPromiseBuild); + QObject::connect(coreHandlers, &CoreHandlers::logsUploadStateChanged, this, &CoreManager::handleLogsUploadStateChanged); + delayedCreationTimer->start(CbsCallInterval); } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/core/CoreManager.hpp b/linphone-app/src/components/core/CoreManager.hpp index 33b33e581..0b405355e 100644 --- a/linphone-app/src/components/core/CoreManager.hpp +++ b/linphone-app/src/components/core/CoreManager.hpp @@ -22,7 +22,10 @@ #define CORE_MANAGER_H_ #include -#include +#include +#include +#include +#include // ============================================================================= @@ -174,9 +177,6 @@ private: QTimer *mCbsTimer = nullptr; - QFuture mPromiseBuild; - QFutureWatcher mPromiseWatcher; - QMutex mMutexVideoRender; static CoreManager *mInstance; diff --git a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp index 16c1e85ea..c971ef91c 100644 --- a/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp +++ b/linphone-app/src/components/core/event-count-notifier/AbstractEventCountNotifier.cpp @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#include + #include "components/call/CallModel.hpp" #include "components/calls/CallsListModel.hpp" #include "components/chat/ChatModel.hpp" diff --git a/linphone-app/src/components/presence/OwnPresenceModel.cpp b/linphone-app/src/components/presence/OwnPresenceModel.cpp index 3997d2ed6..ab3f757e1 100644 --- a/linphone-app/src/components/presence/OwnPresenceModel.cpp +++ b/linphone-app/src/components/presence/OwnPresenceModel.cpp @@ -18,10 +18,13 @@ * along with this program. If not, see . */ +#include + #include "components/core/CoreManager.hpp" #include "OwnPresenceModel.hpp" + // ============================================================================= using namespace std; diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 4d0dea48c..bd7734797 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -18,6 +18,8 @@ * along with this program. If not, see . */ +#include + #include "config.h" #include "app/paths/Paths.hpp" @@ -28,6 +30,7 @@ #include "AccountSettingsModel.hpp" #include "SettingsModel.hpp" + // ============================================================================= using namespace std; diff --git a/linphone-app/src/components/settings/AccountSettingsModel.hpp b/linphone-app/src/components/settings/AccountSettingsModel.hpp index 50d3fa086..98c54704e 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.hpp @@ -23,6 +23,9 @@ #include #include +#include +#include +#include // ============================================================================= diff --git a/linphone-app/src/components/settings/SettingsModel.cpp b/linphone-app/src/components/settings/SettingsModel.cpp index 79323baa7..c8ca21ff3 100644 --- a/linphone-app/src/components/settings/SettingsModel.cpp +++ b/linphone-app/src/components/settings/SettingsModel.cpp @@ -19,6 +19,7 @@ */ #include +#include #include #include diff --git a/linphone-app/src/components/settings/SettingsModel.hpp b/linphone-app/src/components/settings/SettingsModel.hpp index 49a4540e2..760b90795 100644 --- a/linphone-app/src/components/settings/SettingsModel.hpp +++ b/linphone-app/src/components/settings/SettingsModel.hpp @@ -24,6 +24,7 @@ #include #include #include +#include #include "components/core/CoreHandlers.hpp" diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index 33b943108..cd12294ec 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include "components/call/CallModel.hpp" #include "components/chat/ChatModel.hpp" diff --git a/linphone-app/src/components/sound-player/SoundPlayer.cpp b/linphone-app/src/components/sound-player/SoundPlayer.cpp index 36b9f3d5d..cd93eba64 100644 --- a/linphone-app/src/components/sound-player/SoundPlayer.cpp +++ b/linphone-app/src/components/sound-player/SoundPlayer.cpp @@ -19,6 +19,7 @@ */ #include +#include #include "components/core/CoreManager.hpp" #include "components/settings/SettingsModel.hpp" diff --git a/linphone-app/ui/modules/Linphone/Calls/Calls.qml b/linphone-app/ui/modules/Linphone/Calls/Calls.qml index dbeb4a1b8..e6eaf2e5f 100644 --- a/linphone-app/ui/modules/Linphone/Calls/Calls.qml +++ b/linphone-app/ui/modules/Linphone/Calls/Calls.qml @@ -170,7 +170,7 @@ ListView { SequentialAnimation on color { loops: CallsStyle.entry.endCallAnimation.loops - running: $call && $call.status === CallModel.CallStatusEnded + running: !$call || $call.status === CallModel.CallStatusEnded ColorAnimation { duration: CallsStyle.entry.endCallAnimation.duration diff --git a/linphone-app/ui/views/App/Calls/CallsWindow.qml b/linphone-app/ui/views/App/Calls/CallsWindow.qml index 5d9951928..2e507c0bd 100644 --- a/linphone-app/ui/views/App/Calls/CallsWindow.qml +++ b/linphone-app/ui/views/App/Calls/CallsWindow.qml @@ -18,7 +18,7 @@ Window { // --------------------------------------------------------------------------- // `{}` is a workaround to avoid `TypeError: Cannot read property...` when calls list is empty - readonly property var call: calls.selectedCall || ({ + readonly property var call: (calls.selectedCall?calls.selectedCall:{ callError: '', isOutgoing: true, recording: false, @@ -197,8 +197,8 @@ Window { } } - peerAddress: call.peerAddress - localAddress: call.localAddress + peerAddress: (call?call.peerAddress:'') + localAddress: (call?call.localAddress:'') } Connections { @@ -225,7 +225,7 @@ Window { childB: Loader { anchors.fill: parent - sourceComponent: call.peerAddress && call.localAddress ? chat : null + sourceComponent: window.call && window.call.peerAddress && window.call.localAddress ? chat : null } } } diff --git a/linphone-app/ui/views/App/Calls/Conference.qml b/linphone-app/ui/views/App/Calls/Conference.qml index 7003edd9d..75bb88bb9 100644 --- a/linphone-app/ui/views/App/Calls/Conference.qml +++ b/linphone-app/ui/views/App/Calls/Conference.qml @@ -116,8 +116,7 @@ Rectangle { width: grid.cellWidth Column { - readonly property string sipAddress: $call.sipAddress - readonly property var sipAddressObserver: SipAddressesModel.getSipAddressObserver(sipAddress) + readonly property string sipAddress: $call.peerAddress anchors { fill: parent @@ -133,19 +132,19 @@ Rectangle { width: parent.width horizontalTextAlignment: Text.AlignHCenter - sipAddress: parent.sipAddressObserver.sipAddress - username: LinphoneUtils.getContactUsername(parent.sipAddressObserver) - } - + sipAddress: parent.sipAddress + username: LinphoneUtils.getContactUsername(parent.sipAddress) + } IncallAvatar { + readonly property int size: Math.min( parent.width, parent.height - contactDescription.height - parent.spacing ) anchors.horizontalCenter: parent.horizontalCenter - call: $call + onCallChanged: if(!call) conference.conferenceModel.invalidate() height: size width: size diff --git a/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml b/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml index bce171003..5662296fb 100644 --- a/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml +++ b/linphone-app/ui/views/App/Calls/Dialogs/ConferenceManager.qml @@ -11,7 +11,7 @@ import App.Styles 1.0 DialogPlus { id: conferenceManager - readonly property int maxParticipants: 10 + readonly property int maxParticipants: 20 readonly property int minParticipants: 1 buttons: [ diff --git a/linphone-app/ui/views/App/Calls/Incall.qml b/linphone-app/ui/views/App/Calls/Incall.qml index 5f54faea3..5d1e5cfcf 100644 --- a/linphone-app/ui/views/App/Calls/Incall.qml +++ b/linphone-app/ui/views/App/Calls/Incall.qml @@ -224,7 +224,6 @@ Rectangle { IncallAvatar { call: incall.call - height: Logic.computeAvatarSize(CallStyle.container.avatar.maxSize) width: height }