Commit 8fb2dc68 authored by Nate Graham's avatar Nate Graham
Browse files

Center screenshots even when there's more than one

A lot of KNS resources have 2-3 tall and skinny screenshots, and this
looks better for them. There is no visual change for resources with
enough screenshots to make the screenshots view scrollable.
parent 14c9ef14
Pipeline #133918 passed with stage
in 1 minute and 1 second
......@@ -198,8 +198,9 @@ DiscoverPage {
// Screenshots
ScrollView {
id: screenshotsScroll
visible: screenshots.count > 0
Layout.fillWidth: screenshots.count > 1 ? true : false
Layout.maximumWidth: headerLayout.width
Layout.alignment: Qt.AlignHCenter
Layout.preferredHeight: Math.min(Kirigami.Units.gridUnit * 20, Window.height * 0.25)
......@@ -209,6 +210,7 @@ DiscoverPage {
id: screenshots
resource: appInfo.application
delegateHeight: parent.Layout.preferredHeight * 0.8
showNavigationArrows: screenshotsScroll.width === headerLayout.width
}
}
......
......@@ -15,6 +15,7 @@ import org.kde.kirigami 2.19 as Kirigami
ListView {
id: root
readonly property alias count: screenshotsModel.count
property bool showNavigationArrows: true
property alias resource: screenshotsModel.application
property var resource
......@@ -148,7 +149,10 @@ ListView {
width: Kirigami.Units.gridUnit * 2
height: width
icon.name: root.LayoutMirroring.enabled ? "arrow-right" : "arrow-left"
visible: !Kirigami.Settings.isMobile && root.count > 1 && root.currentIndex > 0
visible: !Kirigami.Settings.isMobile
&& root.count > 1
&& root.currentIndex > 0
&& root.showNavigationArrows
Keys.forwardTo: [root]
onClicked: root.currentIndex -= 1
}
......@@ -162,7 +166,10 @@ ListView {
width: Kirigami.Units.gridUnit * 2
height: width
icon.name: root.LayoutMirroring.enabled ? "arrow-left" : "arrow-right"
visible: !Kirigami.Settings.isMobile && root.count > 1 && root.currentIndex < root.count - 1
visible: !Kirigami.Settings.isMobile
&& root.count > 1
&& root.currentIndex < root.count - 1
&& root.showNavigationArrows
Keys.forwardTo: [root]
onClicked: root.currentIndex += 1
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment