From ea50449f4b65f11ba6796a2a23d18d8570481002 Mon Sep 17 00:00:00 2001 From: jpirnay Date: Sat, 2 May 2026 18:35:10 +0200 Subject: [PATCH] Amend layout Co-authored-by: Copilot --- src/activities/settings/SettingsActivity.cpp | 30 ++++++++++++++++---- 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/activities/settings/SettingsActivity.cpp b/src/activities/settings/SettingsActivity.cpp index 59542007..96a8464e 100644 --- a/src/activities/settings/SettingsActivity.cpp +++ b/src/activities/settings/SettingsActivity.cpp @@ -62,6 +62,16 @@ void SettingsActivity::onEnter() { vec.push_back(std::move(s)); }; + bool sawReaderFontSection = false; + bool insertedFontDownload = false; + + auto insertFontDownloadBelowFontSection = [&]() { + auto fontDownload = SettingInfo::Action(StrId::STR_FONT_DOWNLOAD, SettingAction::DownloadFonts); + fontDownload.withSubcategory(StrId::STR_MENU_READER_FONT); + addToMoved(readerSettings, lastReaderSub, std::move(fontDownload)); + insertedFontDownload = true; + }; + for (const auto& setting : getSettingsList()) { if (setting.category == StrId::STR_NONE_OPT) continue; if (setting.category == StrId::STR_CAT_SYSTEM && @@ -78,6 +88,14 @@ void SettingsActivity::onEnter() { enriched.enumLabels.reserve(n); for (uint8_t i = 0; i < n; i++) enriched.enumLabels.push_back(fontFamilyOptionLabel(i)); } + const bool isReaderFontEntry = + enriched.category == StrId::STR_CAT_READER && (enriched.subcategory == StrId::STR_MENU_READER_FONT || + enriched.submenu == StrId::STR_MENU_READER_FONT_SETTINGS); + + if (!insertedFontDownload && sawReaderFontSection && !isReaderFontEntry) { + insertFontDownloadBelowFontSection(); + } + if (enriched.category == StrId::STR_CAT_DISPLAY) { addTo(displaySettings, lastDisplaySub, enriched); } else if (enriched.category == StrId::STR_CAT_READER) { @@ -87,9 +105,15 @@ void SettingsActivity::onEnter() { } else if (enriched.category == StrId::STR_CAT_SYSTEM) { addTo(systemSettings, lastSystemSub, enriched); } + if (isReaderFontEntry) sawReaderFontSection = true; + // Web-only categories (KOReader Sync, OPDS Browser) are skipped for device UI } + if (!insertedFontDownload && sawReaderFontSection) { + insertFontDownloadBelowFontSection(); + } + // Device-only ACTION items — subcategory drives separator insertion automatically. controlsSettings.insert(controlsSettings.begin(), SettingInfo::Action(StrId::STR_REMAP_FRONT_BUTTONS, SettingAction::RemapFrontButtons)); @@ -97,9 +121,6 @@ void SettingsActivity::onEnter() { addToMoved(readerSettings, lastReaderSub, SettingInfo::Action(StrId::STR_CUSTOMISE_STATUS_BAR, SettingAction::CustomiseStatusBar)); - addToMoved(readerSettings, lastReaderSub, - std::move(SettingInfo::Action(StrId::STR_FONT_DOWNLOAD, SettingAction::DownloadFonts) - .withSubcategory(StrId::STR_MENU_READER_FONT))); addToMoved(systemSettings, lastSystemSub, SettingInfo::Action(StrId::STR_LANGUAGE, SettingAction::Language)); addToMoved(systemSettings, lastSystemSub, @@ -111,9 +132,6 @@ void SettingsActivity::onEnter() { addToMoved(systemSettings, lastSystemSub, std::move(SettingInfo::Action(StrId::STR_OPDS_BROWSER, SettingAction::OPDSBrowser) .withSubcategory(StrId::STR_MENU_SYS_NETWORK))); - addToMoved(systemSettings, lastSystemSub, - std::move(SettingInfo::Action(StrId::STR_FONT_DOWNLOAD, SettingAction::DownloadFonts) - .withSubcategory(StrId::STR_MENU_SYS_NETWORK))); addToMoved(systemSettings, lastSystemSub, std::move(SettingInfo::Action(StrId::STR_CLOCK_SETTINGS, SettingAction::ClockSettings) .withSubcategory(StrId::STR_MENU_SYS_TOOLS)));