[app] Only show the cancel button when actually loading the book
This commit is contained in:
parent
aa73002011
commit
512c698fd1
7 changed files with 36 additions and 4 deletions
|
@ -52,6 +52,8 @@ SilicaFlickable {
|
||||||
|
|
||||||
// NOTE: These have to match ResetReason in BooksBookModel
|
// NOTE: These have to match ResetReason in BooksBookModel
|
||||||
readonly property var _loadingTextLabel: [
|
readonly property var _loadingTextLabel: [
|
||||||
|
//% "Formatting..."
|
||||||
|
qsTrId("book-view-formatting"),
|
||||||
//% "Loading..."
|
//% "Loading..."
|
||||||
qsTrId("book-view-loading"),
|
qsTrId("book-view-loading"),
|
||||||
//% "Applying larger fonts..."
|
//% "Applying larger fonts..."
|
||||||
|
@ -217,8 +219,8 @@ SilicaFlickable {
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
anchors {
|
anchors {
|
||||||
top: busyIndicator.bottom
|
bottom: busyIndicator.top
|
||||||
topMargin: Theme.paddingLarge
|
bottomMargin: Theme.paddingLarge
|
||||||
horizontalCenter: busyIndicator.horizontalCenter
|
horizontalCenter: busyIndicator.horizontalCenter
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -239,7 +241,7 @@ SilicaFlickable {
|
||||||
horizontalCenter: parent.horizontalCenter
|
horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
onClicked: root.closeBook()
|
onClicked: root.closeBook()
|
||||||
enabled: _loading
|
enabled: _loading && bookModel.resetReason === BookModel.ReasonLoading
|
||||||
visible: opacity > 0
|
visible: opacity > 0
|
||||||
opacity: enabled ? 1.0 : 0.0
|
opacity: enabled ? 1.0 : 0.0
|
||||||
Behavior on opacity { FadeAnimation { } }
|
Behavior on opacity { FadeAnimation { } }
|
||||||
|
|
|
@ -245,7 +245,7 @@ void BooksBookModel::setBook(BooksBook* aBook)
|
||||||
iTitle = QString();
|
iTitle = QString();
|
||||||
HDEBUG("<none>");
|
HDEBUG("<none>");
|
||||||
}
|
}
|
||||||
startReset();
|
startReset(ReasonLoading, true);
|
||||||
if (oldTitle != iTitle) {
|
if (oldTitle != iTitle) {
|
||||||
Q_EMIT titleChanged();
|
Q_EMIT titleChanged();
|
||||||
}
|
}
|
||||||
|
@ -461,6 +461,15 @@ void BooksBookModel::startReset(ResetReason aResetReason, bool aFullReset)
|
||||||
BooksLoadingSignalBlocker block(this);
|
BooksLoadingSignalBlocker block(this);
|
||||||
const BooksPos thisPage = pageMark(iCurrentPage);
|
const BooksPos thisPage = pageMark(iCurrentPage);
|
||||||
const BooksPos nextPage = pageMark(iCurrentPage+1);
|
const BooksPos nextPage = pageMark(iCurrentPage+1);
|
||||||
|
if (aResetReason == ReasonUnknown) {
|
||||||
|
if (iResetReason == ReasonUnknown) {
|
||||||
|
if (!iData && !iData2) {
|
||||||
|
aResetReason = ReasonLoading;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
aResetReason = iResetReason;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (iTask) {
|
if (iTask) {
|
||||||
iTask->release(this);
|
iTask->release(this);
|
||||||
iTask = NULL;
|
iTask = NULL;
|
||||||
|
@ -541,6 +550,10 @@ void BooksBookModel::onResetDone()
|
||||||
if (oldBookModel != bookModel()) {
|
if (oldBookModel != bookModel()) {
|
||||||
Q_EMIT bookModelChanged();
|
Q_EMIT bookModelChanged();
|
||||||
}
|
}
|
||||||
|
if (iResetReason != ReasonUnknown) {
|
||||||
|
iResetReason = ReasonUnknown;
|
||||||
|
Q_EMIT resetReasonChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<int,QByteArray> BooksBookModel::roleNames() const
|
QHash<int,QByteArray> BooksBookModel::roleNames() const
|
||||||
|
|
|
@ -76,6 +76,7 @@ public:
|
||||||
// NOTE: These have to match the labels in BooksBookView.qml
|
// NOTE: These have to match the labels in BooksBookView.qml
|
||||||
enum ResetReason {
|
enum ResetReason {
|
||||||
ReasonUnknown,
|
ReasonUnknown,
|
||||||
|
ReasonLoading,
|
||||||
ReasonIncreasingFontSize,
|
ReasonIncreasingFontSize,
|
||||||
ReasonDecreasingFontSize
|
ReasonDecreasingFontSize
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
<source>Loading...</source>
|
<source>Loading...</source>
|
||||||
<translation>Latautuu...</translation>
|
<translation>Latautuu...</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message id="book-view-formatting">
|
||||||
|
<source>Formatting...</source>
|
||||||
|
<translation type="unfinished">Alustetaan...</translation>
|
||||||
|
</message>
|
||||||
<message id="book-view-applying-larger-fonts">
|
<message id="book-view-applying-larger-fonts">
|
||||||
<source>Applying larger fonts...</source>
|
<source>Applying larger fonts...</source>
|
||||||
<translation>Vaihdetaan isompiin fontteihin...</translation>
|
<translation>Vaihdetaan isompiin fontteihin...</translation>
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
<source>Loading...</source>
|
<source>Loading...</source>
|
||||||
<translation>Загрузка...</translation>
|
<translation>Загрузка...</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message id="book-view-formatting">
|
||||||
|
<source>Formatting...</source>
|
||||||
|
<translation>Форматирование...</translation>
|
||||||
|
</message>
|
||||||
<message id="book-view-applying-larger-fonts">
|
<message id="book-view-applying-larger-fonts">
|
||||||
<source>Applying larger fonts...</source>
|
<source>Applying larger fonts...</source>
|
||||||
<translation>Увеличиваем шрифты...</translation>
|
<translation>Увеличиваем шрифты...</translation>
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
<source>Loading...</source>
|
<source>Loading...</source>
|
||||||
<translation>Läser in...</translation>
|
<translation>Läser in...</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message id="book-view-formatting">
|
||||||
|
<source>Formatting...</source>
|
||||||
|
<translation type="unfinished">Formatering...</translation>
|
||||||
|
</message>
|
||||||
<message id="book-view-applying-larger-fonts">
|
<message id="book-view-applying-larger-fonts">
|
||||||
<source>Applying larger fonts...</source>
|
<source>Applying larger fonts...</source>
|
||||||
<translation>Tillämpar större teckensnitt...</translation>
|
<translation>Tillämpar större teckensnitt...</translation>
|
||||||
|
|
|
@ -15,6 +15,10 @@
|
||||||
<source>Loading...</source>
|
<source>Loading...</source>
|
||||||
<translation>Loading...</translation>
|
<translation>Loading...</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message id="book-view-formatting">
|
||||||
|
<source>Formatting...</source>
|
||||||
|
<translation>Formatting...</translation>
|
||||||
|
</message>
|
||||||
<message id="book-view-applying-larger-fonts">
|
<message id="book-view-applying-larger-fonts">
|
||||||
<source>Applying larger fonts...</source>
|
<source>Applying larger fonts...</source>
|
||||||
<translation>Applying larger fonts...</translation>
|
<translation>Applying larger fonts...</translation>
|
||||||
|
|
Loading…
Reference in a new issue