91 lines
2.6 KiB
QML
91 lines
2.6 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import QtQuick.Controls as Controls
|
|
import org.kde.kirigami as Kirigami
|
|
import Leek
|
|
|
|
Kirigami.Page {
|
|
id: root
|
|
required property QMod mod
|
|
|
|
title: "Local mod"
|
|
|
|
ColumnLayout {
|
|
anchors {
|
|
top: parent.top
|
|
left: parent.left
|
|
right: parent.right
|
|
}
|
|
|
|
Rectangle {
|
|
id: header
|
|
Layout.fillWidth: true
|
|
|
|
Layout.topMargin: -root.topPadding
|
|
Layout.leftMargin: -root.leftPadding
|
|
Layout.rightMargin: -root.rightPadding
|
|
|
|
Kirigami.ImageColors {
|
|
id: iconColors
|
|
source: modIcon.source
|
|
}
|
|
|
|
implicitHeight: headerContents.implicitHeight + (headerContents.anchors.topMargin * 2)
|
|
|
|
// Tint the header with the dominant color of the mod's icon
|
|
color: Kirigami.ColorUtils.tintWithAlpha(
|
|
Kirigami.Theme.backgroundColor,
|
|
iconColors.dominant,
|
|
0.1
|
|
)
|
|
|
|
GridLayout {
|
|
id: headerContents
|
|
anchors {
|
|
top: parent.top
|
|
left: parent.left
|
|
right: parent.right
|
|
topMargin: root.padding
|
|
bottomMargin: root.padding
|
|
leftMargin: root.padding
|
|
rightMargin: root.padding
|
|
}
|
|
|
|
RowLayout {
|
|
// Icon
|
|
Kirigami.Icon {
|
|
id: modIcon
|
|
implicitHeight: Kirigami.Units.iconSizes.huge
|
|
implicitWidth: implicitHeight
|
|
source: "package-x-generic"
|
|
}
|
|
|
|
// Name and author
|
|
ColumnLayout {
|
|
Kirigami.Heading {
|
|
text: mod.name
|
|
type: Kirigami.Heading.Type.Primary
|
|
}
|
|
Controls.Label {
|
|
property bool hasAuthors: mod.authors.length > 0
|
|
function joinAuthors() {
|
|
return mod.authors.join(", ")
|
|
}
|
|
|
|
text: hasAuthors ? joinAuthors() : "Unknown author"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Kirigami.Separator {
|
|
width: header.width
|
|
anchors.top: header.bottom
|
|
}
|
|
}
|
|
}
|
|
Controls.Label {
|
|
anchors.centerIn: parent
|
|
text: `Hello from ${mod.name}`
|
|
}
|
|
}
|