1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 14:55:43 +02:00

swarmdetailspanel: add about part

Change-Id: I2af7ff4e785529f37d5e7d532ed0295c6f1055b6
GitLab: #670
This commit is contained in:
Sébastien Blin 2022-02-21 16:05:20 -05:00
parent 3f88ceda93
commit db7977923d
5 changed files with 169 additions and 3 deletions

View file

@ -624,6 +624,13 @@ Item {
property string editTitle: qsTr("Edit title") property string editTitle: qsTr("Edit title")
property string editDescription: qsTr("Edit description") property string editDescription: qsTr("Edit description")
property string ignoreTheSwarm: qsTr("Ignore the swarm")
property string ignoreTheSwarmTooltip: qsTr("Ignore all notifications from this conversation")
property string chooseAColor: qsTr("Choose a color")
property string leaveTheSwarm: qsTr("Leave the swarm")
property string leave: qsTr("Leave")
property string typeOfSwarm: qsTr("Type of swarm")
// NewSwarmPage // NewSwarmPage
property string youCanAdd8: qsTr("You can add 8 people in the swarm") property string youCanAdd8: qsTr("You can add 8 people in the swarm")
property string youCanAddMore: qsTr("You can add %1 more people in the swarm") property string youCanAddMore: qsTr("You can add %1 more people in the swarm")

View file

@ -372,6 +372,7 @@ Item {
// Details page // Details page
property real detailsPageMinWidth: 300 property real detailsPageMinWidth: 300
property int aboutBtnSize: 24
// Messages point size // Messages point size
property real contactEventPointSize: 10 + fontSizeOffset property real contactEventPointSize: 10 + fontSizeOffset

View file

@ -89,6 +89,17 @@ CurrentConversation::updateData()
qInfo() << "Contact not found: " << e.what(); qInfo() << "Contact not found: " << e.what();
} }
set_isContact(isContact); set_isContact(isContact);
QString modeString;
if (convInfo.mode == conversation::Mode::ONE_TO_ONE) {
set_modeString(tr("Private"));
} else if (convInfo.mode == conversation::Mode::ADMIN_INVITES_ONLY) {
set_modeString(tr("Private group (restricted invites)"));
} else if (convInfo.mode == conversation::Mode::INVITES_ONLY) {
set_modeString(tr("Private group"));
} else if (convInfo.mode == conversation::Mode::PUBLIC) {
set_modeString(tr("Public group"));
}
} }
} catch (...) { } catch (...) {
qWarning() << "Can't update current conversation data for" << convId; qWarning() << "Can't update current conversation data for" << convId;

View file

@ -47,6 +47,7 @@ class CurrentConversation final : public QObject
QML_PROPERTY(bool, isTemporary) QML_PROPERTY(bool, isTemporary)
QML_PROPERTY(bool, isContact) QML_PROPERTY(bool, isContact)
QML_PROPERTY(bool, allMessagesLoaded) QML_PROPERTY(bool, allMessagesLoaded)
QML_PROPERTY(QString, modeString)
public: public:
explicit CurrentConversation(LRCInstance* lrcInstance, QObject* parent = nullptr); explicit CurrentConversation(LRCInstance* lrcInstance, QObject* parent = nullptr);

View file

@ -19,12 +19,14 @@
import QtQuick import QtQuick
import QtQuick.Controls import QtQuick.Controls
import QtQuick.Layouts import QtQuick.Layouts
import Qt.labs.platform
import net.jami.Models 1.1 import net.jami.Models 1.1
import net.jami.Adapters 1.1 import net.jami.Adapters 1.1
import net.jami.Constants 1.1 import net.jami.Constants 1.1
import "../../commoncomponents" import "../../commoncomponents"
import "../../settingsview/components"
Rectangle { Rectangle {
id: root id: root
@ -108,11 +110,13 @@ Rectangle {
TabBar { TabBar {
id: tabBar id: tabBar
currentIndex: 1
Layout.topMargin: JamiTheme.preferredMarginSize Layout.topMargin: JamiTheme.preferredMarginSize
Layout.preferredWidth: root.width Layout.preferredWidth: root.width
Layout.preferredHeight: membersTabButton.height Layout.preferredHeight: membersTabButton.height
/*FilterTabButton { FilterTabButton {
id: aboutTabButton id: aboutTabButton
backgroundColor: CurrentConversation.color backgroundColor: CurrentConversation.color
hoverColor: CurrentConversation.color hoverColor: CurrentConversation.color
@ -128,7 +132,7 @@ Rectangle {
down: tabBar.currentIndex === 0 down: tabBar.currentIndex === 0
labelText: JamiStrings.about labelText: JamiStrings.about
}*/ }
FilterTabButton { FilterTabButton {
id: membersTabButton id: membersTabButton
@ -144,7 +148,7 @@ Rectangle {
JamiTheme.chatviewTextColorLight : JamiTheme.chatviewTextColorLight :
JamiTheme.chatviewTextColorDark JamiTheme.chatviewTextColorDark
down: true//tabBar.currentIndex === 1 down: tabBar.currentIndex === 1
labelText: { labelText: {
var membersNb = CurrentConversation.uris.length; var membersNb = CurrentConversation.uris.length;
if (membersNb > 1) if (membersNb > 1)
@ -173,17 +177,159 @@ Rectangle {
} }
} }
ColorDialog {
id: colorDialog
title: JamiTheme.chooseAColor
onAccepted: {
console.warn("TODO SAVE preference")
CurrentConversation.color = colorDialog.color
}
}
Rectangle { Rectangle {
id: details id: details
Layout.fillWidth: true Layout.fillWidth: true
Layout.preferredHeight: root.height - header.height Layout.preferredHeight: root.height - header.height
color: JamiTheme.secondaryBackgroundColor color: JamiTheme.secondaryBackgroundColor
ColumnLayout {
id: aboutSwarm
anchors.left: parent.left
anchors.right: parent.right
anchors.rightMargin: JamiTheme.settingsMarginSize
spacing: JamiTheme.preferredMarginSize
visible: tabBar.currentIndex === 0
Layout.alignment: Qt.AlignTop
ToggleSwitch {
id: ignoreSwarm
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.topMargin: JamiTheme.preferredMarginSize
checked: false // TODO
labelText: JamiStrings.ignoreTheSwarm
fontPointSize: JamiTheme.settingsFontSize
tooltipText: JamiStrings.ignoreTheSwarmTooltip
onSwitchToggled: {
// TODO
}
}
RowLayout {
Layout.leftMargin: JamiTheme.preferredMarginSize
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.rightMargin: JamiTheme.preferredMarginSize
text: JamiStrings.leaveTheSwarm
font.pointSize: JamiTheme.settingsFontSize
font.kerning: true
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: JamiTheme.textColor
}
PushButton {
id: leaveTheSwarmBtn
anchors.verticalCenter: parent.verticalCenter
source: JamiResources.round_close_24dp_svg
normalColor: JamiTheme.backgroundColor
imageColor: JamiTheme.textColor
toolTipText: JamiStrings.leave
onClicked: {
MessagesAdapter.removeConversation(LRCInstance.selectedConvUid)
}
}
}
RowLayout {
Layout.leftMargin: JamiTheme.preferredMarginSize
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.rightMargin: JamiTheme.preferredMarginSize
text: JamiStrings.chooseAColor
font.pointSize: JamiTheme.settingsFontSize
font.kerning: true
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: JamiTheme.textColor
}
Rectangle {
id: chooseAColorBtn
Layout.alignment: Qt.AlignRight
width: JamiTheme.aboutBtnSize
height: JamiTheme.aboutBtnSize
radius: JamiTheme.aboutBtnSize / 2
color: CurrentConversation.color
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
onClicked: colorDialog.open()
}
}
}
RowLayout {
Layout.leftMargin: JamiTheme.preferredMarginSize
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.rightMargin: JamiTheme.preferredMarginSize
text: JamiStrings.typeOfSwarm
font.pointSize: JamiTheme.settingsFontSize
font.kerning: true
elide: Text.ElideRight
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
color: JamiTheme.textColor
}
Label {
id: typeOfSwarmLabel
Layout.alignment: Qt.AlignRight
color: JamiTheme.buttonTintedBlack
text: CurrentConversation.modeString
}
}
}
JamiListView { JamiListView {
id: members id: members
anchors.fill: parent anchors.fill: parent
anchors.topMargin: JamiTheme.preferredMarginSize anchors.topMargin: JamiTheme.preferredMarginSize
visible: tabBar.currentIndex === 1
SwarmParticipantContextMenu { SwarmParticipantContextMenu {
id: contextMenu id: contextMenu
role: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri) role: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri)