Support png and jpg in Image Viewer

This commit is contained in:
jpirnay
2026-04-06 12:39:37 +02:00
parent d4df19d686
commit f45b780900
7 changed files with 179 additions and 93 deletions
+4 -2
View File
@@ -31,7 +31,9 @@ bool ReaderActivity::isTxtFile(const std::string& path) {
FsHelpers::hasMarkdownExtension(path); // Treat .md as txt files (until we have a markdown reader)
}
bool ReaderActivity::isBmpFile(const std::string& path) { return FsHelpers::hasBmpExtension(path); }
bool ReaderActivity::isImageFile(const std::string& path) {
return FsHelpers::hasBmpExtension(path) || FsHelpers::hasJpgExtension(path) || FsHelpers::hasPngExtension(path);
}
std::unique_ptr<Epub> ReaderActivity::loadEpub(const std::string& path) {
if (!Storage.exists(path.c_str())) {
@@ -120,7 +122,7 @@ void ReaderActivity::onEnter() {
}
currentBookPath = initialBookPath;
if (isBmpFile(initialBookPath)) {
if (isImageFile(initialBookPath)) {
onGoToBmpViewer(initialBookPath);
} else if (isXtcFile(initialBookPath)) {
renderer.clearScreen();
+1 -1
View File
@@ -16,7 +16,7 @@ class ReaderActivity final : public Activity {
static std::unique_ptr<Txt> loadTxt(const std::string& path);
static bool isXtcFile(const std::string& path);
static bool isTxtFile(const std::string& path);
static bool isBmpFile(const std::string& path);
static bool isImageFile(const std::string& path);
static std::string extractFolderPath(const std::string& filePath);
void goToLibrary(const std::string& fromBookPath = "");