feat: BookInfo button mapping, ManageBook integration, cover regen fix

- Fix BookInfo buttons: Left/Right front = scroll down/up, Confirm = no-op,
  side buttons retained. Separate Up/Down hints on btn3/btn4.
- Fallback load: try epub.load(true, true) when cache-only load fails,
  so Book Info works for unopened books.
- Add "Book Info" to ManageBook menu (BOOK_INFO action) with handlers in
  all 4 result sites (Home, Recent, FileBrowser, Reader).
- Fix HomeActivity cover regen: call generateCoverBmp(false) + validate
  with isValidThumbnailBmp before falling to placeholder, matching the
  reader's multi-tier fallback pipeline. Same for XTC branch.

Made-with: Cursor
This commit is contained in:
cottongin
2026-03-09 02:06:25 -04:00
parent 1105919359
commit edf273f1d8
8 changed files with 110 additions and 11 deletions

View File

@@ -15,6 +15,7 @@
#include <vector>
#include "../util/ConfirmationActivity.h"
#include "BookInfoActivity.h"
#include "BookManageMenuActivity.h"
#include "CrossPointSettings.h"
#include "CrossPointState.h"
@@ -81,7 +82,11 @@ void HomeActivity::loadRecentCovers(int coverHeight) {
epub.load(true, true);
}
success = epub.generateThumbBmp(coverHeight);
if (success) {
if (!success || !Epub::isValidThumbnailBmp(epub.getThumbBmpPath(coverHeight))) {
epub.generateCoverBmp(false);
success = epub.generateThumbBmp(coverHeight);
}
if (success && Epub::isValidThumbnailBmp(epub.getThumbBmpPath(coverHeight))) {
const std::string thumbPath = epub.getThumbBmpPath(coverHeight);
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, thumbPath);
book.coverBmpPath = thumbPath;
@@ -93,10 +98,16 @@ void HomeActivity::loadRecentCovers(int coverHeight) {
Xtc xtc(book.path, "/.crosspoint");
if (xtc.load()) {
success = xtc.generateThumbBmp(coverHeight);
if (success) {
if (!success || !Epub::isValidThumbnailBmp(xtc.getThumbBmpPath(coverHeight))) {
xtc.generateCoverBmp();
success = xtc.generateThumbBmp(coverHeight);
}
if (success && Epub::isValidThumbnailBmp(xtc.getThumbBmpPath(coverHeight))) {
const std::string thumbPath = xtc.getThumbBmpPath(coverHeight);
RECENT_BOOKS.updateBook(book.path, book.title, book.author, book.series, thumbPath);
book.coverBmpPath = thumbPath;
} else {
success = false;
}
}
if (!success) {
@@ -304,6 +315,8 @@ void HomeActivity::onOpdsBrowserOpen() { activityManager.goToBrowser(); }
void HomeActivity::executeManageAction(BookManageMenuActivity::Action action, const std::string& capturedPath) {
bool success = false;
switch (action) {
case BookManageMenuActivity::Action::BOOK_INFO:
return;
case BookManageMenuActivity::Action::ARCHIVE:
success = BookManager::archiveBook(capturedPath);
break;
@@ -352,7 +365,11 @@ void HomeActivity::openManageMenu(const std::string& bookPath) {
const auto& menuResult = std::get<MenuResult>(result.data);
auto action = static_cast<BookManageMenuActivity::Action>(menuResult.action);
if (action == BookManageMenuActivity::Action::DELETE || action == BookManageMenuActivity::Action::ARCHIVE) {
if (action == BookManageMenuActivity::Action::BOOK_INFO) {
startActivityForResult(std::make_unique<BookInfoActivity>(renderer, mappedInput, capturedPath),
[this](const ActivityResult&) { requestUpdate(); });
} else if (action == BookManageMenuActivity::Action::DELETE ||
action == BookManageMenuActivity::Action::ARCHIVE) {
const char* promptKey =
(action == BookManageMenuActivity::Action::DELETE) ? tr(STR_DELETE_BOOK) : tr(STR_ARCHIVE_BOOK);
std::string heading = std::string(promptKey) + "?";