2025-12-17 23:32:18 +11:00
|
|
|
#pragma once
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "../ActivityWithSubactivity.h"
|
|
|
|
|
|
|
|
|
|
class Epub;
|
2025-12-28 23:56:05 +09:00
|
|
|
class Xtc;
|
2025-12-17 23:32:18 +11:00
|
|
|
|
|
|
|
|
class ReaderActivity final : public ActivityWithSubactivity {
|
2025-12-28 23:56:05 +09:00
|
|
|
std::string initialBookPath;
|
|
|
|
|
std::string currentBookPath; // Track current book path for navigation
|
2025-12-17 23:32:18 +11:00
|
|
|
const std::function<void()> onGoBack;
|
|
|
|
|
static std::unique_ptr<Epub> loadEpub(const std::string& path);
|
2025-12-28 23:56:05 +09:00
|
|
|
static std::unique_ptr<Xtc> loadXtc(const std::string& path);
|
|
|
|
|
static bool isXtcFile(const std::string& path);
|
2025-12-17 23:32:18 +11:00
|
|
|
|
2025-12-26 09:55:23 +09:00
|
|
|
static std::string extractFolderPath(const std::string& filePath);
|
2025-12-28 23:56:05 +09:00
|
|
|
void onSelectBookFile(const std::string& path);
|
|
|
|
|
void onGoToFileSelection(const std::string& fromBookPath = "");
|
2025-12-17 23:32:18 +11:00
|
|
|
void onGoToEpubReader(std::unique_ptr<Epub> epub);
|
2025-12-28 23:56:05 +09:00
|
|
|
void onGoToXtcReader(std::unique_ptr<Xtc> xtc);
|
2025-12-17 23:32:18 +11:00
|
|
|
|
|
|
|
|
public:
|
2025-12-28 21:59:14 -06:00
|
|
|
explicit ReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialBookPath,
|
2025-12-17 23:32:18 +11:00
|
|
|
const std::function<void()>& onGoBack)
|
2025-12-28 21:59:14 -06:00
|
|
|
: ActivityWithSubactivity("Reader", renderer, mappedInput),
|
2025-12-28 23:56:05 +09:00
|
|
|
initialBookPath(std::move(initialBookPath)),
|
2025-12-17 23:32:18 +11:00
|
|
|
onGoBack(onGoBack) {}
|
|
|
|
|
void onEnter() override;
|
|
|
|
|
};
|