initial epub support

This commit is contained in:
Agel committed 2026-03-19 23:27:01 +01:00
1 parent 53d6d541a7
commit f328e7dab0
9 files changed
+878 -5

No files matched your search

+69
View File
@@ -49,6 +49,7 @@ Rectangle {
}
Column {
id: navColumn
y: Theme.headerHeight
width: Theme.sidebarWidth
@@ -96,4 +97,72 @@ Rectangle {
onClicked: sidebar.navigateTo("settings")
}
}
// TOC section — shown when the current book has a table of contents
Item {
visible: bookController.hasBook && bookController.toc.length > 0
anchors.top: navColumn.bottom
anchors.bottom: parent.bottom
width: parent.width
Rectangle {
id: tocDivider
width: parent.width
height: 1
color: Theme.divider
}
Text {
id: tocLabel
anchors.top: tocDivider.bottom
anchors.topMargin: 8
anchors.left: parent.left
anchors.leftMargin: 16
text: "Contents"
font.pixelSize: 10
font.bold: true
color: Theme.dimText
font.letterSpacing: 1
}
ListView {
anchors.top: tocLabel.bottom
anchors.topMargin: 4
anchors.bottom: parent.bottom
width: parent.width
clip: true
model: bookController.toc
delegate: Rectangle {
width: ListView.view.width
height: tocEntryText.implicitHeight + 10
color: readingModel.currentChapter === modelData.chapterIndex
? Qt.rgba(1, 1, 1, 0.05)
: "transparent"
Text {
id: tocEntryText
anchors.verticalCenter: parent.verticalCenter
x: 16 + modelData.depth * 12
width: parent.width - x - 8
text: modelData.title
font.pixelSize: 13
color: readingModel.currentChapter === modelData.chapterIndex
? Theme.sidebarButtonText
: Theme.uiText
elide: Text.ElideRight
wrapMode: Text.NoWrap
}
MouseArea {
anchors.fill: parent
onClicked: {
readingModel.goToChapter(modelData.chapterIndex)
sidebar.navigateTo("reader")
sidebar.closeDrawer()
}
}
}
}
}
}