Leek/src/leek/qml/Main.qml

104 lines
3.3 KiB
QML

import QtQuick
import QtQuick.Layouts
import QtQuick.Controls as Controls
import org.kde.kirigami as Kirigami
import Leek
Kirigami.ApplicationWindow {
id: root
title: "Leek"
pageStack.initialPage: Kirigami.ScrollablePage {
title: "Mods"
Kirigami.CardsListView {
id: modsView
delegate: ModCardDelegate {
}
model: QModListModel {
}
}
}
component ModCardDelegate: Kirigami.AbstractCard {
required property QMod mod
showClickFeedback: true
onClicked: pageStack.pushDialogLayer(Qt.resolvedUrl("ModPage.qml"), {mod: mod})
// headerOrientation: Qt.Horizontal
contentItem: Item {
implicitHeight: modCardLayout.implicitHeight
implicitWidth: modCardLayout.implicitWidth
GridLayout {
id: modCardLayout
columnSpacing: Kirigami.Units.largeSpacing
columns: root.wideScreen ? 4 : 2
rowSpacing: Kirigami.Units.largeSpacing
anchors {
left: parent.left
right: parent.right
top: parent.top
}
// TODO: Replace this with an image once we can get them
Kirigami.Padding {
padding: Kirigami.Units.largeSpacing
contentItem: Kirigami.Icon {
implicitHeight: Kirigami.Units.iconSizes.huge
implicitWidth: implicitHeight
source: "package-x-generic"
}
}
ColumnLayout {
Kirigami.Heading {
Layout.fillWidth: true
text: mod.name
type: Kirigami.Heading.Type.Primary
}
Kirigami.Separator {
Layout.fillWidth: true
}
Controls.Label {
property string desc: mod.description
Layout.fillWidth: true
font.italic: desc ? false : true
text: desc ? desc : "No description available"
wrapMode: Text.WordWrap
}
}
ColumnLayout {
Layout.alignment: Qt.AlignRight
Controls.Switch {
checked: mod.enabled
Layout.alignment: Qt.AlignCenter
onClicked: mod.enabled = checked
}
Controls.Button {
text: "Delete"
onClicked: notImplementedDialog.open()
Kirigami.Dialog {
id: notImplementedDialog
title: "Not implemented!"
standardButtons: Kirigami.Dialog.Ok
padding: Kirigami.Units.largeSpacing
Controls.Label {
text: "Deleting is not implemented yet"
}
}
}
}
}
}
}
}