updates popout
This commit is contained in:
@@ -8,123 +8,146 @@ import qs.Components
|
|||||||
import qs.Modules
|
import qs.Modules
|
||||||
import qs.Helpers
|
import qs.Helpers
|
||||||
|
|
||||||
Item {
|
CustomClippingRect {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
readonly property int itemHeight: 50 + Appearance.padding.smaller * 2
|
||||||
required property var wrapper
|
required property var wrapper
|
||||||
|
|
||||||
implicitHeight: profiles.implicitHeight + Appearance.padding.small
|
color: DynamicColors.tPalette.m3surfaceContainer
|
||||||
implicitWidth: profiles.implicitWidth + Appearance.padding.small * 2
|
implicitHeight: updatesList.visible ? updatesList.implicitHeight + Appearance.padding.small * 2 : noUpdates.height
|
||||||
|
implicitWidth: updatesList.visible ? updatesList.contentWidth + Appearance.padding.small * 2 : noUpdates.width
|
||||||
|
radius: Appearance.rounding.small
|
||||||
|
|
||||||
CustomRect {
|
Item {
|
||||||
id: profiles
|
id: noUpdates
|
||||||
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.centerIn: parent
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
height: 200
|
||||||
implicitHeight: updatesList.contentHeight + Appearance.padding.small * 2
|
visible: script.values.length === 0
|
||||||
implicitWidth: updatesList.contentWidth + Appearance.padding.small * 2
|
width: 300
|
||||||
radius: Appearance.rounding.small
|
|
||||||
|
|
||||||
CustomListView {
|
MaterialIcon {
|
||||||
id: updatesList
|
id: noUpdatesIcon
|
||||||
|
|
||||||
anchors.centerIn: parent
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
contentHeight: childrenRect.height
|
anchors.top: parent.top
|
||||||
contentWidth: 600
|
color: DynamicColors.tPalette.m3onSurfaceVariant
|
||||||
implicitHeight: contentHeight
|
font.pointSize: Appearance.font.size.extraLarge * 3
|
||||||
implicitWidth: contentWidth
|
horizontalAlignment: Text.AlignHCenter
|
||||||
spacing: Appearance.spacing.normal
|
text: "check"
|
||||||
|
}
|
||||||
|
|
||||||
delegate: CustomRect {
|
CustomText {
|
||||||
id: update
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
anchors.top: noUpdatesIcon.bottom
|
||||||
|
color: DynamicColors.tPalette.m3onSurfaceVariant
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: qsTr("No updates available")
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
required property var modelData
|
CustomListView {
|
||||||
readonly property list<string> sections: modelData.update.split(" ")
|
id: updatesList
|
||||||
|
|
||||||
anchors.left: parent.left
|
anchors.centerIn: parent
|
||||||
anchors.right: parent.right
|
contentHeight: childrenRect.height
|
||||||
color: DynamicColors.tPalette.m3surfaceContainer
|
contentWidth: 600
|
||||||
implicitHeight: 50 + Appearance.padding.smaller * 2
|
implicitHeight: Math.min(contentHeight, (root.itemHeight + spacing) * 5 - spacing)
|
||||||
radius: Appearance.rounding.small - Appearance.padding.small
|
implicitWidth: contentWidth
|
||||||
|
spacing: Appearance.spacing.normal
|
||||||
|
visible: script.values.length > 0
|
||||||
|
|
||||||
|
delegate: CustomRect {
|
||||||
|
id: update
|
||||||
|
|
||||||
|
required property var modelData
|
||||||
|
readonly property list<string> sections: modelData.update.split(" ")
|
||||||
|
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.right: parent.right
|
||||||
|
color: DynamicColors.tPalette.m3surfaceContainer
|
||||||
|
implicitHeight: root.itemHeight
|
||||||
|
radius: Appearance.rounding.small - Appearance.padding.small
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.leftMargin: Appearance.padding.smaller
|
||||||
|
anchors.rightMargin: Appearance.padding.smaller
|
||||||
|
|
||||||
|
MaterialIcon {
|
||||||
|
font.pointSize: Appearance.font.size.large * 2
|
||||||
|
text: "package_2"
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 25
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
text: update.sections[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
CustomText {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
color: DynamicColors.palette.m3onSurfaceVariant
|
||||||
|
text: Updates.formatUpdateTime(update.modelData.timestamp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RowLayout {
|
RowLayout {
|
||||||
anchors.fill: parent
|
Layout.fillHeight: true
|
||||||
anchors.leftMargin: Appearance.padding.smaller
|
Layout.preferredWidth: 300
|
||||||
anchors.rightMargin: Appearance.padding.smaller
|
|
||||||
|
CustomText {
|
||||||
|
id: versionFrom
|
||||||
|
|
||||||
|
Layout.fillHeight: true
|
||||||
|
Layout.preferredWidth: 125
|
||||||
|
color: DynamicColors.palette.m3tertiary
|
||||||
|
elide: Text.ElideRight
|
||||||
|
font.pointSize: Appearance.font.size.large
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: update.sections[1]
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
font.pointSize: Appearance.font.size.large * 2
|
|
||||||
text: "package_2"
|
|
||||||
}
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.preferredHeight: 25
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.pointSize: Appearance.font.size.large
|
|
||||||
text: update.sections[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
color: DynamicColors.palette.m3onSurfaceVariant
|
|
||||||
text: Updates.formatUpdateTime(update.modelData.timestamp)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: 300
|
color: DynamicColors.palette.m3secondary
|
||||||
|
font.pointSize: Appearance.font.size.extraLarge
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: "arrow_right_alt"
|
||||||
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
}
|
||||||
|
|
||||||
CustomText {
|
CustomText {
|
||||||
id: versionFrom
|
id: versionTo
|
||||||
|
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.preferredWidth: 125
|
Layout.preferredWidth: 120
|
||||||
color: DynamicColors.palette.m3tertiary
|
color: DynamicColors.palette.m3primary
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
font.pointSize: Appearance.font.size.large
|
font.pointSize: Appearance.font.size.large
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
text: update.sections[1]
|
text: update.sections[3]
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
|
||||||
|
|
||||||
MaterialIcon {
|
|
||||||
Layout.fillHeight: true
|
|
||||||
color: DynamicColors.palette.m3secondary
|
|
||||||
font.pointSize: Appearance.font.size.extraLarge
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
text: "arrow_right_alt"
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomText {
|
|
||||||
id: versionTo
|
|
||||||
|
|
||||||
Layout.fillHeight: true
|
|
||||||
Layout.preferredWidth: 120
|
|
||||||
color: DynamicColors.palette.m3primary
|
|
||||||
elide: Text.ElideRight
|
|
||||||
font.pointSize: Appearance.font.size.large
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
text: update.sections[3]
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model: ScriptModel {
|
}
|
||||||
id: script
|
model: ScriptModel {
|
||||||
|
id: script
|
||||||
|
|
||||||
objectProp: "update"
|
objectProp: "update"
|
||||||
values: Object.entries(Updates.updates).sort((a, b) => b[1] - a[1]).map(([update, timestamp]) => ({
|
values: Object.entries(Updates.updates).sort((a, b) => b[1] - a[1]).map(([update, timestamp]) => ({
|
||||||
update,
|
update,
|
||||||
timestamp
|
timestamp
|
||||||
}))
|
}))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user