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(); 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 void
CurrentConversation::connectModel() CurrentConversation::connectModel()
{ {
@ -128,4 +138,9 @@ CurrentConversation::connectModel()
this, this,
&CurrentConversation::onConversationUpdated, &CurrentConversation::onConversationUpdated,
Qt::UniqueConnection); Qt::UniqueConnection);
connect(lrcInstance_->getCurrentConversationModel(),
&ConversationModel::profileUpdated,
this,
&CurrentConversation::onProfileUpdated,
Qt::UniqueConnection);
} }

View file

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

View file

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

View file

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

View file

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

View file

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