Merge branch 'remove-chapters'
# Conflicts: # src/backend/ReadingModel.h # src/qml/components/Footer.qml # tests/ReadingModelTest.cpp
This commit is contained in:
commit
43e75d3d8f
4 files changed
+43
-1
No files matched your search
@@ -49,6 +49,11 @@ int ReadingModel::totalChapters() const
|
||||
return m_totalChapters;
|
||||
}
|
||||
|
||||
bool ReadingModel::hasChapters() const
|
||||
{
|
||||
return m_totalChapters > 1;
|
||||
}
|
||||
|
||||
double ReadingModel::progress() const
|
||||
{
|
||||
if (m_totalChapters == 0)
|
||||
|
||||
@@ -16,6 +16,7 @@ class ReadingModel : public QAbstractListModel {
|
||||
Q_PROPERTY(double progress READ progress NOTIFY chapterChanged)
|
||||
Q_PROPERTY(int currentPage READ currentPage NOTIFY currentPageChanged)
|
||||
Q_PROPERTY(int totalPages READ totalPages NOTIFY totalPagesChanged)
|
||||
Q_PROPERTY(bool hasChapters READ hasChapters NOTIFY totalChaptersChanged)
|
||||
|
||||
public:
|
||||
enum Roles {
|
||||
@@ -35,6 +36,7 @@ public:
|
||||
double progress() const;
|
||||
int currentPage() const;
|
||||
int totalPages() const;
|
||||
bool hasChapters() const;
|
||||
void setReader(FormatReader *reader);
|
||||
|
||||
// Called from QML on resize
|
||||
|
||||
@@ -15,7 +15,7 @@ Rectangle {
|
||||
Text {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
x: parent.width * 0.5
|
||||
text: bookController.hasBook
|
||||
text: bookController.hasBook && readingModel.hasChapters
|
||||
? "Chapter " + (readingModel.currentChapter + 1) + " / " + readingModel.totalChapters
|
||||
: ""
|
||||
font.pixelSize: 11
|
||||
|
||||
Reference in new issue
Block a user