114 lines
3.3 KiB
QML
114 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"
|
|
|
|
globalDrawer: Kirigami.GlobalDrawer {
|
|
actions: [
|
|
Kirigami.Action {
|
|
text: "Quit"
|
|
icon.name: "application-exit-symbolic"
|
|
shortcut: StandardKey.Quit
|
|
onTriggered: Qt.quit()
|
|
}
|
|
]
|
|
isMenu: true
|
|
}
|
|
|
|
pageStack.columnView.columnResizeMode: Kirigami.ColumnView.SingleColumn
|
|
pageStack.initialPage: Kirigami.ScrollablePage {
|
|
title: "Mods"
|
|
|
|
Kirigami.CardsListView {
|
|
id: modsView
|
|
|
|
delegate: ModCardDelegate {}
|
|
model: QModListModel
|
|
|
|
Kirigami.PlaceholderMessage {
|
|
anchors.centerIn: parent
|
|
|
|
visible: modsView.count === 0
|
|
text: "There's no mods installed"
|
|
explanation: "Install a mod, and it will show up here"
|
|
}
|
|
}
|
|
}
|
|
|
|
component ModCardDelegate: Kirigami.AbstractCard {
|
|
required property int index
|
|
required property QMod mod
|
|
|
|
showClickFeedback: true
|
|
onClicked: pageStack.push(Qt.resolvedUrl("ModPage.qml"), {
|
|
mod: mod,
|
|
index: index
|
|
})
|
|
|
|
// 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
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|