make UI look snappier than it is on (by making loading less noticable)
This commit is contained in:
3 files changed
+38
-2
No files matched your search
@@ -44,7 +44,7 @@ QVector<int> ChunkMeasurer::measure(const QStringList &chunks, qreal textWidth)
|
|||||||
|
|
||||||
QVector<int> heights(n, 0);
|
QVector<int> heights(n, 0);
|
||||||
QAtomicInt nextIdx(0);
|
QAtomicInt nextIdx(0);
|
||||||
const int threadCount = QThread::idealThreadCount();
|
const int threadCount = 2;
|
||||||
|
|
||||||
// Capture by value what each worker needs (no shared mutable state)
|
// Capture by value what each worker needs (no shared mutable state)
|
||||||
auto worker = [&]() {
|
auto worker = [&]() {
|
||||||
|
|||||||
+18
-1
@@ -23,6 +23,7 @@ ApplicationWindow {
|
|||||||
property bool barsVisible: true
|
property bool barsVisible: true
|
||||||
// Set to true on the first book open at startup so we restore the last page.
|
// Set to true on the first book open at startup so we restore the last page.
|
||||||
property bool _startupRestore: false
|
property bool _startupRestore: false
|
||||||
|
property bool _bookInitializing: false
|
||||||
|
|
||||||
onCurrentPageChanged: uiState.lastPage = currentPage
|
onCurrentPageChanged: uiState.lastPage = currentPage
|
||||||
|
|
||||||
@@ -46,6 +47,20 @@ ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: book
|
||||||
|
function onLoadingChanged() {
|
||||||
|
if (book.loading) window._bookInitializing = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: readingModel
|
||||||
|
function onMeasuringChanged() {
|
||||||
|
if (!readingModel.measuring) window._bookInitializing = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Timer {
|
Timer {
|
||||||
id: geometrySaveTimer
|
id: geometrySaveTimer
|
||||||
interval: 250
|
interval: 250
|
||||||
@@ -123,10 +138,12 @@ ApplicationWindow {
|
|||||||
|
|
||||||
BusyIndicator {
|
BusyIndicator {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
running: book.loading || readingModel.measuring
|
running: window._bookInitializing
|
||||||
visible: running
|
visible: running
|
||||||
z: 10
|
z: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Loader {
|
Loader {
|
||||||
|
|||||||
@@ -13,6 +13,25 @@ Rectangle {
|
|||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Measuring spinner
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 16
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
visible: typeof readingModel !== "undefined" && readingModel.measuring
|
||||||
|
text: "\ue863"
|
||||||
|
font.family: "Material Icons Outlined"
|
||||||
|
font.pixelSize: 14
|
||||||
|
color: ThemeManager.currentTheme.dimText
|
||||||
|
|
||||||
|
RotationAnimator on rotation {
|
||||||
|
from: 0; to: 360
|
||||||
|
duration: 1200
|
||||||
|
loops: Animation.Infinite
|
||||||
|
running: parent.visible
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Prev chapter button
|
// Prev chapter button
|
||||||
Button {
|
Button {
|
||||||
id: prevBtn
|
id: prevBtn
|
||||||
|
|||||||
Reference in new issue
Block a user