From 4db69424b830b73ae18e6bc668967e3c6b4573ef Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 8 Jul 2020 11:36:57 -0400 Subject: [PATCH] Put MemberDeviceSection in its own component --- .../MemberView/MemberDeviceSection.qml | 37 +++++++++++++++++++ .../RoomPane/MemberView/MemberProfile.qml | 31 +--------------- 2 files changed, 38 insertions(+), 30 deletions(-) create mode 100644 src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceSection.qml diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceSection.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceSection.qml new file mode 100644 index 00000000..0a425376 --- /dev/null +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberDeviceSection.qml @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: LGPL-3.0-or-later + +import QtQuick 2.12 +import QtQuick.Layouts 1.12 +import "../../../../Base" + +HRowLayout { + spacing: theme.spacing / 2 + + HIcon { + svgName: "device-" + section + colorize: + section === "verified" ? theme.colors.positiveText : + section === "blacklisted" ? theme.colors.errorText : + theme.colors.warningText + + Layout.preferredHeight: dimension + Layout.leftMargin: theme.spacing / 2 + } + + HLabel { + wrapMode: HLabel.Wrap + verticalAlignment: Qt.AlignVCenter + + text: + section === "unset" ? qsTr("Unverified sessions") : + section === "verified" ? qsTr("Verified sessions") : + section === "ignored" ? qsTr("Ignored sessions") : + qsTr("Blacklisted sessions") + + Layout.fillWidth: true + Layout.fillHeight: true + Layout.topMargin: theme.spacing + Layout.bottomMargin: theme.spacing + Layout.rightMargin: theme.spacing / 2 + } +} diff --git a/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml b/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml index 79116f68..c9ae034a 100644 --- a/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml +++ b/src/gui/Pages/Chat/RoomPane/MemberView/MemberProfile.qml @@ -37,37 +37,8 @@ HListView { } section.property: "type" - section.delegate: RowLayout { + section.delegate: MemberDeviceSection { width: profile.width - spacing: theme.spacing / 2 - - HIcon { - svgName: "device-" + section - colorize: - section === "verified" ? theme.colors.positiveText : - section === "blacklisted" ? theme.colors.errorText : - theme.colors.warningText - - Layout.preferredHeight: dimension - Layout.leftMargin: theme.spacing / 2 - } - - HLabel { - wrapMode: HLabel.Wrap - verticalAlignment: Qt.AlignVCenter - - text: - section === "unset" ? qsTr("Unverified sessions") : - section === "verified" ? qsTr("Verified sessions") : - section === "ignored" ? qsTr("Ignored sessions") : - qsTr("Blacklisted sessions") - - Layout.fillWidth: true - Layout.fillHeight: true - Layout.topMargin: theme.spacing - Layout.bottomMargin: theme.spacing - Layout.rightMargin: theme.spacing / 2 - } } header: HColumnLayout {