## Summary * **What is the goal of this PR?** (e.g., Implements the new feature for file uploading.) - Implements auto page turn feature for epub reader in the reader submenu * **What changes are included?** - added auto page turn feature in epub reader in the submenu - currently there are 5 settings, `OFF, 1, 3, 6, 12` pages per minute ## Additional Context * Add any other information that might be helpful for the reviewer (e.g., performance implications, potential risks, specific areas to focus on). - Replacement PR for #723 - when auto turn is enabled, space reserved for chapter title will be used to indicate auto page turn being active - Back and Confirm button is used to disable it --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**Partially (mainly code reviews)**_
68 lines
1.3 KiB
C++
68 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
#include <functional>
|
|
#include <string>
|
|
#include <type_traits>
|
|
#include <utility>
|
|
#include <variant>
|
|
|
|
struct WifiResult {
|
|
bool connected = false;
|
|
std::string ssid;
|
|
std::string ip;
|
|
};
|
|
|
|
struct KeyboardResult {
|
|
std::string text;
|
|
};
|
|
|
|
struct MenuResult {
|
|
int action = -1;
|
|
uint8_t orientation = 0;
|
|
uint8_t pageTurnOption = 0;
|
|
};
|
|
|
|
struct ChapterResult {
|
|
int spineIndex = 0;
|
|
};
|
|
|
|
struct PercentResult {
|
|
int percent = 0;
|
|
};
|
|
|
|
struct PageResult {
|
|
uint32_t page = 0;
|
|
};
|
|
|
|
struct SyncResult {
|
|
int spineIndex = 0;
|
|
int page = 0;
|
|
};
|
|
|
|
enum class NetworkMode;
|
|
|
|
struct NetworkModeResult {
|
|
NetworkMode mode;
|
|
};
|
|
|
|
struct FootnoteResult {
|
|
std::string href;
|
|
};
|
|
|
|
using ResultVariant = std::variant<std::monostate, WifiResult, KeyboardResult, MenuResult, ChapterResult, PercentResult,
|
|
PageResult, SyncResult, NetworkModeResult, FootnoteResult>;
|
|
|
|
struct ActivityResult {
|
|
bool isCancelled = false;
|
|
ResultVariant data;
|
|
|
|
explicit ActivityResult() = default;
|
|
|
|
template <typename ResultType, typename = std::enable_if_t<std::is_constructible_v<ResultVariant, ResultType&&>>>
|
|
// cppcheck-suppress noExplicitConstructor
|
|
ActivityResult(ResultType&& result) : data{std::forward<ResultType>(result)} {}
|
|
};
|
|
|
|
using ActivityResultHandler = std::function<void(const ActivityResult&)>;
|