diff --git a/src/activities/reader/EpubReaderActivity.cpp b/src/activities/reader/EpubReaderActivity.cpp index 18177e2d..9f172b6c 100644 --- a/src/activities/reader/EpubReaderActivity.cpp +++ b/src/activities/reader/EpubReaderActivity.cpp @@ -498,29 +498,29 @@ void EpubReaderActivity::renderStatusBar(const int orientedMarginRight, const in // Position status bar near the bottom of the logical screen, regardless of orientation const auto screenHeight = renderer.getScreenHeight(); const auto textY = screenHeight - orientedMarginBottom - 4; - int progressTextWidth = 0; + if (showProgress) { // Calculate progress in book + // TODO: use progress values for UI + + // cppcheck-suppress unreadVariable const float sectionChapterProg = static_cast(section->currentPage) / section->pageCount; + // cppcheck-suppress unreadVariable const float bookProgress = epub->calculateProgress(currentSpineIndex, sectionChapterProg) * 100; + } // Left aligned battery icon and percentage if (showBattery) { ScreenComponents::drawBattery(renderer, orientedMarginLeft + 1, textY, showBatteryPercentage); } - } - - if (showBattery) { - ScreenComponents::drawBattery(renderer, orientedMarginLeft + 1, textY, showBatteryPercentage); - } - if (showChapterTitle) { // Centered chatper title text // Page width minus existing content with 30px padding on each side const int rendererableScreenWidth = renderer.getScreenWidth() - orientedMarginLeft - orientedMarginRight; + int progressTextWidth = 0; const int batterySize = showBattery ? (showBatteryPercentage ? 50 : 20) : 0; const int titleMarginLeft = batterySize + 30; const int titleMarginRight = progressTextWidth + 30; @@ -630,8 +630,8 @@ void EpubReaderActivity::navigateToHref(const char* href, bool savePosition) { BookMetadataCache::SpineEntry entry = epub->getSpineItem(i); std::string spineItem = entry.href; - size_t lastSlash = spineItem.find_last_of('/'); - std::string spineFilename = (lastSlash != std::string::npos) ? spineItem.substr(lastSlash + 1) : spineItem; + size_t lastslash = spineItem.find_last_of('/'); + std::string spineFilename = (lastslash != std::string::npos) ? spineItem.substr(lastslash + 1) : spineItem; if (spineFilename == filename) { targetSpineIndex = i; diff --git a/src/activities/reader/EpubReaderChapterSelectionActivity.cpp b/src/activities/reader/EpubReaderChapterSelectionActivity.cpp index 9f4d62b0..17781493 100644 --- a/src/activities/reader/EpubReaderChapterSelectionActivity.cpp +++ b/src/activities/reader/EpubReaderChapterSelectionActivity.cpp @@ -14,23 +14,7 @@ constexpr int SKIP_PAGE_MS = 700; bool EpubReaderChapterSelectionActivity::hasSyncOption() const { return KOREADER_STORE.hasCredentials(); } -int EpubReaderChapterSelectionActivity::getTotalItems() const { - // Add 2 for sync options (top and bottom) if credentials are configured - const int syncCount = hasSyncOption() ? 2 : 0; - return epub->getTocItemsCount() + syncCount; -} -bool EpubReaderChapterSelectionActivity::isSyncItem(int index) const { - if (!hasSyncOption()) return false; - // First item and last item are sync options - return index == 0 || index == getTotalItems() - 1; -} - -int EpubReaderChapterSelectionActivity::tocIndexFromItemIndex(int itemIndex) const { - // Account for the sync option at the top - const int offset = hasSyncOption() ? 1 : 0; - return itemIndex - offset; -} int EpubReaderChapterSelectionActivity::getPageItems() const { // Layout constants used in renderScreen diff --git a/src/activities/reader/EpubReaderChapterSelectionActivity.h b/src/activities/reader/EpubReaderChapterSelectionActivity.h index 8726b453..a5039375 100644 --- a/src/activities/reader/EpubReaderChapterSelectionActivity.h +++ b/src/activities/reader/EpubReaderChapterSelectionActivity.h @@ -27,18 +27,10 @@ class EpubReaderChapterSelectionActivity final : public ActivityWithSubactivity // This adapts automatically when switching between portrait and landscape. int getPageItems() const; - // Total items including sync options (top and bottom) - int getTotalItems() const; // Check if sync option is available (credentials configured) bool hasSyncOption() const; - // Check if given item index is a sync option (first or last) - bool isSyncItem(int index) const; - - // Convert item index to TOC index (accounting for top sync option offset) - int tocIndexFromItemIndex(int itemIndex) const; - // Filtered list of spine indices (excluding footnote pages) std::vector filteredSpineIndices;