diff --git a/src/calladapter.cpp b/src/calladapter.cpp index c4badc91d9379d96bda348fb51b26c90b1631886..0ead73b69af89e3f97b44da0f56ea3df9f4f9496 100644 --- a/src/calladapter.cpp +++ b/src/calladapter.cpp @@ -176,7 +176,7 @@ CallAdapter::slotShowIncomingCallView(const QString& accountId, const conversati } } - emit callStatusChanged(lrc::api::call::to_string(call.status), accountId, convInfo.uid); + emit callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid); emit updateConversationSmartList(); } @@ -342,9 +342,7 @@ CallAdapter::connectCallModel(const QString& accountId) */ const auto convInfo = LRCInstance::getConversationFromCallId(callId); if (!convInfo.uid.isEmpty()) { - emit callStatusChanged(lrc::api::call::to_string(call.status), - accountId, - convInfo.uid); + emit callStatusChanged(static_cast<int>(call.status), accountId, convInfo.uid); } switch (call.status) { diff --git a/src/calladapter.h b/src/calladapter.h index fbf5ffc4d0be44620218c80f010a63ffdeb75f89..bd7871d792ebe9770157caf7d411537e5728688d 100644 --- a/src/calladapter.h +++ b/src/calladapter.h @@ -56,7 +56,7 @@ public: Q_INVOKABLE void minimizeParticipant(); Q_INVOKABLE void hangUpThisCall(); Q_INVOKABLE bool isCurrentMaster() const; - Q_INVOKABLE int getCurrentLayoutType() const; + Q_INVOKABLE int getCurrentLayoutType() const; Q_INVOKABLE void holdThisCallToggle(); Q_INVOKABLE void muteThisCallToggle(); Q_INVOKABLE void recordThisCallToggle(); @@ -72,7 +72,7 @@ signals: void showCallStack(const QString& accountId, const QString& convUid, bool forceReset = false); void closeCallStack(const QString& accountId, const QString& convUid); void closePotentialIncomingCallPageWindow(const QString& accountId, const QString& convUid); - void callStatusChanged(const QString& status, const QString& accountId, const QString& convUid); + void callStatusChanged(int index, const QString& accountId, const QString& convUid); void updateConversationSmartList(); void updateParticipantsInfos(const QVariantList& infos, const QString& accountId, @@ -84,7 +84,7 @@ signals: /* * For Call Overlay */ - void updateTimeText(const QString& time); + void updateTimeText(const QString &time); void showOnHoldLabel(bool isPaused); void updateOverlay(bool isPaused, bool isAudioOnly, diff --git a/src/mainview/MainView.qml b/src/mainview/MainView.qml index 5b98007bcd040d4a9c17cdf9ebcba0598bc0e506..1625b433324641db592c49129ef05f80959d7718 100644 --- a/src/mainview/MainView.qml +++ b/src/mainview/MainView.qml @@ -434,7 +434,7 @@ Window { callStackView.updateCorrspondingUI() if (callStackViewShouldShow) { - if (callStateStr == "Talking" || callStateStr == "Hold") { + if (callState === Call.Status.IN_PROGRESS || callState === Call.Status.PAUSED) { ClientWrapper.utilsAdaptor.setCurrentCall( ClientWrapper.utilsAdaptor.getCurrAccId(), currentUID) diff --git a/src/mainview/components/CallStackView.qml b/src/mainview/components/CallStackView.qml index 1f46174b3acbb8bb636c39456bc4efdbbf4a328b..c4901c69f386892d759db589ecbcf794b769e8f9 100644 --- a/src/mainview/components/CallStackView.qml +++ b/src/mainview/components/CallStackView.qml @@ -93,7 +93,7 @@ Rectangle { callStackMainView.pop(itemToFind, StackView.Immediate) } if (currentCallStatus) - outgoingCallPage.callStatusPresentation = currentCallStatus + outgoingCallPage.callStatus = currentCallStatus } function showVideoCallPage(callId) { @@ -158,7 +158,7 @@ Rectangle { function onCallStatusChanged(status, accountId, convUid) { if (responsibleConvUid === convUid && responsibleAccountId === accountId) { - outgoingCallPage.callStatusPresentation = status + outgoingCallPage.callStatus = status } } diff --git a/src/mainview/components/ConversationSmartListView.qml b/src/mainview/components/ConversationSmartListView.qml index eb7cd0d30a4108ee13e9b519745abf4823342031..65177c190b04daa64d8234a9b89f2b170f396111 100644 --- a/src/mainview/components/ConversationSmartListView.qml +++ b/src/mainview/components/ConversationSmartListView.qml @@ -24,7 +24,7 @@ import net.jami.Models 1.0 ListView { id: conversationSmartListView - signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, string callStateStr) + signal needToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, int callState) signal needToSelectItems(string conversationUid) signal needToDeselectItems signal needToBackToWelcomePage diff --git a/src/mainview/components/ConversationSmartListViewItemDelegate.qml b/src/mainview/components/ConversationSmartListViewItemDelegate.qml index 74d07dbc8142e4654c83efbbeb6449e696438c8f..3538200a14007cf2c4ad58d61bd7608b7f5b73aa 100644 --- a/src/mainview/components/ConversationSmartListViewItemDelegate.qml +++ b/src/mainview/components/ConversationSmartListViewItemDelegate.qml @@ -65,7 +65,7 @@ ItemDelegate { conversationSmartListView.needToAccessMessageWebView( DisplayID == DisplayName ? "" : DisplayID, DisplayName, UID, CallStackViewShouldShow, - IsAudioOnly, CallStateStr) + IsAudioOnly, CallState) } } } @@ -137,7 +137,7 @@ ItemDelegate { elide: Text.ElideRight elideWidth: LastInteractionDate ? (smartListItemDelegate.width - lastInteractionPreferredWidth - conversationSmartListUserImage.width-32) : smartListItemDelegate.width - lastInteractionPreferredWidth - text: InCall ? CallStateStr : (Draft ? Draft : LastInteraction) + text: InCall ? ClientWrapper.utilsAdaptor.getCallStatusStr(CallState) : (Draft ? Draft : LastInteraction) } font.hintingPreference: Font.PreferNoHinting diff --git a/src/mainview/components/OutgoingCallPage.qml b/src/mainview/components/OutgoingCallPage.qml index c3a4fd51d203cf0cb946bfff264dd7df477df8b5..b0b2aa8630d244d716e37cf612bfc273b551915e 100644 --- a/src/mainview/components/OutgoingCallPage.qml +++ b/src/mainview/components/OutgoingCallPage.qml @@ -28,7 +28,7 @@ Rectangle { id: outgoingCallPageRect property int buttonPreferredSize: 50 - property string callStatusPresentation: "outgoing" + property int callStatus: 0 property string contactImgSource: "" property string bestName: "Best Name" property string bestId: "Best Id" @@ -160,7 +160,7 @@ Rectangle { horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter - text: callStatusPresentation + "..." + text: ClientWrapper.utilsAdaptor.getCallStatusStr(callStatus) + "..." color: Qt.lighter("white", 1.5) } } diff --git a/src/mainview/components/SidePanel.qml b/src/mainview/components/SidePanel.qml index c861e980b6039f3864f329411df69d044fc8c30b..350244e4d29e4faaf834738c0942390971af872b 100644 --- a/src/mainview/components/SidePanel.qml +++ b/src/mainview/components/SidePanel.qml @@ -31,7 +31,7 @@ Rectangle { property int pendingRequestCount: 0 property int totalUnreadMessagesCount: 0 - signal conversationSmartListNeedToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, string callStateStr) + signal conversationSmartListNeedToAccessMessageWebView(string currentUserDisplayName, string currentUserAlias, string currentUID, bool callStackViewShouldShow, bool isAudioOnly, string callState) signal accountComboBoxNeedToShowWelcomePage() signal conversationSmartListViewNeedToShowWelcomePage signal needToUpdateConversationForAddedContact @@ -87,6 +87,7 @@ Rectangle { function refreshAccountComboBox(index = -1) { + /* * To make sure that the ui is refreshed for accountComboBox. * Note: when index in -1, it means to maintain the @@ -242,7 +243,7 @@ Rectangle { sidePanelRect.conversationSmartListNeedToAccessMessageWebView( currentUserDisplayName, currentUserAlias, currentUID, callStackViewShouldShow, - isAudioOnly, callStateStr) + isAudioOnly, callState) } onNeedToGrabFocus: { diff --git a/src/smartlistmodel.cpp b/src/smartlistmodel.cpp index c3957cbb140f423c512d4bae3f726edbc88136cc..db76a8748933c19319e349269b129e14775f4b06 100644 --- a/src/smartlistmodel.cpp +++ b/src/smartlistmodel.cpp @@ -130,6 +130,7 @@ SmartListModel::data(const QModelIndex &index, int role) const if (role == Role::AccountId) { return QVariant(itemAccId); } + auto &itemAccountInfo = LRCInstance::accountModel().getAccountInfo(itemAccId); item = itemAccountInfo.conversationModel->getConversationForUID(itemConvUid); return getConversationItemData(item, itemAccountInfo, role); @@ -160,7 +161,7 @@ SmartListModel::roleNames() const roles[InCall] = "InCall"; roles[IsAudioOnly] = "IsAudioOnly"; roles[CallStackViewShouldShow] = "CallStackViewShouldShow"; - roles[CallStateStr] = "CallStateStr"; + roles[CallState] = "CallState"; roles[SectionName] = "SectionName"; roles[AccountId] = "AccountId"; roles[Draft] = "Draft"; @@ -340,14 +341,13 @@ SmartListModel::getConversationItemData(const conversation::Info &item, } return QVariant(false); } - case Role::CallStateStr: { + case Role::CallState: { auto* convModel = LRCInstance::getCurrentConversationModel(); const auto convInfo = convModel->getConversationForUID(item.uid); if (!convInfo.uid.isEmpty()) { auto* call = LRCInstance::getCallInfoForConversation(convInfo); if (call) { - auto statusString = call::to_string(call->status); - return QVariant(statusString); + return QVariant(static_cast<int>(call->status)); } } return QVariant(); diff --git a/src/smartlistmodel.h b/src/smartlistmodel.h index bdf35924166019121ccb79413e34733a2145b725..3128d706d30d648408116e3b862c4a696bf948b7 100644 --- a/src/smartlistmodel.h +++ b/src/smartlistmodel.h @@ -55,7 +55,7 @@ public: InCall, IsAudioOnly, CallStackViewShouldShow, - CallStateStr, + CallState, SectionName, AccountId, Draft diff --git a/src/utils.cpp b/src/utils.cpp index a43cf1bbdfb49871c635e19f126e2fc96b2222d4..2723ff39d2e1c0a98e4af721e8786ee87f287831 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -1046,6 +1046,14 @@ UtilsAdapter::getCallId(const QString &accountId, const QString &convUid) return call->id; } +const QString +UtilsAdapter::getCallStatusStr(int statusInt) +{ + const auto status = static_cast<lrc::api::call::Status>(statusInt); + return lrc::api::call::to_string(status); +} + + // returns true if name is valid registered name bool UtilsAdapter::validateRegNameForm(const QString ®Name) diff --git a/src/utils.h b/src/utils.h index f97d0d61cd21d6d6c85e41ac0248b57952f872ff..4ffc5f283d6cdbf545522698a979465d520aa064 100644 --- a/src/utils.h +++ b/src/utils.h @@ -504,6 +504,7 @@ public: Q_INVOKABLE void stopPreviewing(); Q_INVOKABLE bool hasVideoCall(); Q_INVOKABLE const QString getCallId(const QString &accountId, const QString &convUid); + Q_INVOKABLE const QString getCallStatusStr(int statusInt); Q_INVOKABLE QString getStringUTF8(QString string); Q_INVOKABLE bool validateRegNameForm(const QString ®Name); Q_INVOKABLE QString getRecordQualityString(int value);