mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-03-28 14:56:19 +01:00
mainview: get call state from API's enumeration
In order to make it work with the translations, call status is no longer passed as a string but as an integer (from enum lrc::api::call::Status). Gitlab: #10 Change-Id: If8d8b7093fbf82e9b7732e6991eec647ad0d50b7
This commit is contained in:
parent
78726ecc19
commit
76b94aac11
12 changed files with 30 additions and 22 deletions
|
@ -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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -55,7 +55,7 @@ public:
|
|||
InCall,
|
||||
IsAudioOnly,
|
||||
CallStackViewShouldShow,
|
||||
CallStateStr,
|
||||
CallState,
|
||||
SectionName,
|
||||
AccountId,
|
||||
Draft
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue