mirror of
https://github.com/daveallie/crosspoint-reader.git
synced 2026-02-05 15:17:37 +03:00
- Add Txt library for loading and parsing plain text files - Create TxtReaderActivity with streaming page rendering - Uses 8KB chunks to handle large files without memory issues - Page index caching for fast re-open after sleep - Progress bar during initial indexing - Word wrapping with UTF-8 support - Support cover images for TXT files - Priority: same filename as TXT (e.g., book.jpg for book.txt) - Fallback: cover.bmp/jpg/jpeg in same folder - Converts JPG to BMP using existing converter - Update SleepActivity to show TXT cover images in Cover mode - Add .txt extension to file browser filter
34 lines
952 B
C++
34 lines
952 B
C++
#pragma once
|
|
|
|
#include <SDCardManager.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;
|
|
|
|
// Read content from file
|
|
[[nodiscard]] bool readContent(uint8_t* buffer, size_t offset, size_t length) const;
|
|
};
|