mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2025-12-19 15:47:40 +03:00
Formatting.
This commit is contained in:
parent
12463011b7
commit
40f86dd04f
@ -317,15 +317,13 @@ int Epub::getTocIndexForSpineIndex(const int spineIndex) const {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t Epub::getBookSize() const {
|
size_t Epub::getBookSize() const { return getCumulativeSpineItemSize(getSpineItemsCount() - 1); }
|
||||||
return getCumulativeSpineItemSize(getSpineItemsCount() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate progress in book
|
// Calculate progress in book
|
||||||
uint8_t Epub::calculateProgress(const int currentSpineIndex, const float currentSpineRead){
|
uint8_t Epub::calculateProgress(const int currentSpineIndex, const float currentSpineRead) {
|
||||||
size_t prevChapterSize = getCumulativeSpineItemSize(currentSpineIndex - 1);
|
size_t prevChapterSize = getCumulativeSpineItemSize(currentSpineIndex - 1);
|
||||||
size_t curChapterSize = getCumulativeSpineItemSize(currentSpineIndex) - prevChapterSize;
|
size_t curChapterSize = getCumulativeSpineItemSize(currentSpineIndex) - prevChapterSize;
|
||||||
size_t bookSize = getBookSize();
|
size_t bookSize = getBookSize();
|
||||||
size_t sectionProgSize = currentSpineRead * curChapterSize;
|
size_t sectionProgSize = currentSpineRead * curChapterSize;
|
||||||
return round(static_cast<float>(prevChapterSize + sectionProgSize) / bookSize * 100.0);
|
return round(static_cast<float>(prevChapterSize + sectionProgSize) / bookSize * 100.0);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user