2024-11-09 15:05:14 +08:00
|
|
|
import QtQuick
|
|
|
|
import QtQuick.Controls
|
|
|
|
import QtQuick.Layouts
|
2024-11-10 17:10:45 +08:00
|
|
|
import net.blumia.pineapple.comic.reader
|
2024-11-09 15:05:14 +08:00
|
|
|
|
2024-11-10 17:10:45 +08:00
|
|
|
Item {
|
2024-11-09 15:05:14 +08:00
|
|
|
anchors.fill: parent
|
2024-11-10 17:10:45 +08:00
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2024-11-09 15:05:14 +08:00
|
|
|
}
|
2024-11-10 17:10:45 +08:00
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
anchors.fill: parent
|
|
|
|
RowLayout {
|
|
|
|
ToolButton {
|
|
|
|
flat: true
|
|
|
|
icon.name: "folder-open"
|
|
|
|
onClicked: function() {
|
|
|
|
drawer.open();
|
2024-11-09 15:05:14 +08:00
|
|
|
}
|
|
|
|
}
|
2024-11-10 17:10:45 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
2024-11-09 15:05:14 +08:00
|
|
|
|
2024-11-10 17:10:45 +08:00
|
|
|
onClicked: function() {
|
|
|
|
AppController.selectedComicId = model.comicId
|
|
|
|
}
|
2024-11-09 15:05:14 +08:00
|
|
|
}
|
2024-11-10 17:10:45 +08:00
|
|
|
ScrollBar.vertical: ScrollBar { }
|
2024-11-09 15:05:14 +08:00
|
|
|
}
|
|
|
|
|
2024-11-10 17:10:45 +08:00
|
|
|
Component.onCompleted: function() {
|
|
|
|
AppController.updateComicsInFolder()
|
|
|
|
}
|
2024-11-09 15:05:14 +08:00
|
|
|
}
|
|
|
|
}
|