Merge pull request #203 from jpirnay/feat-endofbook

feat: Add end of book actions screen
This commit is contained in:
jpirnay
2026-05-12 21:11:01 +02:00
committed by GitHub
15 changed files with 1071 additions and 15 deletions
+11
View File
@@ -17,6 +17,16 @@ STR_SELECT_CHAPTER: "Select Chapter"
STR_NO_CHAPTERS: "No chapters"
STR_END_OF_BOOK: "End of book"
STR_EMPTY_CHAPTER: "Empty chapter"
STR_FINISHED_BOOK_HEADER: "Book finished!"
STR_FINISHED_BOOK_HEADER_LINE1: "Congratulations, you finished this book."
STR_FINISHED_BOOK_HEADER_LINE2: "What do you want to do now?"
STR_NEXT_BOOK_HEADER: "Next book to read:"
STR_GO_BACK_TO_HOME: "Go back to Home"
STR_GO_BACK_TO_HOME_DESC: "Return to the home screen"
STR_OPEN_NEXT_BOOK: "Open the next book:"
STR_MOVE_FINISHED_TO_COMPLETED: "Move finished book to /COMPLETED"
STR_FORGET_BOOK: "Forget book"
STR_FORGET_BOOK_DESC: "Remove book from Recent Books"
STR_INDEXING: "Indexing"
STR_MEMORY_ERROR: "Memory error"
STR_PAGE_LOAD_ERROR: "Page load error"
@@ -374,6 +384,7 @@ STR_DELETE_CACHE: "Delete Book Cache"
STR_DELETE: "Delete"
STR_REMOVE: "Remove"
STR_DISPLAY_QR: "Show page as QR"
STR_MARK_AS_READ: "Mark as read"
STR_CHAPTER_PREFIX: "Chapter: "
STR_PAGES_SEPARATOR: " pages | "
STR_BOOK_PREFIX: "Book: "
+1
View File
@@ -324,6 +324,7 @@ STR_CHAPTER: "Rozdział"
STR_EXAMPLE_CHAPTER: "Rozdział 21"
STR_EXAMPLE_BOOK: "Tytuł książki"
STR_PREVIEW: "Podgląd"
STR_NEXT_BOOK_HEADER: "Następna książka do przeczytania:"
STR_TITLE: "Tytuł"
STR_BATTERY: "Bateria"
STR_XTC_STATUS_BAR: "Pasek statusu XTC"
+23 -2
View File
@@ -3,6 +3,7 @@
#include <FsHelpers.h>
#include <JpegToBmpConverter.h>
#include <Logging.h>
#include <PngToBmpConverter.h>
Txt::Txt(std::string path, std::string cacheBasePath)
: filepath(std::move(path)), cacheBasePath(std::move(cacheBasePath)) {
@@ -156,10 +157,30 @@ bool Txt::generateCoverBmp() const {
LOG_DBG("TXT", "Generated BMP from JPG cover image");
}
return success;
} else if (FsHelpers::hasPngExtension(coverImagePath)) {
LOG_DBG("TXT", "Generating BMP from PNG cover image");
FsFile coverPng, coverBmp;
if (!Storage.openFileForRead("TXT", coverImagePath, coverPng)) {
return false;
}
if (!Storage.openFileForWrite("TXT", getCoverBmpPath(), coverBmp)) {
coverPng.close();
return false;
}
const bool success = PngToBmpConverter::pngFileToBmpStream(coverPng, coverBmp);
coverPng.close();
coverBmp.close();
if (!success) {
LOG_ERR("TXT", "Failed to generate BMP from PNG cover image");
Storage.remove(getCoverBmpPath().c_str());
} else {
LOG_DBG("TXT", "Generated BMP from PNG cover image");
}
return success;
}
// PNG files are not supported (would need a PNG decoder)
LOG_ERR("TXT", "Cover image format not supported (only BMP/JPG/JPEG)");
LOG_ERR("TXT", "Cover image format not supported (only BMP/JPG/JPEG/PNG)");
return false;
}