Skip to content

Commit

Permalink
feat(qml): add pagination information to gallery screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Apr 25, 2024
1 parent a164b1e commit 850fc82
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 8 deletions.
20 changes: 16 additions & 4 deletions src/gui-qml/src/components/GalleryScreen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ Page {
GallerySearchLoader {
id: galleryLoader

profile: backend.profile
site: root.site.url
gallery: root.gallery.image
page: root.page
perPage: 20
profile: backend.profile

onGalleryChanged: galleryLoader.load()
onResultsChanged: {
Expand Down Expand Up @@ -113,7 +113,7 @@ Page {
width: 40
icon.source: "/images/icons/previous.png"
visible: !infiniteScroll
enabled: query !== "" && page > 1
enabled: galleryLoader.hasPrev
Layout.fillHeight: true
Material.elevation: 0
Material.roundedScale: Material.NotRounded
Expand All @@ -124,8 +124,20 @@ Page {
}
}

Item {
Label {
text: galleryLoader.status == TagSearchLoader.Ready
? (results
? qsTr("Page %1 of %2\n(%3 of %4)").arg(page).arg(galleryLoader.pageCount).arg(results.length).arg(galleryLoader.imageCount)
: qsTr("No result"))
: ''
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
Layout.fillHeight: true

background: Rectangle {
color: nextButton.background.color
}
}

Button {
Expand All @@ -134,7 +146,7 @@ Page {
width: 40
icon.source: "/images/icons/next.png"
visible: !infiniteScroll
enabled: query !== ""
enabled: galleryLoader.hasNext
Layout.fillHeight: true
Material.elevation: 0
Material.roundedScale: Material.NotRounded
Expand Down
9 changes: 5 additions & 4 deletions src/gui-qml/src/main-screen.qml
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,13 @@ ApplicationWindow {
}
}

GalleryScreen {
Component {
id: galleryScreen
visible: false
site: activeSite

onBack: mainStackView.pop()
GalleryScreen {
site: activeSite
onBack: mainStackView.pop()
}
}

SourcesScreen {
Expand Down

0 comments on commit 850fc82

Please sign in to comment.