Add end of book actions screen

This commit is contained in:
jpirnay
2026-05-12 18:11:55 +02:00
parent 8d2cfb17a7
commit a91c151979
13 changed files with 1116 additions and 15 deletions
+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;
}