try to fix persistent call window

This commit is contained in:
Gaelle Braud 2025-09-04 21:05:42 +02:00
parent bad52def4d
commit 251f404ced
3 changed files with 24 additions and 27 deletions

View file

@ -159,11 +159,7 @@ CallGui *CallList::getCurrentCall() const {
}
void CallList::setCurrentCall(CallGui *callGui) {
auto callCore = callGui ? callGui->mCore : nullptr;
if (mCurrentCall != callCore) {
mCurrentCall = callCore;
emit currentCallChanged();
}
setCurrentCallCore(callGui ? callGui->mCore : nullptr);
}
void CallList::setCurrentCallCore(QSharedPointer<CallCore> call) {
@ -184,16 +180,12 @@ void CallList::setHaveCall(bool haveCall) {
}
}
QSharedPointer<CallCore> CallList::getNextCall() const {
QSharedPointer<CallCore> call;
QSharedPointer<CallCore> CallList::getNextCall() {
auto currentCall = getCurrentCallCore();
for (auto it = mList.rbegin(); !call && it != mList.rend(); ++it) {
if (*it != currentCall) {
call = it->objectCast<CallCore>();
}
for (auto &item : getSharedList<CallCore>()) {
if (item != currentCall) return item;
}
return call;
return nullptr;
}
void CallList::onStateChanged() {
@ -202,21 +194,26 @@ void CallList::onStateChanged() {
case LinphoneEnums::CallState::StreamsRunning:
case LinphoneEnums::CallState::Resuming: {
auto sharedCall = get(call);
setCurrentCallCore(sharedCall.objectCast<CallCore>());
setCurrentCallCore(sharedCall ? sharedCall.objectCast<CallCore>() : nullptr);
break;
}
case LinphoneEnums::CallState::Released: {
auto sharedCall = get(call);
auto currentCall = getCurrentCallCore();
// Update current call
if (sharedCall == currentCall) {
// Unpause the next call. The current call will change on resume.
// Assumption: All calls that are not the current are paused.
auto nextCall = getNextCall();
if (nextCall) nextCall->lSetPaused(false);
if (sharedCall) {
auto currentCall = getCurrentCallCore();
sharedCall->disconnect(this);
// Update current call
if (currentCall == sharedCall) {
auto nextCall = getNextCall();
if (nextCall) {
// Unpause the next call. The current call will change on resume.
// Assumption: All calls that are not the current are paused.
nextCall->lSetPaused(false);
}
setCurrentCallCore(nextCall);
}
bool removed = remove(sharedCall);
}
sharedCall->disconnect(this);
remove(sharedCall);
break;
}
default: {

View file

@ -45,7 +45,7 @@ public:
CallGui *getCurrentCall() const; // Used for Ui
QSharedPointer<CallCore> getCurrentCallCore() const;
void setCurrentCall(CallGui* callGui);
void setCurrentCall(CallGui *callGui);
void setCurrentCallCore(QSharedPointer<CallCore> call);
bool getHaveCall() const;
@ -53,7 +53,7 @@ public:
// Get the next call after the current one. Used to switch the current call.
// At the moment, it select the last call in the list.
QSharedPointer<CallCore> getNextCall() const;
QSharedPointer<CallCore> getNextCall();
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
signals:

View file

@ -483,8 +483,8 @@ void AccountModel::setPresence(LinphoneEnums::Presence presence,
QString presenceNote) {
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
lDebug() << log().arg("presence set request to: " + LinphoneEnums::toString(presence) + " user initiated? " +
(userInitiated ? "true" : "false") + " reset to auto? " + (resetToAuto ? "true" : "false"));
lDebug() << log().arg("presence set request to: " + LinphoneEnums::toString(presence) + " | user initiated? " +
(userInitiated ? "true" : "false") + " | reset to auto? " + (resetToAuto ? "true" : "false"));
auto core = CoreModel::getInstance()->getCore();