diff --git a/linphone-app/src/components/participant/ParticipantDeviceModel.cpp b/linphone-app/src/components/participant/ParticipantDeviceModel.cpp index 1d8983b19..cb50084dc 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceModel.cpp +++ b/linphone-app/src/components/participant/ParticipantDeviceModel.cpp @@ -44,6 +44,7 @@ ParticipantDeviceModel::ParticipantDeviceModel (CallModel * callModel, std::shar mParticipantDeviceListener = std::make_shared(nullptr); connectTo(mParticipantDeviceListener.get()); device->addListener(mParticipantDeviceListener); + mState = device->getState(); } mCall = callModel; if(mCall) @@ -105,7 +106,11 @@ bool ParticipantDeviceModel::getIsMuted() const{ return mParticipantDevice ? mParticipantDevice->getIsMuted() : false; } -std::shared_ptr ParticipantDeviceModel::getDevice(){ +LinphoneEnums::ParticipantDeviceState ParticipantDeviceModel::getState() const{ + return LinphoneEnums::fromLinphone(mState); +} + +std::shared_ptr ParticipantDeviceModel::getDevice(){ return mParticipantDevice; } @@ -127,6 +132,14 @@ void ParticipantDeviceModel::setIsSpeaking(bool speaking){ } } +void ParticipantDeviceModel::setState(LinphoneEnums::ParticipantDeviceState state){ + auto newState = LinphoneEnums::toLinphone(state); + if(mState != newState){ + mState = newState; + emit stateChanged(); + } +} + void ParticipantDeviceModel::updateVideoEnabled(){ bool enabled = (mParticipantDevice && mParticipantDevice->isInConference() && mParticipantDevice->getStreamAvailability(linphone::StreamType::Video) && ( mParticipantDevice->getStreamCapability(linphone::StreamType::Video) == linphone::MediaDirection::SendRecv @@ -175,6 +188,7 @@ void ParticipantDeviceModel::onStateChanged(const std::shared_ptr & participantDevice, linphone::MediaDirection direction, linphone::StreamType streamType) { diff --git a/linphone-app/src/components/participant/ParticipantDeviceModel.hpp b/linphone-app/src/components/participant/ParticipantDeviceModel.hpp index 459c44f07..1800492ed 100644 --- a/linphone-app/src/components/participant/ParticipantDeviceModel.hpp +++ b/linphone-app/src/components/participant/ParticipantDeviceModel.hpp @@ -23,6 +23,8 @@ #include + +#include "utils/LinphoneEnums.hpp" // ============================================================================= #include #include @@ -52,6 +54,7 @@ public: Q_PROPERTY(bool isPaused READ getPaused WRITE setPaused NOTIFY isPausedChanged) Q_PROPERTY(bool isSpeaking READ getIsSpeaking WRITE setIsSpeaking NOTIFY isSpeakingChanged) Q_PROPERTY(bool isMuted READ getIsMuted NOTIFY isMutedChanged) + Q_PROPERTY(LinphoneEnums::ParticipantDeviceState state READ getState WRITE setState NOTIFY stateChanged) QString getName() const; QString getDisplayName() const; @@ -63,11 +66,13 @@ public: bool getPaused() const; bool getIsSpeaking() const; bool getIsMuted() const; + LinphoneEnums::ParticipantDeviceState getState() const; std::shared_ptr getDevice(); void setPaused(bool paused); void setIsSpeaking(bool speaking); + void setState(LinphoneEnums::ParticipantDeviceState state); virtual void onIsSpeakingChanged(const std::shared_ptr & participantDevice, bool isSpeaking); virtual void onIsMuted(const std::shared_ptr & participantDevice, bool isMuted); @@ -87,6 +92,7 @@ signals: void isPausedChanged(); void isSpeakingChanged(); void isMutedChanged(); + void stateChanged(); private: @@ -94,6 +100,7 @@ private: bool mIsVideoEnabled; bool mIsPaused = false; bool mIsSpeaking = false; + linphone::ParticipantDeviceState mState; std::shared_ptr mParticipantDevice; std::shared_ptr mParticipantDeviceListener; // This is passed to linpĥone object and must be in shared_ptr diff --git a/linphone-app/src/utils/LinphoneEnums.cpp b/linphone-app/src/utils/LinphoneEnums.cpp index dc5c07ac3..d3e26513d 100644 --- a/linphone-app/src/utils/LinphoneEnums.cpp +++ b/linphone-app/src/utils/LinphoneEnums.cpp @@ -78,6 +78,14 @@ LinphoneEnums::ConferenceLayout LinphoneEnums::fromLinphone(const linphone::Conf return static_cast(layout); } +linphone::ParticipantDeviceState LinphoneEnums::toLinphone(const LinphoneEnums::ParticipantDeviceState& state){ + return static_cast(state); +} + +LinphoneEnums::ParticipantDeviceState LinphoneEnums::fromLinphone(const linphone::ParticipantDeviceState& state){ + return static_cast(state); +} + linphone::Tunnel::Mode LinphoneEnums::toLinphone(const LinphoneEnums::TunnelMode& data){ return static_cast(data); } diff --git a/linphone-app/src/utils/LinphoneEnums.hpp b/linphone-app/src/utils/LinphoneEnums.hpp index b29d843ca..bbc354a3a 100644 --- a/linphone-app/src/utils/LinphoneEnums.hpp +++ b/linphone-app/src/utils/LinphoneEnums.hpp @@ -121,6 +121,25 @@ Q_ENUM_NS(ConferenceLayout) linphone::ConferenceLayout toLinphone(const LinphoneEnums::ConferenceLayout& layout); LinphoneEnums::ConferenceLayout fromLinphone(const linphone::ConferenceLayout& layout); +enum ParticipantDeviceState { + ParticipantDeviceStateJoining = int(linphone::ParticipantDeviceState::Joining), + ParticipantDeviceStatePresent = int(linphone::ParticipantDeviceState::Present), + ParticipantDeviceStateLeaving = int(linphone::ParticipantDeviceState::Leaving), + ParticipantDeviceStateLeft = int(linphone::ParticipantDeviceState::Left), + ParticipantDeviceStateScheduledForJoining = int(linphone::ParticipantDeviceState::ScheduledForJoining), + ParticipantDeviceStateScheduledForLeaving = int(linphone::ParticipantDeviceState::ScheduledForLeaving), + ParticipantDeviceStateOnHold = int(linphone::ParticipantDeviceState::OnHold), + ParticipantDeviceStateAlerting = int(linphone::ParticipantDeviceState::Alerting), + ParticipantDeviceStateMutedByFocus = int(linphone::ParticipantDeviceState::MutedByFocus), + +}; +Q_ENUM_NS(ParticipantDeviceState) + +linphone::ParticipantDeviceState toLinphone(const LinphoneEnums::ParticipantDeviceState& state); +LinphoneEnums::ParticipantDeviceState fromLinphone(const linphone::ParticipantDeviceState& state); + + + enum TunnelMode { TunnelModeDisable = int(linphone::Tunnel::Mode::Disable), TunnelModeEnable= int(linphone::Tunnel::Mode::Enable), diff --git a/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml b/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml index 2e9e4000c..1737229b4 100644 --- a/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml +++ b/linphone-app/ui/modules/Linphone/Sticker/DecorationSticker.qml @@ -6,6 +6,7 @@ import App.Styles 1.0 import Common 1.0 import Common.Styles 1.0 import Linphone 1.0 +import LinphoneEnums 1.0 import Linphone.Styles 1.0 import 'qrc:/ui/scripts/Utils/utils.js' as Utils @@ -124,8 +125,8 @@ Item{ } Rectangle{// Mute visible: mainItem.currentDevice && mainItem.currentDevice.isMuted - height: DecorationStickerStyle.isMuted.button.iconSize - width: height + Layout.preferredHeight: DecorationStickerStyle.isMuted.button.iconSize + Layout.preferredWidth: DecorationStickerStyle.isMuted.button.iconSize radius: width/2 color: DecorationStickerStyle.isMuted.button.backgroundNormalColor Icon{ @@ -135,5 +136,10 @@ Item{ iconSize: DecorationStickerStyle.isMuted.button.iconSize } } + BusyIndicator{// Joining spinner + Layout.preferredHeight: 20 + Layout.preferredWidth: 20 + running: mainItem.currentDevice && (mainItem.currentDevice.state == LinphoneEnums.ParticipantDeviceStateJoining || mainItem.currentDevice.state == LinphoneEnums.ParticipantDeviceStateScheduledForJoining || mainItem.currentDevice.state == LinphoneEnums.ParticipantDeviceStateAlerting) + } } }