feat(browser): support display subfolders

This commit is contained in:
2024-11-10 17:10:45 +08:00
parent 15cef03f08
commit 1f7adc2a3a
11 changed files with 150 additions and 47 deletions

View File

@@ -1,42 +1,76 @@
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import net.blumia.pineapple.comic.reader
ColumnLayout {
Item {
anchors.fill: parent
Label {
text: "Comics"
font.pixelSize: 20
}
GridView {
id: gridView
clip: true
cellHeight: cellWidth * 3 / 2
cellWidth: width / Math.max(Math.floor(width / (65 * 2)), 1)
Layout.fillWidth: true
Layout.fillHeight: true
model: AppController.comicsModel
delegate: Button {
width: GridView.view.cellWidth
height: GridView.view.cellHeight
Column {
Image {
source: AppController.coverImageSource(model.hash)
width: gridView.cellWidth
height: gridView.cellHeight
fillMode: Image.PreserveAspectFit
retainWhileLoading: true
Drawer {
id: drawer
width: Math.min(0.66 * parent.width, 320)
height: parent.height
ListView {
id: listView
clip: true
anchors.fill: parent
model: AppController.foldersModel
delegate: ItemDelegate {
text: model.display
width: listView.width
onClicked: function() {
AppController.updateComicsInFolder(model.folderId)
}
}
}
}
onClicked: function() {
AppController.selectedComicId = model.comicId
ColumnLayout {
anchors.fill: parent
RowLayout {
ToolButton {
flat: true
icon.name: "folder-open"
onClicked: function() {
drawer.open();
}
}
Label {
text: "Comics"
font.pixelSize: 20
}
}
ScrollBar.vertical: ScrollBar { }
}
GridView {
id: gridView
clip: true
cellHeight: cellWidth * 3 / 2
cellWidth: width / Math.max(Math.floor(width / (65 * 2)), 1)
Layout.fillWidth: true
Layout.fillHeight: true
model: AppController.comicsModel
delegate: Button {
width: GridView.view.cellWidth
height: GridView.view.cellHeight
Column {
Image {
source: AppController.coverImageSource(model.hash)
width: gridView.cellWidth
height: gridView.cellHeight
fillMode: Image.PreserveAspectFit
retainWhileLoading: true
}
}
Component.onCompleted: function() {
AppController.updateComicsInFolder()
onClicked: function() {
AppController.selectedComicId = model.comicId
}
}
ScrollBar.vertical: ScrollBar { }
}
Component.onCompleted: function() {
AppController.updateComicsInFolder()
}
}
}