diff --git a/lib/I18n/translations/english.yaml b/lib/I18n/translations/english.yaml index c214eb27..9e5f874b 100644 --- a/lib/I18n/translations/english.yaml +++ b/lib/I18n/translations/english.yaml @@ -24,6 +24,7 @@ STR_EMPTY_FILE: "Empty file" STR_OUT_OF_BOUNDS: "Out of bounds" STR_LOADING: "Loading..." STR_LOADING_POPUP: "Loading" +STR_LOADING_FONT_LIST: "Loading font list..." STR_WIFI_NETWORKS: "WiFi Networks" STR_NO_NETWORKS: "No networks found" STR_NETWORKS_FOUND: "%zu networks found" @@ -99,6 +100,9 @@ STR_CREATE_FALLBACK_FOR_INVALID_TOC: "Create fallback for invalid TOC" STR_ORIENTATION: "Reading Orientation" STR_LONG_PRESS_SKIP: "Long-press Chapter Skip" STR_FONT_FAMILY: "Reader Font Family" +STR_FONT_DOWNLOAD: "Font Download" +STR_FONT_INSTALLED: "Font installed!" +STR_FONT_INSTALL_FAILED: "Font installation failed" STR_FONT_SIZE: "Reader Font Size" STR_LINE_SPACING: "Reader Line Spacing" STR_SCREEN_MARGIN: "Reader Screen Margin" @@ -181,6 +185,9 @@ STR_REGISTER_SUCCESS: "Account created successfully!" STR_REGISTER_FAILED: "Registration failed" STR_USERNAME_TAKEN: "Username already taken" STR_DONE: "Done" +STR_INSTALLED: "Installed" +STR_DOWNLOAD_ALL: "Download / Update All" +STR_UPDATE_AVAILABLE: "Update" STR_CLEAR_CACHE_WARNING_1: "This will clear all cached book data." STR_CLEAR_CACHE_WARNING_2: "All reading progress will be lost!" STR_CLEAR_CACHE_WARNING_3: "Books will need to be re-indexed" @@ -242,6 +249,7 @@ STR_POWER_ON_HINT: "Press and hold power button to turn back on" STR_NO_ENTRIES: "No entries found" STR_DOWNLOADING: "Downloading..." STR_DOWNLOAD_FAILED: "Download failed" +STR_NO_FONTS_AVAILABLE: "No fonts available" STR_ERROR_MSG: "Error:" STR_UNNAMED: "Unnamed" STR_NO_SERVER_URL: "No server URL configured" diff --git a/src/activities/settings/SettingActionDispatch.cpp b/src/activities/settings/SettingActionDispatch.cpp index 599f85e7..f0efb8bb 100644 --- a/src/activities/settings/SettingActionDispatch.cpp +++ b/src/activities/settings/SettingActionDispatch.cpp @@ -4,6 +4,7 @@ #include "ClearCacheActivity.h" #include "ClockSettingsActivity.h" #include "DetectTimezoneActivity.h" +#include "FontDownloadActivity.h" #include "KOReaderSettingsActivity.h" #include "LanguageSelectActivity.h" #include "OpdsServerListActivity.h" @@ -21,6 +22,8 @@ std::unique_ptr createActivityForAction(SettingAction action, GfxRende return std::make_unique(renderer, mappedInput); case SettingAction::CustomiseStatusBar: return std::make_unique(renderer, mappedInput); + case SettingAction::DownloadFonts: + return std::make_unique(renderer, mappedInput); case SettingAction::ClockSettings: return std::make_unique(renderer, mappedInput); case SettingAction::KOReaderSync: diff --git a/src/activities/settings/SettingInfo.h b/src/activities/settings/SettingInfo.h index 9dd105c2..7384c9b8 100644 --- a/src/activities/settings/SettingInfo.h +++ b/src/activities/settings/SettingInfo.h @@ -15,6 +15,7 @@ enum class SettingAction { None, RemapFrontButtons, CustomiseStatusBar, + DownloadFonts, ClockSettings, KOReaderSync, OPDSBrowser, diff --git a/src/activities/settings/SettingsActivity.cpp b/src/activities/settings/SettingsActivity.cpp index 7415af40..59542007 100644 --- a/src/activities/settings/SettingsActivity.cpp +++ b/src/activities/settings/SettingsActivity.cpp @@ -9,6 +9,7 @@ #include #include "CrossPointSettings.h" +#include "FontSelectionActivity.h" #include "MappedInputManager.h" #include "SettingActionDispatch.h" #include "SettingsList.h" @@ -96,6 +97,9 @@ 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, @@ -107,6 +111,9 @@ 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))); @@ -227,6 +234,15 @@ void SettingsActivity::toggleCurrentSetting() { const auto& setting = (*currentSettings)[selectedSetting]; if (setting.isSeparator) return; + if (setting.type == SettingType::ENUM && setting.nameId == StrId::STR_FONT_FAMILY) { + startActivityForResult(std::make_unique(renderer, mappedInput), + [this](const ActivityResult&) { + SETTINGS.saveToFile(); + needsHalfRefresh = true; + }); + return; + } + if (setting.type == SettingType::ACTION) { auto resultHandler = [this](const ActivityResult& result) { SETTINGS.saveToFile();