Put MemberDeviceSection in its own component

This commit is contained in:
miruka 2020-07-08 11:36:57 -04:00
parent 9b43bef935
commit 4db69424b8
2 changed files with 38 additions and 30 deletions

View File

@ -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
}
}

View File

@ -37,37 +37,8 @@ HListView {
} }
section.property: "type" section.property: "type"
section.delegate: RowLayout { section.delegate: MemberDeviceSection {
width: profile.width 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 { header: HColumnLayout {