diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 0069021eb..149797c6d 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -615,7 +615,9 @@ void CallModel::verifyAuthenticationToken (bool verify) { void CallModel::updateStreams () { mCall->update(nullptr); } - +void CallModel::toggleSpeakerMute(){ + setSpeakerMuted(!getSpeakerMuted()); +} // ----------------------------------------------------------------------------- CallModel::CallEncryption CallModel::getEncryption () const { diff --git a/linphone-app/src/components/call/CallModel.hpp b/linphone-app/src/components/call/CallModel.hpp index 204814cb5..8ea89af5a 100644 --- a/linphone-app/src/components/call/CallModel.hpp +++ b/linphone-app/src/components/call/CallModel.hpp @@ -130,6 +130,8 @@ public: Q_INVOKABLE void verifyAuthenticationToken (bool verify); Q_INVOKABLE void updateStreams (); + + Q_INVOKABLE void toggleSpeakerMute(); signals: void callErrorChanged (const QString &callError); diff --git a/linphone-app/src/components/chat/ChatModel.cpp b/linphone-app/src/components/chat/ChatModel.cpp index 694e02363..f7672cca2 100644 --- a/linphone-app/src/components/chat/ChatModel.cpp +++ b/linphone-app/src/components/chat/ChatModel.cpp @@ -200,7 +200,7 @@ static inline void fillMessageEntry (QVariantMap &dest, const shared_ptr(message->getState()); + dest["status"] = static_cast(message->getState()); shared_ptr content = message->getFileTransferInformation(); if (content) { @@ -310,13 +310,21 @@ ChatModel::ChatModel (const QString &peerAddress, const QString &localAddress) { mMessageHandlers = make_shared(this); setSipAddresses(peerAddress, localAddress); - +// Rebind lost handlers + for(auto i = mEntries.begin() ; i != mEntries.end() ; ++i){ + if(i->first["type"] == EntryType::MessageEntry){ + shared_ptr message = static_pointer_cast(i->second); + message->removeListener(mMessageHandlers);// Remove old listener if already exists + message->addListener(mMessageHandlers); + } + } { CoreHandlers *coreHandlers = mCoreHandlers.get(); QObject::connect(coreHandlers, &CoreHandlers::messageReceived, this, &ChatModel::handleMessageReceived); QObject::connect(coreHandlers, &CoreHandlers::callStateChanged, this, &ChatModel::handleCallStateChanged); QObject::connect(coreHandlers, &CoreHandlers::isComposingChanged, this, &ChatModel::handleIsComposingChanged); } + } ChatModel::~ChatModel () { @@ -343,7 +351,7 @@ QVariant ChatModel::data (const QModelIndex &index, int role) const { switch (role) { case Roles::ChatEntry: { auto &data = mEntries[row].first; - if (!data.contains("status")) + if (data.contains("type") && data["type"]==EntryType::MessageEntry && !data.contains("content")) fillMessageEntry(data, static_pointer_cast(mEntries[row].second)); return QVariant::fromValue(data); } @@ -406,7 +414,7 @@ QString ChatModel::getFullLocalAddress () const { void ChatModel::setSipAddresses (const QString &peerAddress, const QString &localAddress) { shared_ptr core = CoreManager::getInstance()->getCore(); shared_ptr factory(linphone::Factory::get()); - + mChatRoom = core->getChatRoom( factory->createAddress(Utils::appStringToCoreString(peerAddress)), factory->createAddress(Utils::appStringToCoreString(localAddress)) @@ -436,6 +444,7 @@ void ChatModel::setSipAddresses (const QString &peerAddress, const QString &loca qInfo() << QStringLiteral("ChatModel (%1, %2) loaded in %3 milliseconds.") .arg(peerAddress).arg(localAddress).arg(timer.elapsed()); + } bool ChatModel::getIsRemoteComposing () const { @@ -472,6 +481,7 @@ void ChatModel::removeAllEntries () { void ChatModel::sendMessage (const QString &message) { shared_ptr _message = mChatRoom->createMessage(Utils::appStringToCoreString(message)); + _message->removeListener(mMessageHandlers);// Remove old listener if already exists _message->addListener(mMessageHandlers); insertMessageAtEnd(_message); @@ -498,6 +508,7 @@ void ChatModel::resendMessage (int id) { case MessageStatusFileTransferError: case MessageStatusNotDelivered: { shared_ptr message = static_pointer_cast(entry.second); + message->removeListener(mMessageHandlers);// Remove old listener if already exists message->addListener(mMessageHandlers); message->resend(); @@ -534,6 +545,7 @@ void ChatModel::sendFileMessage (const QString &path) { content->setName(Utils::appStringToCoreString( QFileInfo(file).fileName())); shared_ptr message = mChatRoom->createFileTransferMessage(content); message->getContents().front()->setFilePath(Utils::appStringToCoreString(path)); + message->removeListener(mMessageHandlers);// Remove old listener if already exists message->addListener(mMessageHandlers); createThumbnail(message); @@ -575,7 +587,8 @@ void ChatModel::downloadFile (int id) { if (!soFarSoGood) { qWarning() << QStringLiteral("Unable to create safe file path for: %1.").arg(id); return; - } + } + message->removeListener(mMessageHandlers);// Remove old listener if already exists message->addListener(mMessageHandlers); message->getContents().front()->setFilePath(Utils::appStringToCoreString(safeFilePath)); diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index 9380f414a..f05286cbb 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -59,7 +59,7 @@ namespace { constexpr char LinphoneDomain[] = "sip.linphone.org"; constexpr char DefaultContactParameters[] = "message-expires=604800"; constexpr int DefaultExpires = 3600; - constexpr char DownloadUrl[] = "https://www.linphone.org/technical-corner/linphone/downloads"; + constexpr char DownloadUrl[] = "https://www.linphone.org/technical-corner/linphone"; } // ----------------------------------------------------------------------------- diff --git a/linphone-app/src/components/presence/OwnPresenceModel.cpp b/linphone-app/src/components/presence/OwnPresenceModel.cpp index ab3f757e1..29b2a6c57 100644 --- a/linphone-app/src/components/presence/OwnPresenceModel.cpp +++ b/linphone-app/src/components/presence/OwnPresenceModel.cpp @@ -21,6 +21,7 @@ #include #include "components/core/CoreManager.hpp" +#include "components/settings/AccountSettingsModel.hpp" #include "OwnPresenceModel.hpp" @@ -29,6 +30,16 @@ using namespace std; +OwnPresenceModel::OwnPresenceModel (QObject *parent) : QObject(parent) { + AccountSettingsModel *accountSettingsModel = CoreManager::getInstance()->getAccountSettingsModel(); +// Update status when changing the publish presence from settings + QObject::connect(accountSettingsModel, &AccountSettingsModel::publishPresenceChanged, this, [this]() { + Presence::PresenceStatus status = static_cast(CoreManager::getInstance()->getCore()->getConsolidatedPresence()); + emit presenceStatusChanged(status); + emit presenceLevelChanged(Presence::getPresenceLevel(status)); + }); +} + Presence::PresenceLevel OwnPresenceModel::getPresenceLevel () const { return Presence::getPresenceLevel(getPresenceStatus()); } diff --git a/linphone-app/src/components/presence/OwnPresenceModel.hpp b/linphone-app/src/components/presence/OwnPresenceModel.hpp index f1e1a57f2..78ce83ae6 100644 --- a/linphone-app/src/components/presence/OwnPresenceModel.hpp +++ b/linphone-app/src/components/presence/OwnPresenceModel.hpp @@ -37,7 +37,7 @@ class OwnPresenceModel : public QObject { Q_PROPERTY(Presence::PresenceStatus presenceStatus READ getPresenceStatus WRITE setPresenceStatus NOTIFY presenceStatusChanged); public: - OwnPresenceModel (QObject *parent = Q_NULLPTR) : QObject(parent) {} + OwnPresenceModel (QObject *parent = Q_NULLPTR); signals: void presenceLevelChanged (Presence::PresenceLevel level); diff --git a/linphone-app/src/components/settings/AccountSettingsModel.cpp b/linphone-app/src/components/settings/AccountSettingsModel.cpp index 9053d88cd..3ca1c09b3 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.cpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.cpp @@ -212,6 +212,7 @@ bool AccountSettingsModel::addOrUpdateProxyConfig ( const QVariantMap &data ) { Q_CHECK_PTR(proxyConfig); + bool newPublishPresence = false; proxyConfig->edit(); @@ -249,6 +250,7 @@ bool AccountSettingsModel::addOrUpdateProxyConfig ( proxyConfig->setContactParameters(Utils::appStringToCoreString(data["contactParams"].toString())); proxyConfig->setAvpfRrInterval(uint8_t(data["avpfInterval"].toInt())); proxyConfig->enableRegister(data["registerEnabled"].toBool()); + newPublishPresence = proxyConfig->publishEnabled() != data["publishPresence"].toBool(); proxyConfig->enablePublish(data["publishPresence"].toBool()); proxyConfig->setAvpfMode(data["avpfEnabled"].toBool() ? linphone::AVPFMode::Enabled @@ -291,7 +293,8 @@ bool AccountSettingsModel::addOrUpdateProxyConfig ( "", "" )); - + if( newPublishPresence) + emit publishPresenceChanged(); return addOrUpdateProxyConfig(proxyConfig); } diff --git a/linphone-app/src/components/settings/AccountSettingsModel.hpp b/linphone-app/src/components/settings/AccountSettingsModel.hpp index f2ff76dee..151d3cd63 100644 --- a/linphone-app/src/components/settings/AccountSettingsModel.hpp +++ b/linphone-app/src/components/settings/AccountSettingsModel.hpp @@ -84,6 +84,7 @@ public: signals: void accountSettingsUpdated (); + void publishPresenceChanged(); private: QString getUsername () const; diff --git a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp index cd12294ec..683f6a1dc 100644 --- a/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp +++ b/linphone-app/src/components/sip-addresses/SipAddressesModel.cpp @@ -438,9 +438,8 @@ void SipAddressesModel::handleIsComposingChanged (const shared_ptr