1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-04-22 06:02:03 +02:00

swarmdetailspanel: update on changes + fix chatviewheader

Change-Id: Ieeb6811101f7c1dadc2b9d07fdac93cc4fe68dd4
This commit is contained in:
Sébastien Blin 2022-07-18 14:45:29 -04:00
parent a374f8cf67
commit b5c54696ce
6 changed files with 32 additions and 18 deletions

View file

@ -116,6 +116,16 @@ CurrentConversation::onConversationUpdated(const QString& convId)
updateData();
}
void
CurrentConversation::onProfileUpdated(const QString& convId)
{
// filter for our currently set id
if (id_ != convId)
return;
set_title(lrcInstance_->getCurrentConversationModel()->title(convId));
set_description(lrcInstance_->getCurrentConversationModel()->description(convId));
}
void
CurrentConversation::connectModel()
{
@ -128,4 +138,9 @@ CurrentConversation::connectModel()
this,
&CurrentConversation::onConversationUpdated,
Qt::UniqueConnection);
connect(lrcInstance_->getCurrentConversationModel(),
&ConversationModel::profileUpdated,
this,
&CurrentConversation::onProfileUpdated,
Qt::UniqueConnection);
}

View file

@ -57,6 +57,7 @@ public:
private Q_SLOTS:
void updateData();
void onConversationUpdated(const QString& convId);
void onProfileUpdated(const QString& convId);
private:
LRCInstance* lrcInstance_;

View file

@ -182,8 +182,6 @@ Rectangle {
var item = ConversationsAdapter.getConvInfoMap(convId)
if (item.convId === undefined)
return
chatView.headerUserAliasLabelText = item.title
chatView.headerUserUserNameLabelText = item.description
if (item.callStackViewShouldShow) {
if (inSettingsView) {
toggleSettingsView()

View file

@ -32,9 +32,6 @@ import "../js/pluginhandlerpickercreation.js" as PluginHandlerPickerCreation
Rectangle {
id: root
property string headerUserAliasLabelText: ""
property string headerUserUserNameLabelText: ""
property bool allMessagesLoaded
signal needToHideConversationInCall
@ -63,9 +60,6 @@ Rectangle {
Layout.maximumHeight: JamiTheme.chatViewHeaderPreferredHeight
Layout.minimumWidth: JamiTheme.chatViewHeaderMinimumWidth
userAliasLabelText: headerUserAliasLabelText
userUserNameLabelText: headerUserUserNameLabelText
DropArea {
anchors.fill: parent
onDropped: chatViewFooter.setFilePathsToSend(drop.urls)

View file

@ -29,15 +29,19 @@ import "../../commoncomponents"
Rectangle {
id: root
property string userAliasLabelText
property string userUserNameLabelText
signal backClicked
signal needToHideConversationInCall
signal addToConversationClicked
signal pluginSelector
signal showDetailsClicked
Connections {
target: CurrentConversation
enabled: true
function onTitleChanged() { title.eText = CurrentConversation.title }
function onDescriptionChanged() { description.eText = CurrentConversation.description }
}
property bool interactionButtonsVisibility: {
if (CurrentConversation.inCall)
return false
@ -109,7 +113,7 @@ Rectangle {
spacing: 0
ElidedTextLabel {
id: userAliasLabel
id: title
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
@ -118,23 +122,23 @@ Rectangle {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
eText: userAliasLabelText
eText: CurrentConversation.title
maxWidth: userNameOrIdRect.width
}
ElidedTextLabel {
id: userUserNameLabel
id: description
Layout.alignment: Qt.AlignVCenter | Qt.AlignLeft
visible: text.length &&
userAliasLabelText != userUserNameLabelText
CurrentConversation.title != CurrentConversation.description
font.pointSize: JamiTheme.textFontSize
color: JamiTheme.faddedLastInteractionFontColor
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
eText: userUserNameLabelText
eText: CurrentConversation.description
maxWidth: userNameOrIdRect.width
}
}

View file

@ -93,7 +93,8 @@ Rectangle {
JamiTheme.chatviewTextColorDark
onEditingFinished: {
ConversationsAdapter.updateConversationTitle(LRCInstance.selectedConvUid, titleLine.text)
if (text !== CurrentConversation.title)
ConversationsAdapter.updateConversationTitle(LRCInstance.selectedConvUid, text)
}
}
@ -132,7 +133,8 @@ Rectangle {
JamiTheme.chatviewTextColorDark
onEditingFinished: {
ConversationsAdapter.updateConversationDescription(LRCInstance.selectedConvUid, descriptionLine.text)
if (text !== CurrentConversation.description)
ConversationsAdapter.updateConversationDescription(LRCInstance.selectedConvUid, text)
}
}