Main: refactor, wire switch to modEnabled property

This commit is contained in:
Toast 2025-05-23 02:03:11 +02:00
parent 454c761a9d
commit 868eebad2a

View file

@ -13,56 +13,56 @@ Kirigami.ApplicationWindow {
Kirigami.CardsListView {
id: modsView
model: QModListModel {}
delegate: modCardDelegate
delegate: ModCardDelegate {}
}
}
Component {
id: modCardDelegate
Kirigami.AbstractCard {
// headerOrientation: Qt.Horizontal
contentItem: Item {
implicitWidth: modCardLayout.implicitWidth
implicitHeight: modCardLayout.implicitHeight
GridLayout {
id: modCardLayout
anchors {
left: parent.left
top: parent.top
right: parent.right
}
rowSpacing: Kirigami.Units.largeSpacing
columnSpacing: Kirigami.Units.largeSpacing
columns: root.wideScreen ? 4 : 2
component ModCardDelegate: Kirigami.AbstractCard {
required property string name
required property string description
required property bool modEnabled
// headerOrientation: Qt.Horizontal
contentItem: Item {
implicitWidth: modCardLayout.implicitWidth
implicitHeight: modCardLayout.implicitHeight
GridLayout {
id: modCardLayout
anchors {
left: parent.left
top: parent.top
right: parent.right
}
rowSpacing: Kirigami.Units.largeSpacing
columnSpacing: Kirigami.Units.largeSpacing
columns: root.wideScreen ? 4 : 2
// TODO: Replace this with an image once we can get them
Controls.BusyIndicator {
running: true
}
// TODO: Replace this with an image once we can get them
Controls.BusyIndicator {
running: true
}
ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
text: name
type: Kirigami.Heading.Type.Primary
}
Kirigami.Separator {
Layout.fillWidth: true
}
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: description ? description : "No description available"
}
ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
text: name
type: Kirigami.Heading.Type.Primary
}
ColumnLayout {
Layout.alignment: Qt.AlignRight
Controls.Switch {
text: "Enabled"
checked: true
}
Controls.Button {
text: "Delete"
}
Kirigami.Separator {
Layout.fillWidth: true
}
Controls.Label {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: description ? description : "No description available"
}
}
ColumnLayout {
Layout.alignment: Qt.AlignRight
Controls.Switch {
text: "Enabled"
checked: modEnabled
}
Controls.Button {
text: "Delete"
}
}
}