Add end of book actions screen
This commit is contained in:
@@ -17,6 +17,15 @@ 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_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"
|
||||
@@ -373,6 +382,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: "
|
||||
|
||||
+23
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user