Attempt at closing reader and sync
This commit is contained in:
@@ -3,6 +3,53 @@
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
enum class KOReaderSyncIntentState : uint8_t {
|
||||
COMPARE = 0,
|
||||
PULL_REMOTE = 1,
|
||||
PUSH_LOCAL = 2,
|
||||
};
|
||||
|
||||
enum class KOReaderSyncOutcomeState : uint8_t {
|
||||
NONE = 0,
|
||||
PENDING = 1,
|
||||
CANCELLED = 2,
|
||||
FAILED = 3,
|
||||
UPLOAD_COMPLETE = 4,
|
||||
APPLIED_REMOTE = 5,
|
||||
};
|
||||
|
||||
struct KOReaderSyncSessionState {
|
||||
bool active = false;
|
||||
std::string epubPath;
|
||||
int spineIndex = 0;
|
||||
int page = 0;
|
||||
int totalPagesInSpine = 0;
|
||||
uint16_t paragraphIndex = 0;
|
||||
bool hasParagraphIndex = false;
|
||||
KOReaderSyncIntentState intent = KOReaderSyncIntentState::COMPARE;
|
||||
KOReaderSyncOutcomeState outcome = KOReaderSyncOutcomeState::NONE;
|
||||
int resultSpineIndex = 0;
|
||||
int resultPage = 0;
|
||||
uint16_t resultParagraphIndex = 0;
|
||||
bool resultHasParagraphIndex = false;
|
||||
|
||||
void clear() {
|
||||
active = false;
|
||||
epubPath.clear();
|
||||
spineIndex = 0;
|
||||
page = 0;
|
||||
totalPagesInSpine = 0;
|
||||
paragraphIndex = 0;
|
||||
hasParagraphIndex = false;
|
||||
intent = KOReaderSyncIntentState::COMPARE;
|
||||
outcome = KOReaderSyncOutcomeState::NONE;
|
||||
resultSpineIndex = 0;
|
||||
resultPage = 0;
|
||||
resultParagraphIndex = 0;
|
||||
resultHasParagraphIndex = false;
|
||||
}
|
||||
};
|
||||
|
||||
class CrossPointState {
|
||||
// Static instance
|
||||
static CrossPointState instance;
|
||||
@@ -12,6 +59,7 @@ class CrossPointState {
|
||||
size_t lastSleepImage = SIZE_MAX; // SIZE_MAX = unset sentinel
|
||||
uint8_t readerActivityLoadCount = 0;
|
||||
bool lastSleepFromReader = false;
|
||||
KOReaderSyncSessionState koReaderSyncSession;
|
||||
~CrossPointState() = default;
|
||||
|
||||
// Get singleton instance
|
||||
|
||||
Reference in New Issue
Block a user