try to fix persistent call window
This commit is contained in:
parent
bad52def4d
commit
251f404ced
3 changed files with 24 additions and 27 deletions
|
|
@ -159,11 +159,7 @@ CallGui *CallList::getCurrentCall() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallList::setCurrentCall(CallGui *callGui) {
|
void CallList::setCurrentCall(CallGui *callGui) {
|
||||||
auto callCore = callGui ? callGui->mCore : nullptr;
|
setCurrentCallCore(callGui ? callGui->mCore : nullptr);
|
||||||
if (mCurrentCall != callCore) {
|
|
||||||
mCurrentCall = callCore;
|
|
||||||
emit currentCallChanged();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallList::setCurrentCallCore(QSharedPointer<CallCore> call) {
|
void CallList::setCurrentCallCore(QSharedPointer<CallCore> call) {
|
||||||
|
|
@ -184,16 +180,12 @@ void CallList::setHaveCall(bool haveCall) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QSharedPointer<CallCore> CallList::getNextCall() const {
|
QSharedPointer<CallCore> CallList::getNextCall() {
|
||||||
QSharedPointer<CallCore> call;
|
|
||||||
auto currentCall = getCurrentCallCore();
|
auto currentCall = getCurrentCallCore();
|
||||||
for (auto it = mList.rbegin(); !call && it != mList.rend(); ++it) {
|
for (auto &item : getSharedList<CallCore>()) {
|
||||||
if (*it != currentCall) {
|
if (item != currentCall) return item;
|
||||||
call = it->objectCast<CallCore>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return nullptr;
|
||||||
return call;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CallList::onStateChanged() {
|
void CallList::onStateChanged() {
|
||||||
|
|
@ -202,21 +194,26 @@ void CallList::onStateChanged() {
|
||||||
case LinphoneEnums::CallState::StreamsRunning:
|
case LinphoneEnums::CallState::StreamsRunning:
|
||||||
case LinphoneEnums::CallState::Resuming: {
|
case LinphoneEnums::CallState::Resuming: {
|
||||||
auto sharedCall = get(call);
|
auto sharedCall = get(call);
|
||||||
setCurrentCallCore(sharedCall.objectCast<CallCore>());
|
setCurrentCallCore(sharedCall ? sharedCall.objectCast<CallCore>() : nullptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case LinphoneEnums::CallState::Released: {
|
case LinphoneEnums::CallState::Released: {
|
||||||
auto sharedCall = get(call);
|
auto sharedCall = get(call);
|
||||||
auto currentCall = getCurrentCallCore();
|
if (sharedCall) {
|
||||||
// Update current call
|
auto currentCall = getCurrentCallCore();
|
||||||
if (sharedCall == currentCall) {
|
sharedCall->disconnect(this);
|
||||||
// Unpause the next call. The current call will change on resume.
|
// Update current call
|
||||||
// Assumption: All calls that are not the current are paused.
|
if (currentCall == sharedCall) {
|
||||||
auto nextCall = getNextCall();
|
auto nextCall = getNextCall();
|
||||||
if (nextCall) nextCall->lSetPaused(false);
|
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;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ public:
|
||||||
|
|
||||||
CallGui *getCurrentCall() const; // Used for Ui
|
CallGui *getCurrentCall() const; // Used for Ui
|
||||||
QSharedPointer<CallCore> getCurrentCallCore() const;
|
QSharedPointer<CallCore> getCurrentCallCore() const;
|
||||||
void setCurrentCall(CallGui* callGui);
|
void setCurrentCall(CallGui *callGui);
|
||||||
void setCurrentCallCore(QSharedPointer<CallCore> call);
|
void setCurrentCallCore(QSharedPointer<CallCore> call);
|
||||||
|
|
||||||
bool getHaveCall() const;
|
bool getHaveCall() const;
|
||||||
|
|
@ -53,7 +53,7 @@ public:
|
||||||
|
|
||||||
// Get the next call after the current one. Used to switch the current call.
|
// 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.
|
// 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;
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -483,8 +483,8 @@ void AccountModel::setPresence(LinphoneEnums::Presence presence,
|
||||||
QString presenceNote) {
|
QString presenceNote) {
|
||||||
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
mustBeInLinphoneThread(log().arg(Q_FUNC_INFO));
|
||||||
|
|
||||||
lDebug() << log().arg("presence set request to: " + LinphoneEnums::toString(presence) + " user initiated? " +
|
lDebug() << log().arg("presence set request to: " + LinphoneEnums::toString(presence) + " | user initiated? " +
|
||||||
(userInitiated ? "true" : "false") + " reset to auto? " + (resetToAuto ? "true" : "false"));
|
(userInitiated ? "true" : "false") + " | reset to auto? " + (resetToAuto ? "true" : "false"));
|
||||||
|
|
||||||
auto core = CoreModel::getInstance()->getCore();
|
auto core = CoreModel::getInstance()->getCore();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue