diff --git a/src/CrossPointSettings.h b/src/CrossPointSettings.h index 21ece46..1ebf254 100644 --- a/src/CrossPointSettings.h +++ b/src/CrossPointSettings.h @@ -86,7 +86,7 @@ class CrossPointSettings { }; // Short power button press actions - enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, DICTIONARY = 3, SHORT_PWRBTN_COUNT }; + enum SHORT_PWRBTN { IGNORE = 0, SLEEP = 1, PAGE_TURN = 2, DICTIONARY = 3, QUICK_MENU = 4, SHORT_PWRBTN_COUNT }; // Hide battery percentage enum HIDE_BATTERY_PERCENTAGE { HIDE_NEVER = 0, HIDE_READER = 1, HIDE_ALWAYS = 2, HIDE_BATTERY_PERCENTAGE_COUNT }; diff --git a/src/activities/settings/SettingsActivity.cpp b/src/activities/settings/SettingsActivity.cpp index e5d2817..dd81491 100644 --- a/src/activities/settings/SettingsActivity.cpp +++ b/src/activities/settings/SettingsActivity.cpp @@ -84,7 +84,7 @@ const SettingInfo controlsSettings[controlsSettingsCount] = { {"Prev, Next", "Next, Prev"}), SettingInfo::Toggle("Long-press Chapter Skip", &CrossPointSettings::longPressChapterSkip), SettingInfo::Enum("Short Power Button Click", &CrossPointSettings::shortPwrBtn, - {"Ignore", "Sleep", "Page Turn", "Dictionary"})}; + {"Ignore", "Sleep", "Page Turn", "Dictionary", "Quick Menu"})}; constexpr int systemSettingsCount = 4; const SettingInfo systemSettings[systemSettingsCount] = { diff --git a/src/main.cpp b/src/main.cpp index 47f12fb..73d9a2e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -21,11 +21,13 @@ #include "activities/boot_sleep/BootActivity.h" #include "activities/boot_sleep/SleepActivity.h" #include "activities/browser/OpdsBookBrowserActivity.h" +#include "activities/home/BookmarkListActivity.h" #include "activities/home/HomeActivity.h" #include "activities/home/ListViewActivity.h" #include "activities/home/MyLibraryActivity.h" #include "activities/network/CrossPointWebServerActivity.h" #include "activities/reader/ReaderActivity.h" +#include "activities/settings/ClearCacheActivity.h" #include "activities/settings/SettingsActivity.h" #include "activities/util/FullScreenMessageActivity.h" #include "fontIds.h" @@ -336,10 +338,13 @@ void enterDeepSleep() { void onGoHome(); void onGoToMyLibrary(); void onGoToMyLibraryWithTab(const std::string& path, MyLibraryActivity::Tab tab); +void onGoToClearCache(); +void onGoToSettings(); void onGoToReader(const std::string& initialEpubPath, MyLibraryActivity::Tab fromTab) { exitActivity(); enterNewActivity( - new ReaderActivity(renderer, mappedInputManager, initialEpubPath, fromTab, onGoHome, onGoToMyLibraryWithTab)); + new ReaderActivity(renderer, mappedInputManager, initialEpubPath, fromTab, onGoHome, onGoToMyLibraryWithTab, + onGoToClearCache, onGoToSettings)); } void onContinueReading() { onGoToReader(APP_STATE.openEpubPath, MyLibraryActivity::Tab::Recent); } @@ -348,7 +353,7 @@ void onGoToReaderFromList(const std::string& bookPath) { exitActivity(); // When opening from a list, treat it like opening from Recent (will return to list view via back) enterNewActivity(new ReaderActivity(renderer, mappedInputManager, bookPath, MyLibraryActivity::Tab::Recent, onGoHome, - onGoToMyLibraryWithTab)); + onGoToMyLibraryWithTab, onGoToClearCache, onGoToSettings)); } // View a specific list @@ -358,6 +363,22 @@ void onGoToListView(const std::string& listName) { new ListViewActivity(renderer, mappedInputManager, listName, onGoToMyLibrary, onGoToReaderFromList)); } +// View bookmarks for a specific book +void onGoToBookmarkList(const std::string& bookPath, const std::string& bookTitle) { + exitActivity(); + enterNewActivity(new BookmarkListActivity( + renderer, mappedInputManager, bookPath, bookTitle, + onGoToMyLibrary, // On back, return to library + [bookPath](uint16_t spineIndex, uint32_t contentOffset) { + // Navigate to bookmark location in the book + // For now, just open the book (TODO: pass bookmark location to reader) + exitActivity(); + enterNewActivity(new ReaderActivity(renderer, mappedInputManager, bookPath, + MyLibraryActivity::Tab::Bookmarks, onGoHome, onGoToMyLibraryWithTab, + onGoToClearCache, onGoToSettings)); + })); +} + // Go to pinned list (if exists) or Lists tab void onGoToListsOrPinned() { exitActivity(); @@ -368,7 +389,7 @@ void onGoToListsOrPinned() { } else { // Go to Lists tab in My Library enterNewActivity(new MyLibraryActivity(renderer, mappedInputManager, onGoHome, onGoToReader, onGoToListView, - MyLibraryActivity::Tab::Lists)); + onGoToBookmarkList, MyLibraryActivity::Tab::Lists)); } } @@ -382,14 +403,19 @@ void onGoToSettings() { enterNewActivity(new SettingsActivity(renderer, mappedInputManager, onGoHome)); } +void onGoToClearCache() { + exitActivity(); + enterNewActivity(new ClearCacheActivity(renderer, mappedInputManager, onGoHome)); +} + void onGoToMyLibrary() { exitActivity(); - enterNewActivity(new MyLibraryActivity(renderer, mappedInputManager, onGoHome, onGoToReader, onGoToListView)); + enterNewActivity(new MyLibraryActivity(renderer, mappedInputManager, onGoHome, onGoToReader, onGoToListView, onGoToBookmarkList)); } void onGoToMyLibraryWithTab(const std::string& path, MyLibraryActivity::Tab tab) { exitActivity(); - enterNewActivity(new MyLibraryActivity(renderer, mappedInputManager, onGoHome, onGoToReader, onGoToListView, tab, path)); + enterNewActivity(new MyLibraryActivity(renderer, mappedInputManager, onGoHome, onGoToReader, onGoToListView, onGoToBookmarkList, tab, path)); } void onGoToBrowser() {