Co-authored-by: Uri Tauber <uritaube@gmail.com> Co-authored-by: Julia Nguyen <julia@uxj.io>
36 lines
1.3 KiB
C++
36 lines
1.3 KiB
C++
#pragma once
|
|
#include <memory>
|
|
|
|
#include "activities/Activity.h"
|
|
#include "activities/home/FileBrowserActivity.h"
|
|
|
|
class Epub;
|
|
class Xtc;
|
|
class Txt;
|
|
|
|
class ReaderActivity final : public Activity {
|
|
std::string initialBookPath;
|
|
std::string currentBookPath; // Track current book path for navigation
|
|
// Non-static (unlike the other loaders): draws the first-open indexing popup, which needs the renderer.
|
|
std::unique_ptr<Epub> loadEpub(const std::string& path);
|
|
static std::unique_ptr<Xtc> loadXtc(const std::string& path);
|
|
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);
|
|
|
|
void goToLibrary(const std::string& fromBookPath = "");
|
|
void onGoToEpubReader(std::unique_ptr<Epub> epub);
|
|
void onGoToXtcReader(std::unique_ptr<Xtc> xtc);
|
|
void onGoToTxtReader(std::unique_ptr<Txt> txt);
|
|
void onGoToBmpViewer(const std::string& path);
|
|
|
|
void onGoBack();
|
|
|
|
public:
|
|
explicit ReaderActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, std::string initialBookPath)
|
|
: Activity("Reader", renderer, mappedInput), initialBookPath(std::move(initialBookPath)) {}
|
|
void onEnter() override;
|
|
bool isReaderActivity() const override { return true; }
|
|
};
|