Generate styled placeholder covers (title, author, book icon) when a book has no embedded cover image, instead of showing a blank rectangle. - Add PlaceholderCoverGenerator lib with 1-bit BMP rendering, scaled fonts, word-wrap, and a book icon bitmap - Integrate as fallback in Epub/Xtc/Txt reader activities and SleepActivity after format-specific cover generation fails - Add fallback in HomeActivity::loadRecentCovers() so the home screen also shows placeholder thumbnails when cache is cleared - Add Txt::getThumbBmpPath() for TXT thumbnail support - Add helper scripts for icon and layout preview generation Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.1 KiB
C++
38 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <HalStorage.h>
|
|
|
|
#include <memory>
|
|
#include <string>
|
|
|
|
class Txt {
|
|
std::string filepath;
|
|
std::string cacheBasePath;
|
|
std::string cachePath;
|
|
bool loaded = false;
|
|
size_t fileSize = 0;
|
|
|
|
public:
|
|
explicit Txt(std::string path, std::string cacheBasePath);
|
|
|
|
bool load();
|
|
[[nodiscard]] const std::string& getPath() const { return filepath; }
|
|
[[nodiscard]] const std::string& getCachePath() const { return cachePath; }
|
|
[[nodiscard]] std::string getTitle() const;
|
|
[[nodiscard]] size_t getFileSize() const { return fileSize; }
|
|
|
|
void setupCacheDir() const;
|
|
|
|
// Cover image support - looks for cover.bmp/jpg/jpeg/png in same folder as txt file
|
|
[[nodiscard]] std::string getCoverBmpPath() const;
|
|
[[nodiscard]] bool generateCoverBmp() const;
|
|
[[nodiscard]] std::string findCoverImage() const;
|
|
|
|
// Thumbnail paths (matching Epub/Xtc pattern for home screen covers)
|
|
[[nodiscard]] std::string getThumbBmpPath() const;
|
|
[[nodiscard]] std::string getThumbBmpPath(int height) const;
|
|
|
|
// Read content from file
|
|
[[nodiscard]] bool readContent(uint8_t* buffer, size_t offset, size_t length) const;
|
|
};
|