2026-02-12 20:40:07 -05:00
|
|
|
#pragma once
|
|
|
|
|
#include <Epub.h>
|
|
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
#include "../ActivityWithSubactivity.h"
|
|
|
|
|
#include "util/BookmarkStore.h"
|
|
|
|
|
#include "util/ButtonNavigator.h"
|
|
|
|
|
|
|
|
|
|
class EpubReaderBookmarkSelectionActivity final : public ActivityWithSubactivity {
|
|
|
|
|
std::shared_ptr<Epub> epub;
|
|
|
|
|
std::vector<Bookmark> bookmarks;
|
|
|
|
|
std::string cachePath;
|
|
|
|
|
ButtonNavigator buttonNavigator;
|
|
|
|
|
int selectorIndex = 0;
|
|
|
|
|
bool deleteConfirmMode = false;
|
|
|
|
|
bool ignoreNextConfirmRelease = false;
|
|
|
|
|
int pendingDeleteIndex = 0;
|
|
|
|
|
const std::function<void()> onGoBack;
|
|
|
|
|
const std::function<void(int newSpineIndex, int newPage)> onSelectBookmark;
|
|
|
|
|
|
|
|
|
|
int getPageItems() const;
|
|
|
|
|
int getTotalItems() const;
|
|
|
|
|
std::string getBookmarkPrefix(const Bookmark& bookmark) const;
|
|
|
|
|
static std::string getPageSuffix(const Bookmark& bookmark);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit EpubReaderBookmarkSelectionActivity(GfxRenderer& renderer, MappedInputManager& mappedInput,
|
|
|
|
|
const std::shared_ptr<Epub>& epub,
|
|
|
|
|
std::vector<Bookmark> bookmarks,
|
|
|
|
|
const std::string& cachePath,
|
|
|
|
|
const std::function<void()>& onGoBack,
|
|
|
|
|
const std::function<void(int newSpineIndex, int newPage)>& onSelectBookmark)
|
|
|
|
|
: ActivityWithSubactivity("EpubReaderBookmarkSelection", renderer, mappedInput),
|
|
|
|
|
epub(epub),
|
|
|
|
|
bookmarks(std::move(bookmarks)),
|
|
|
|
|
cachePath(cachePath),
|
|
|
|
|
onGoBack(onGoBack),
|
|
|
|
|
onSelectBookmark(onSelectBookmark) {}
|
|
|
|
|
void onEnter() override;
|
|
|
|
|
void onExit() override;
|
|
|
|
|
void loop() override;
|
2026-02-16 13:22:40 -05:00
|
|
|
void render(Activity::RenderLock&&) override;
|
2026-02-12 20:40:07 -05:00
|
|
|
};
|