48 lines
1.3 KiB
QML
48 lines
1.3 KiB
QML
// Every theme for one scheme, shipped and saved together.
|
|
//
|
|
// Saved themes are not a second-class list below the shipped ones: a theme you
|
|
// made is a theme, and once it is in the gallery it is chosen the same way. The
|
|
// grid drops to two columns on a narrowly tiled window, because a third card at
|
|
// 900px is narrower than its own caption.
|
|
|
|
import QtQuick
|
|
import qs.services
|
|
|
|
Column {
|
|
id: root
|
|
|
|
required property string scheme
|
|
property string heading: ""
|
|
|
|
width: parent ? parent.width : 620
|
|
spacing: 10
|
|
|
|
readonly property var themes: ThemeProfiles.profiles.filter(
|
|
profile => profile.scheme === root.scheme)
|
|
|
|
readonly property int columns: root.width < 640 ? 2 : 3
|
|
readonly property real cellWidth: root.columns > 0
|
|
? (root.width - (root.columns - 1) * 12) / root.columns : 200
|
|
|
|
SectionLabel { text: root.heading }
|
|
|
|
Grid {
|
|
width: parent.width
|
|
columns: root.columns
|
|
spacing: 12
|
|
|
|
Repeater {
|
|
model: root.themes
|
|
|
|
ThemeCard {
|
|
required property var modelData
|
|
|
|
width: root.cellWidth
|
|
theme: modelData
|
|
onChosen: ThemeProfiles.selectProfile(modelData.id)
|
|
onRemoved: ThemeProfiles.deleteProfile(modelData.id)
|
|
}
|
|
}
|
|
}
|
|
}
|