format
This commit is contained in:
+4
-4
@@ -79,18 +79,18 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
SettingInfo::Enum(StrId::STR_FONT_FAMILY, &CrossPointSettings::fontFamily,
|
SettingInfo::Enum(StrId::STR_FONT_FAMILY, &CrossPointSettings::fontFamily,
|
||||||
{StrId::STR_BOOKERLY, StrId::STR_NOTO_SANS, StrId::STR_OPEN_DYSLEXIC}, "fontFamily",
|
{StrId::STR_BOOKERLY, StrId::STR_NOTO_SANS, StrId::STR_OPEN_DYSLEXIC}, "fontFamily",
|
||||||
StrId::STR_CAT_READER)
|
StrId::STR_CAT_READER)
|
||||||
.withSubcategory(StrId::STR_FONT_FAMILY),
|
.withSubcategory(StrId::STR_MENU_READER_FONT),
|
||||||
SettingInfo::Enum(StrId::STR_FONT_SIZE, &CrossPointSettings::fontSize,
|
SettingInfo::Enum(StrId::STR_FONT_SIZE, &CrossPointSettings::fontSize,
|
||||||
{StrId::STR_SMALL, StrId::STR_MEDIUM, StrId::STR_LARGE, StrId::STR_X_LARGE}, "fontSize",
|
{StrId::STR_SMALL, StrId::STR_MEDIUM, StrId::STR_LARGE, StrId::STR_X_LARGE}, "fontSize",
|
||||||
StrId::STR_CAT_READER)
|
StrId::STR_CAT_READER)
|
||||||
.withSubmenu(StrId::STR_MENU_READER_FONT),
|
.withSubmenu(StrId::STR_MENU_READER_FONT_SETTINGS),
|
||||||
SettingInfo::Toggle(StrId::STR_TEXT_AA, &CrossPointSettings::textAntiAliasing, "textAntiAliasing",
|
SettingInfo::Toggle(StrId::STR_TEXT_AA, &CrossPointSettings::textAntiAliasing, "textAntiAliasing",
|
||||||
StrId::STR_CAT_READER)
|
StrId::STR_CAT_READER)
|
||||||
.withSubmenu(StrId::STR_MENU_READER_FONT),
|
.withSubmenu(StrId::STR_MENU_READER_FONT_SETTINGS),
|
||||||
SettingInfo::Enum(StrId::STR_TEXT_DARKNESS, &CrossPointSettings::textDarkness,
|
SettingInfo::Enum(StrId::STR_TEXT_DARKNESS, &CrossPointSettings::textDarkness,
|
||||||
{StrId::STR_NORMAL, StrId::STR_DARK, StrId::STR_EXTRA_DARK, StrId::STR_MAX_DARK}, "textDarkness",
|
{StrId::STR_NORMAL, StrId::STR_DARK, StrId::STR_EXTRA_DARK, StrId::STR_MAX_DARK}, "textDarkness",
|
||||||
StrId::STR_CAT_READER)
|
StrId::STR_CAT_READER)
|
||||||
.withSubmenu(StrId::STR_MENU_READER_FONT),
|
.withSubmenu(StrId::STR_MENU_READER_FONT_SETTINGS),
|
||||||
|
|
||||||
// Formatting settings
|
// Formatting settings
|
||||||
SettingInfo::Enum(
|
SettingInfo::Enum(
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ void MenuListActivity::toggleCurrentItem() {
|
|||||||
requestUpdate();
|
requestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string MenuListActivity::getItemValueString(int index) const {
|
std::string MenuListActivity::getItemValueString(int index) const { return menuItems[index].getDisplayValue(); }
|
||||||
return menuItems[index].getDisplayValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
void MenuListActivity::drawMenuList(const Rect& rect) {
|
void MenuListActivity::drawMenuList(const Rect& rect) {
|
||||||
const int count = static_cast<int>(menuItems.size());
|
const int count = static_cast<int>(menuItems.size());
|
||||||
|
|||||||
@@ -62,24 +62,20 @@ void EpubReaderMenuActivity::buildMenuItems(bool hasFootnotes) {
|
|||||||
// Image rendering: cycles default(-1) -> display(0) -> placeholder(1) -> suppress(2)
|
// Image rendering: cycles default(-1) -> display(0) -> placeholder(1) -> suppress(2)
|
||||||
menuItems.push_back(SettingInfo::DynamicEnum(
|
menuItems.push_back(SettingInfo::DynamicEnum(
|
||||||
StrId::STR_IMAGES,
|
StrId::STR_IMAGES,
|
||||||
{StrId::STR_DEFAULT_VALUE, StrId::STR_IMAGES_DISPLAY, StrId::STR_IMAGES_PLACEHOLDER,
|
{StrId::STR_DEFAULT_VALUE, StrId::STR_IMAGES_DISPLAY, StrId::STR_IMAGES_PLACEHOLDER, StrId::STR_IMAGES_SUPPRESS},
|
||||||
StrId::STR_IMAGES_SUPPRESS},
|
|
||||||
[this]() -> uint8_t { return (pendingImageRenderingOverride < 0) ? 0 : (pendingImageRenderingOverride + 1); },
|
[this]() -> uint8_t { return (pendingImageRenderingOverride < 0) ? 0 : (pendingImageRenderingOverride + 1); },
|
||||||
[this](uint8_t v) { pendingImageRenderingOverride = (v == 0) ? -1 : static_cast<int8_t>(v - 1); }));
|
[this](uint8_t v) { pendingImageRenderingOverride = (v == 0) ? -1 : static_cast<int8_t>(v - 1); }));
|
||||||
|
|
||||||
// Text darkness: straightforward 0-3 cycle
|
// Text darkness: straightforward 0-3 cycle
|
||||||
menuItems.push_back(SettingInfo::DynamicEnum(
|
menuItems.push_back(SettingInfo::DynamicEnum(
|
||||||
StrId::STR_TEXT_DARKNESS,
|
StrId::STR_TEXT_DARKNESS, {StrId::STR_NORMAL, StrId::STR_DARK, StrId::STR_EXTRA_DARK, StrId::STR_MAX_DARK},
|
||||||
{StrId::STR_NORMAL, StrId::STR_DARK, StrId::STR_EXTRA_DARK, StrId::STR_MAX_DARK},
|
[this]() -> uint8_t { return pendingTextDarkness; }, [this](uint8_t v) { pendingTextDarkness = v; }));
|
||||||
[this]() -> uint8_t { return pendingTextDarkness; },
|
|
||||||
[this](uint8_t v) { pendingTextDarkness = v; }));
|
|
||||||
|
|
||||||
// Orientation: straightforward 0-3 cycle
|
// Orientation: straightforward 0-3 cycle
|
||||||
menuItems.push_back(SettingInfo::DynamicEnum(
|
menuItems.push_back(SettingInfo::DynamicEnum(
|
||||||
StrId::STR_ORIENTATION,
|
StrId::STR_ORIENTATION,
|
||||||
{StrId::STR_PORTRAIT, StrId::STR_LANDSCAPE_CW, StrId::STR_INVERTED, StrId::STR_LANDSCAPE_CCW},
|
{StrId::STR_PORTRAIT, StrId::STR_LANDSCAPE_CW, StrId::STR_INVERTED, StrId::STR_LANDSCAPE_CCW},
|
||||||
[this]() -> uint8_t { return pendingOrientation; },
|
[this]() -> uint8_t { return pendingOrientation; }, [this](uint8_t v) { pendingOrientation = v; }));
|
||||||
[this](uint8_t v) { pendingOrientation = v; }));
|
|
||||||
|
|
||||||
// --- Synchronisation (only if credentials are set) ---
|
// --- Synchronisation (only if credentials are set) ---
|
||||||
if (KOREADER_STORE.hasCredentials()) {
|
if (KOREADER_STORE.hasCredentials()) {
|
||||||
@@ -158,8 +154,12 @@ void EpubReaderMenuActivity::onSettingToggled(int /*index*/) {
|
|||||||
void EpubReaderMenuActivity::onBackPressed() {
|
void EpubReaderMenuActivity::onBackPressed() {
|
||||||
ActivityResult result;
|
ActivityResult result;
|
||||||
result.isCancelled = true;
|
result.isCancelled = true;
|
||||||
result.data = MenuResult{-1, pendingOrientation, selectedPageTurnOption, pendingEmbeddedStyleOverride,
|
result.data = MenuResult{-1,
|
||||||
pendingImageRenderingOverride, pendingTextDarkness};
|
pendingOrientation,
|
||||||
|
selectedPageTurnOption,
|
||||||
|
pendingEmbeddedStyleOverride,
|
||||||
|
pendingImageRenderingOverride,
|
||||||
|
pendingTextDarkness};
|
||||||
setResult(std::move(result));
|
setResult(std::move(result));
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
@@ -180,9 +180,7 @@ std::string EpubReaderMenuActivity::getItemValueString(int index) const {
|
|||||||
return MenuListActivity::getItemValueString(index);
|
return MenuListActivity::getItemValueString(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EpubReaderMenuActivity::onEnter() {
|
void EpubReaderMenuActivity::onEnter() { MenuListActivity::onEnter(); }
|
||||||
MenuListActivity::onEnter();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EpubReaderMenuActivity::render(RenderLock&&) {
|
void EpubReaderMenuActivity::render(RenderLock&&) {
|
||||||
renderer.clearScreen();
|
renderer.clearScreen();
|
||||||
|
|||||||
@@ -255,9 +255,7 @@ void SettingsActivity::render(RenderLock&&) {
|
|||||||
contentRect.height -
|
contentRect.height -
|
||||||
(metrics.topPadding + metrics.headerHeight + metrics.tabBarHeight + metrics.verticalSpacing * 2)},
|
(metrics.topPadding + metrics.headerHeight + metrics.tabBarHeight + metrics.verticalSpacing * 2)},
|
||||||
settingsCount, selectedSettingIndex - 1, [&settings](int index) { return settings[index].getTitle(); }, nullptr,
|
settingsCount, selectedSettingIndex - 1, [&settings](int index) { return settings[index].getTitle(); }, nullptr,
|
||||||
nullptr,
|
nullptr, [&settings](int i) { return settings[i].getDisplayValue(); }, true);
|
||||||
[&settings](int i) { return settings[i].getDisplayValue(); },
|
|
||||||
true);
|
|
||||||
|
|
||||||
// Draw help text
|
// Draw help text
|
||||||
const auto confirmLabel = (selectedSettingIndex == 0)
|
const auto confirmLabel = (selectedSettingIndex == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user