Added more settings
This commit is contained in:
6 files changed
+268
-74
No files matched your search
@@ -16,18 +16,20 @@ Rectangle {
|
||||
ListView {
|
||||
id: chunkListView
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: 12
|
||||
anchors.topMargin: appState.verticalMargin
|
||||
anchors.bottomMargin: appState.verticalMargin
|
||||
model: bookController.hasBook ? readingModel : null
|
||||
cacheBuffer: 2000
|
||||
clip: true
|
||||
|
||||
delegate: Text {
|
||||
width: ListView.view.width - 18
|
||||
rightPadding: 2
|
||||
leftPadding: appState.horizontalMargin
|
||||
rightPadding: appState.horizontalMargin
|
||||
wrapMode: Text.WrapAtWordBoundaryOrAnywhere
|
||||
textFormat: Text.RichText
|
||||
font.pixelSize: 16
|
||||
lineHeight: 1.6
|
||||
font.pixelSize: appState.fontSize
|
||||
lineHeight: appState.lineSpacing
|
||||
color: Theme.readingText
|
||||
text: model.content
|
||||
}
|
||||
@@ -76,7 +78,7 @@ Rectangle {
|
||||
interval: 50
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
readingModel.setViewportSize(chunkListView.width - 18 - 2 * appState.horizontalMargin, chunkListView.height)
|
||||
var idx = chunkListView.indexAt(0, chunkListView.contentY)
|
||||
if (idx >= 0) {
|
||||
var item = chunkListView.itemAtIndex(idx)
|
||||
@@ -122,7 +124,7 @@ Rectangle {
|
||||
chunkListView.positionViewAtIndex(savedScrollIndex, ListView.Beginning)
|
||||
chunkListView.contentY += savedScrollOffset
|
||||
}
|
||||
readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
readingModel.setViewportSize(chunkListView.width - 18 - 2 * appState.horizontalMargin, chunkListView.height)
|
||||
if (savedScrollIndex > 0) {
|
||||
var idx = chunkListView.indexAt(0, chunkListView.contentY)
|
||||
if (idx >= 0) {
|
||||
@@ -141,7 +143,7 @@ Rectangle {
|
||||
function onChapterChanged() {
|
||||
if (!_restoring) {
|
||||
Qt.callLater(function() {
|
||||
readingModel.setViewportSize(chunkListView.width, chunkListView.height)
|
||||
readingModel.setViewportSize(chunkListView.width - 18 - 2 * appState.horizontalMargin, chunkListView.height)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
+137
-38
@@ -26,52 +26,151 @@ Rectangle {
|
||||
leftPadding: 4
|
||||
}
|
||||
|
||||
// Page flip mode selector
|
||||
// Horizontal margin slider
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 0
|
||||
spacing: 8
|
||||
|
||||
Text {
|
||||
text: "Page flip"
|
||||
font.pixelSize: 15
|
||||
color: Theme.uiText
|
||||
bottomPadding: 12
|
||||
leftPadding: 4
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(labelH.implicitHeight, valueH.implicitHeight)
|
||||
Text {
|
||||
id: labelH
|
||||
text: "Horizontal margin"
|
||||
font.pixelSize: 15
|
||||
color: Theme.uiText
|
||||
leftPadding: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
id: valueH
|
||||
text: appState.horizontalMargin + " px"
|
||||
font.pixelSize: 13
|
||||
color: Theme.dimText
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
spacing: 8
|
||||
Slider {
|
||||
width: parent.width
|
||||
from: 0
|
||||
to: 120
|
||||
stepSize: 1
|
||||
value: appState.horizontalMargin
|
||||
onValueChanged: appState.horizontalMargin = value
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
model: [
|
||||
{ label: "Scroll", value: "scroll" },
|
||||
{ label: "Page", value: "page" }
|
||||
]
|
||||
// Vertical margin slider
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 8
|
||||
|
||||
delegate: Rectangle {
|
||||
width: 100
|
||||
height: 40
|
||||
radius: 6
|
||||
color: appState.pageFlipMode === modelData.value
|
||||
? Theme.primaryAccent
|
||||
: Theme.surface
|
||||
|
||||
Text {
|
||||
anchors.centerIn: parent
|
||||
text: modelData.label
|
||||
font.pixelSize: 14
|
||||
color: appState.pageFlipMode === modelData.value
|
||||
? Theme.readingText
|
||||
: Theme.uiText
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: appState.pageFlipMode = modelData.value
|
||||
}
|
||||
}
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(labelV.implicitHeight, valueV.implicitHeight)
|
||||
Text {
|
||||
id: labelV
|
||||
text: "Vertical margin"
|
||||
font.pixelSize: 15
|
||||
color: Theme.uiText
|
||||
leftPadding: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
id: valueV
|
||||
text: appState.verticalMargin + " px"
|
||||
font.pixelSize: 13
|
||||
color: Theme.dimText
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
width: parent.width
|
||||
from: 0
|
||||
to: 80
|
||||
stepSize: 1
|
||||
value: appState.verticalMargin
|
||||
onValueChanged: appState.verticalMargin = value
|
||||
}
|
||||
}
|
||||
|
||||
// Font size slider
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 8
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(labelF.implicitHeight, valueF.implicitHeight)
|
||||
Text {
|
||||
id: labelF
|
||||
text: "Font size"
|
||||
font.pixelSize: 15
|
||||
color: Theme.uiText
|
||||
leftPadding: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
id: valueF
|
||||
text: appState.fontSize + " px"
|
||||
font.pixelSize: 13
|
||||
color: Theme.dimText
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
width: parent.width
|
||||
from: 10
|
||||
to: 32
|
||||
stepSize: 1
|
||||
value: appState.fontSize
|
||||
onValueChanged: appState.fontSize = value
|
||||
}
|
||||
}
|
||||
|
||||
// Line spacing slider
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: 8
|
||||
|
||||
Item {
|
||||
width: parent.width
|
||||
height: Math.max(labelL.implicitHeight, valueL.implicitHeight)
|
||||
Text {
|
||||
id: labelL
|
||||
text: "Line spacing"
|
||||
font.pixelSize: 15
|
||||
color: Theme.uiText
|
||||
leftPadding: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
Text {
|
||||
id: valueL
|
||||
text: appState.lineSpacing.toFixed(1) + "×"
|
||||
font.pixelSize: 13
|
||||
color: Theme.dimText
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 4
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
Slider {
|
||||
width: parent.width
|
||||
from: 0.5
|
||||
to: 3.0
|
||||
stepSize: 0.1
|
||||
value: appState.lineSpacing
|
||||
onValueChanged: appState.lineSpacing = value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user