mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-07 14:44:01 +00:00
Fix hidden IMDN status in menu by first loading all imdn, and optimize by loading GUI list on request.
This commit is contained in:
parent
0052a5357e
commit
79137f71c3
5 changed files with 47 additions and 41 deletions
|
|
@ -57,10 +57,11 @@ int ParticipantImdnStateProxyModel::getCount(){
|
|||
}
|
||||
|
||||
ChatMessageModel * ParticipantImdnStateProxyModel::getChatMessageModel(){
|
||||
return nullptr;
|
||||
return mChatMessageModel;
|
||||
}
|
||||
|
||||
void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * message){
|
||||
mChatMessageModel = message;
|
||||
if(message){
|
||||
ParticipantImdnStateListModel *model = static_cast<ParticipantImdnStateListModel*>(sourceModel());
|
||||
ParticipantImdnStateListModel *messageModel = message->getParticipantImdnStates().get();
|
||||
|
|
@ -68,7 +69,7 @@ void ParticipantImdnStateProxyModel::setChatMessageModel(ChatMessageModel * mess
|
|||
setSourceModel(messageModel);
|
||||
connect(messageModel, &ParticipantImdnStateListModel::countChanged, this, &ParticipantImdnStateProxyModel::countChanged);
|
||||
sort(0);
|
||||
emit chatMessageModelChanged();
|
||||
}
|
||||
}
|
||||
emit chatMessageModelChanged();
|
||||
}
|
||||
|
|
@ -53,6 +53,7 @@ protected:
|
|||
virtual bool lessThan (const QModelIndex &left, const QModelIndex &right) const override;
|
||||
|
||||
std::shared_ptr<ParticipantImdnStateListModel> mImdns;
|
||||
ChatMessageModel * mChatMessageModel = nullptr;
|
||||
|
||||
};
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -18,44 +18,48 @@ import 'Message.js' as Logic
|
|||
// =============================================================================
|
||||
|
||||
|
||||
GridView{
|
||||
id: deliveryLayout
|
||||
|
||||
Loader{
|
||||
id: loader
|
||||
property ChatMessageModel chatMessageModel
|
||||
|
||||
//height: visible ? ChatStyle.composingText.height*container.proxyModel.composers.length : 0
|
||||
height: visible ? (ChatStyle.composingText.height-5)*deliveryLayout.model.count : 0
|
||||
cellWidth: parent.width; cellHeight: ChatStyle.composingText.height-5
|
||||
property ParticipantImdnStateProxyModel imdnStatesModel: ParticipantImdnStateProxyModel {
|
||||
chatMessageModel: loader.chatMessageModel
|
||||
}
|
||||
height: visible ? (ChatStyle.composingText.height-5)*loader.imdnStatesModel.count : 0
|
||||
visible:false
|
||||
model: ParticipantImdnStateProxyModel{
|
||||
id: imdnStatesModel
|
||||
chatMessageModel: deliveryLayout.visible ? deliveryLayout.chatMessageModel: null
|
||||
}
|
||||
function getText(state, displayName, stateChangeTime){
|
||||
if(state == LinphoneEnums.ChatMessageStateDelivered)
|
||||
//: 'Send to %1 - %2' Little message to indicate the state of a message
|
||||
//~ Context %1 is someone, %2 is a date/time. The state is that the message has been sent but not received.
|
||||
return qsTr('deliveryDelivered').arg(displayName).arg(stateChangeTime)
|
||||
else if(state == LinphoneEnums.ChatMessageStateDeliveredToUser)
|
||||
//: 'Retrieved by %1 - %2' Little message to indicate the state of a message
|
||||
//~ Context %1 is someone, %2 is a date/time. The state is that the message has been retrieved
|
||||
return qsTr('deliveryDeliveredToUser').arg(displayName).arg(stateChangeTime)
|
||||
else if(state == LinphoneEnums.ChatMessageStateDisplayed)
|
||||
//: 'Read by %1 - %2' Little message to indicate the state of a message
|
||||
//~ Context %1 is someone, %2 is a date/time. The state that the message has been read.
|
||||
return qsTr('deliveryDisplayed').arg(displayName).arg(stateChangeTime)
|
||||
else if(state == LinphoneEnums.ChatMessageStateNotDelivered)
|
||||
//: "%1 have nothing received" Little message to indicate the state of a message
|
||||
//~ Context %1 is someone. The state is that the message hasn't been delivered.
|
||||
return qsTr('deliveryNotDelivered').arg(displayName)
|
||||
else return ''
|
||||
}
|
||||
delegate:Text{
|
||||
height: ChatStyle.composingText.height-5
|
||||
width: GridView.width
|
||||
text: deliveryLayout.getText(modelData.state, modelData.displayName, UtilsCpp.toDateTimeString(modelData.stateChangeTime))
|
||||
color: ChatStyle.entry.event.text.color
|
||||
font.pointSize: Units.dp * 8
|
||||
elide: Text.ElideMiddle
|
||||
active: visible
|
||||
sourceComponent:
|
||||
GridView{
|
||||
id: deliveryLayout
|
||||
|
||||
cellWidth: parent.width; cellHeight: ChatStyle.composingText.height-5
|
||||
|
||||
model: loader.imdnStatesModel
|
||||
function getText(state, displayName, stateChangeTime){
|
||||
if(state == LinphoneEnums.ChatMessageStateDelivered)
|
||||
//: 'Send to %1 - %2' Little message to indicate the state of a message
|
||||
//~ Context %1 is someone, %2 is a date/time. The state is that the message has been sent but not received.
|
||||
return qsTr('deliveryDelivered').arg(displayName).arg(stateChangeTime)
|
||||
else if(state == LinphoneEnums.ChatMessageStateDeliveredToUser)
|
||||
//: 'Retrieved by %1 - %2' Little message to indicate the state of a message
|
||||
//~ Context %1 is someone, %2 is a date/time. The state is that the message has been retrieved
|
||||
return qsTr('deliveryDeliveredToUser').arg(displayName).arg(stateChangeTime)
|
||||
else if(state == LinphoneEnums.ChatMessageStateDisplayed)
|
||||
//: 'Read by %1 - %2' Little message to indicate the state of a message
|
||||
//~ Context %1 is someone, %2 is a date/time. The state that the message has been read.
|
||||
return qsTr('deliveryDisplayed').arg(displayName).arg(stateChangeTime)
|
||||
else if(state == LinphoneEnums.ChatMessageStateNotDelivered)
|
||||
//: "%1 have nothing received" Little message to indicate the state of a message
|
||||
//~ Context %1 is someone. The state is that the message hasn't been delivered.
|
||||
return qsTr('deliveryNotDelivered').arg(displayName)
|
||||
else return ''
|
||||
}
|
||||
delegate:Text{
|
||||
height: ChatStyle.composingText.height-5
|
||||
width: GridView.width
|
||||
text: deliveryLayout.getText(modelData.state, modelData.displayName, UtilsCpp.toDateTimeString(modelData.stateChangeTime))
|
||||
color: ChatStyle.entry.event.text.color
|
||||
font.pointSize: Units.dp * 8
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,7 @@ Row {
|
|||
//height: parent.height
|
||||
//width: parent.width
|
||||
|
||||
deliveryCount: deliveryLayout.model.count
|
||||
deliveryCount: deliveryLayout.imdnStatesModel.count
|
||||
onDeliveryStatusClicked: deliveryLayout.visible = !deliveryLayout.visible
|
||||
onRemoveEntryRequested: removeEntry()
|
||||
deliveryVisible: deliveryLayout.visible
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ Item {
|
|||
|
||||
lastTextSelected: message.lastTextSelected
|
||||
content: $chatEntry.content
|
||||
deliveryCount: deliveryLayout.model.count
|
||||
deliveryCount: deliveryLayout.imdnStatesModel.count
|
||||
onDeliveryStatusClicked: deliveryLayout.visible = !deliveryLayout.visible
|
||||
onRemoveEntryRequested: removeEntry()
|
||||
deliveryVisible: deliveryLayout.visible
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue