[app] Only show the cancel button when actually loading the book

This commit is contained in:
Slava Monich 2015-11-03 01:33:58 +03:00
parent aa73002011
commit 512c698fd1
7 changed files with 36 additions and 4 deletions

View file

@ -52,6 +52,8 @@ SilicaFlickable {
// NOTE: These have to match ResetReason in BooksBookModel
readonly property var _loadingTextLabel: [
//% "Formatting..."
qsTrId("book-view-formatting"),
//% "Loading..."
qsTrId("book-view-loading"),
//% "Applying larger fonts..."
@ -217,8 +219,8 @@ SilicaFlickable {
Label {
anchors {
top: busyIndicator.bottom
topMargin: Theme.paddingLarge
bottom: busyIndicator.top
bottomMargin: Theme.paddingLarge
horizontalCenter: busyIndicator.horizontalCenter
}
@ -239,7 +241,7 @@ SilicaFlickable {
horizontalCenter: parent.horizontalCenter
}
onClicked: root.closeBook()
enabled: _loading
enabled: _loading && bookModel.resetReason === BookModel.ReasonLoading
visible: opacity > 0
opacity: enabled ? 1.0 : 0.0
Behavior on opacity { FadeAnimation { } }

View file

@ -245,7 +245,7 @@ void BooksBookModel::setBook(BooksBook* aBook)
iTitle = QString();
HDEBUG("<none>");
}
startReset();
startReset(ReasonLoading, true);
if (oldTitle != iTitle) {
Q_EMIT titleChanged();
}
@ -461,6 +461,15 @@ void BooksBookModel::startReset(ResetReason aResetReason, bool aFullReset)
BooksLoadingSignalBlocker block(this);
const BooksPos thisPage = pageMark(iCurrentPage);
const BooksPos nextPage = pageMark(iCurrentPage+1);
if (aResetReason == ReasonUnknown) {
if (iResetReason == ReasonUnknown) {
if (!iData && !iData2) {
aResetReason = ReasonLoading;
}
} else {
aResetReason = iResetReason;
}
}
if (iTask) {
iTask->release(this);
iTask = NULL;
@ -541,6 +550,10 @@ void BooksBookModel::onResetDone()
if (oldBookModel != bookModel()) {
Q_EMIT bookModelChanged();
}
if (iResetReason != ReasonUnknown) {
iResetReason = ReasonUnknown;
Q_EMIT resetReasonChanged();
}
}
QHash<int,QByteArray> BooksBookModel::roleNames() const

View file

@ -76,6 +76,7 @@ public:
// NOTE: These have to match the labels in BooksBookView.qml
enum ResetReason {
ReasonUnknown,
ReasonLoading,
ReasonIncreasingFontSize,
ReasonDecreasingFontSize
};

View file

@ -15,6 +15,10 @@
<source>Loading...</source>
<translation>Latautuu...</translation>
</message>
<message id="book-view-formatting">
<source>Formatting...</source>
<translation type="unfinished">Alustetaan...</translation>
</message>
<message id="book-view-applying-larger-fonts">
<source>Applying larger fonts...</source>
<translation>Vaihdetaan isompiin fontteihin...</translation>

View file

@ -15,6 +15,10 @@
<source>Loading...</source>
<translation>Загрузка...</translation>
</message>
<message id="book-view-formatting">
<source>Formatting...</source>
<translation>Форматирование...</translation>
</message>
<message id="book-view-applying-larger-fonts">
<source>Applying larger fonts...</source>
<translation>Увеличиваем шрифты...</translation>

View file

@ -15,6 +15,10 @@
<source>Loading...</source>
<translation>Läser in...</translation>
</message>
<message id="book-view-formatting">
<source>Formatting...</source>
<translation type="unfinished">Formatering...</translation>
</message>
<message id="book-view-applying-larger-fonts">
<source>Applying larger fonts...</source>
<translation>Tillämpar större teckensnitt...</translation>

View file

@ -15,6 +15,10 @@
<source>Loading...</source>
<translation>Loading...</translation>
</message>
<message id="book-view-formatting">
<source>Formatting...</source>
<translation>Formatting...</translation>
</message>
<message id="book-view-applying-larger-fonts">
<source>Applying larger fonts...</source>
<translation>Applying larger fonts...</translation>