Commit db797792 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

swarmdetailspanel: add about part

Change-Id: I2af7ff4e785529f37d5e7d532ed0295c6f1055b6
GitLab: #670
parent 3f88ceda
......@@ -624,6 +624,13 @@ Item {
property string editTitle: qsTr("Edit title")
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
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")
......
......@@ -372,6 +372,7 @@ Item {
// Details page
property real detailsPageMinWidth: 300
property int aboutBtnSize: 24
// Messages point size
property real contactEventPointSize: 10 + fontSizeOffset
......
......@@ -89,6 +89,17 @@ CurrentConversation::updateData()
qInfo() << "Contact not found: " << e.what();
}
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 (...) {
qWarning() << "Can't update current conversation data for" << convId;
......
......@@ -47,6 +47,7 @@ class CurrentConversation final : public QObject
QML_PROPERTY(bool, isTemporary)
QML_PROPERTY(bool, isContact)
QML_PROPERTY(bool, allMessagesLoaded)
QML_PROPERTY(QString, modeString)
public:
explicit CurrentConversation(LRCInstance* lrcInstance, QObject* parent = nullptr);
......
......@@ -19,12 +19,14 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt.labs.platform
import net.jami.Models 1.1
import net.jami.Adapters 1.1
import net.jami.Constants 1.1
import "../../commoncomponents"
import "../../settingsview/components"
Rectangle {
id: root
......@@ -108,11 +110,13 @@ Rectangle {
TabBar {
id: tabBar
currentIndex: 1
Layout.topMargin: JamiTheme.preferredMarginSize
Layout.preferredWidth: root.width
Layout.preferredHeight: membersTabButton.height
/*FilterTabButton {
FilterTabButton {
id: aboutTabButton
backgroundColor: CurrentConversation.color
hoverColor: CurrentConversation.color
......@@ -128,7 +132,7 @@ Rectangle {
down: tabBar.currentIndex === 0
labelText: JamiStrings.about
}*/
}
FilterTabButton {
id: membersTabButton
......@@ -144,7 +148,7 @@ Rectangle {
JamiTheme.chatviewTextColorLight :
JamiTheme.chatviewTextColorDark
down: true//tabBar.currentIndex === 1
down: tabBar.currentIndex === 1
labelText: {
var membersNb = CurrentConversation.uris.length;
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 {
id: details
Layout.fillWidth: true
Layout.preferredHeight: root.height - header.height
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 {
id: members
anchors.fill: parent
anchors.topMargin: JamiTheme.preferredMarginSize
visible: tabBar.currentIndex === 1
SwarmParticipantContextMenu {
id: contextMenu
role: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment