43 lines
1.4 KiB
C++
43 lines
1.4 KiB
C++
#pragma once
|
|
|
|
#include <SDCardManager.h>
|
|
|
|
#include <functional>
|
|
#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 support (for Continue Reading card)
|
|
[[nodiscard]] std::string getThumbBmpPath() const;
|
|
[[nodiscard]] bool generateThumbBmp() const;
|
|
// Micro thumbnail support (for Recent Books list)
|
|
[[nodiscard]] std::string getMicroThumbBmpPath() const;
|
|
[[nodiscard]] bool generateMicroThumbBmp() const;
|
|
// Generate all covers at once (for pre-generation on book open)
|
|
[[nodiscard]] bool generateAllCovers(const std::function<void(int)>& progressCallback = nullptr) const;
|
|
|
|
// Read content from file
|
|
[[nodiscard]] bool readContent(uint8_t* buffer, size_t offset, size_t length) const;
|
|
};
|