Review changes
This commit is contained in:
@@ -286,8 +286,8 @@ class CrossPointSettings {
|
||||
BTN_PREV_SECTION,
|
||||
BTN_EXIT_READER,
|
||||
BTN_READER_MENU,
|
||||
BTN_TOGGLE_BIONIC_READING,
|
||||
BTN_KOREADER_SYNC,
|
||||
BTN_TOGGLE_BIONIC_READING,
|
||||
BUTTON_ACTION_COUNT
|
||||
};
|
||||
|
||||
|
||||
@@ -85,6 +85,29 @@ RecentBook RecentBooksStore::getBookByPath(const std::string& path) const {
|
||||
return RecentBook{};
|
||||
}
|
||||
|
||||
bool RecentBooksStore::setReaderOverrides(const std::string& path, const int8_t embeddedStyleOverride,
|
||||
const int8_t imageRenderingOverride) {
|
||||
auto it =
|
||||
std::find_if(recentBooks.begin(), recentBooks.end(), [&](const RecentBook& book) { return book.path == path; });
|
||||
if (it == recentBooks.end()) {
|
||||
return false;
|
||||
}
|
||||
return setReaderOverrides(path, embeddedStyleOverride, imageRenderingOverride, it->fontFamilyOverride,
|
||||
it->fontSizeOverride, it->bionicReadingOverride);
|
||||
}
|
||||
|
||||
bool RecentBooksStore::setReaderOverrides(const std::string& path, const int8_t embeddedStyleOverride,
|
||||
const int8_t imageRenderingOverride, const int8_t fontFamilyOverride,
|
||||
const int8_t fontSizeOverride) {
|
||||
auto it =
|
||||
std::find_if(recentBooks.begin(), recentBooks.end(), [&](const RecentBook& book) { return book.path == path; });
|
||||
if (it == recentBooks.end()) {
|
||||
return false;
|
||||
}
|
||||
return setReaderOverrides(path, embeddedStyleOverride, imageRenderingOverride, fontFamilyOverride, fontSizeOverride,
|
||||
it->bionicReadingOverride);
|
||||
}
|
||||
|
||||
bool RecentBooksStore::setReaderOverrides(const std::string& path, const int8_t embeddedStyleOverride,
|
||||
const int8_t imageRenderingOverride, const bool bionicReadingOverride) {
|
||||
auto it =
|
||||
|
||||
@@ -2007,6 +2007,13 @@ void EpubReaderActivity::onButtonAction(const CrossPointSettings::BUTTON_ACTION
|
||||
openReaderMenu();
|
||||
}
|
||||
break;
|
||||
case BA::BTN_TOGGLE_BIONIC_READING:
|
||||
if (epub) {
|
||||
applyBookReaderOverrides(bookEmbeddedStyleOverride, bookImageRenderingOverride, bookFontFamilyOverride,
|
||||
bookFontSizeOverride, !bookBionicReadingOverride);
|
||||
requestUpdate();
|
||||
}
|
||||
break;
|
||||
case BA::BTN_KOREADER_SYNC:
|
||||
launchKOReaderSync(SyncLaunchMode::COMPARE);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user