Change Labels for Webui
This commit is contained in:
+16
-11
@@ -134,18 +134,29 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
StrId::STR_CAT_SYSTEM),
|
StrId::STR_CAT_SYSTEM),
|
||||||
SettingInfo::Toggle(StrId::STR_SHOW_FILE_EXTENSIONS, &CrossPointSettings::showFileExtensions, "showFileExtensions",
|
SettingInfo::Toggle(StrId::STR_SHOW_FILE_EXTENSIONS, &CrossPointSettings::showFileExtensions, "showFileExtensions",
|
||||||
StrId::STR_CAT_SYSTEM),
|
StrId::STR_CAT_SYSTEM),
|
||||||
|
|
||||||
|
// Will be dealt with separately , so do receive none of the main categories to be visible in the web UI but not the
|
||||||
|
// device UI
|
||||||
|
SettingInfo::Toggle(StrId::STR_USE_CLOCK, &CrossPointSettings::useClock, "useClock", StrId::STR_CLOCK),
|
||||||
SettingInfo::Enum(StrId::STR_CLOCK_FORMAT, &CrossPointSettings::clockFormat12h, {StrId::STR_24H, StrId::STR_12H},
|
SettingInfo::Enum(StrId::STR_CLOCK_FORMAT, &CrossPointSettings::clockFormat12h, {StrId::STR_24H, StrId::STR_12H},
|
||||||
"clockFormat12h", StrId::STR_CAT_SYSTEM),
|
"clockFormat12h", StrId::STR_CLOCK),
|
||||||
SettingInfo::Enum(StrId::STR_TIMEZONE, &CrossPointSettings::timeZone,
|
SettingInfo::Enum(StrId::STR_TIMEZONE, &CrossPointSettings::timeZone,
|
||||||
{StrId::STR_TZ_UTC, StrId::STR_TZ_CET, StrId::STR_TZ_EET, StrId::STR_TZ_MSK,
|
{StrId::STR_TZ_UTC, StrId::STR_TZ_CET, StrId::STR_TZ_EET, StrId::STR_TZ_MSK,
|
||||||
StrId::STR_TZ_UTC_PLUS4, StrId::STR_TZ_IST, StrId::STR_TZ_UTC_PLUS7, StrId::STR_TZ_UTC_PLUS8,
|
StrId::STR_TZ_UTC_PLUS4, StrId::STR_TZ_IST, StrId::STR_TZ_UTC_PLUS7, StrId::STR_TZ_UTC_PLUS8,
|
||||||
StrId::STR_TZ_UTC_PLUS9, StrId::STR_TZ_AEST, StrId::STR_TZ_NZST, StrId::STR_TZ_UTC_MINUS3,
|
StrId::STR_TZ_UTC_PLUS9, StrId::STR_TZ_AEST, StrId::STR_TZ_NZST, StrId::STR_TZ_UTC_MINUS3,
|
||||||
StrId::STR_TZ_EST, StrId::STR_TZ_CST, StrId::STR_TZ_MST, StrId::STR_TZ_PST},
|
StrId::STR_TZ_EST, StrId::STR_TZ_CST, StrId::STR_TZ_MST, StrId::STR_TZ_PST},
|
||||||
"timeZone", StrId::STR_CAT_SYSTEM),
|
"timeZone", StrId::STR_CLOCK),
|
||||||
SettingInfo::Toggle(StrId::STR_USE_CLOCK, &CrossPointSettings::useClock, "useClock", StrId::STR_CAT_SYSTEM),
|
// Weather
|
||||||
SettingInfo::Toggle(StrId::STR_USE_WEATHER, &CrossPointSettings::useWeather, "useWeather", StrId::STR_CAT_SYSTEM),
|
SettingInfo::Toggle(StrId::STR_USE_WEATHER, &CrossPointSettings::useWeather, "useWeather", StrId::STR_WEATHER),
|
||||||
|
|
||||||
// --- KOReader Sync (web-only, uses KOReaderCredentialStore) ---
|
// --- KOReader Sync (web-only, uses KOReaderCredentialStore) ---
|
||||||
|
SettingInfo::DynamicString(
|
||||||
|
StrId::STR_SYNC_SERVER_URL, [] { return KOREADER_STORE.getServerUrl(); },
|
||||||
|
[](const std::string& v) {
|
||||||
|
KOREADER_STORE.setServerUrl(v);
|
||||||
|
KOREADER_STORE.saveToFile();
|
||||||
|
},
|
||||||
|
"koServerUrl", StrId::STR_KOREADER_SYNC),
|
||||||
SettingInfo::DynamicString(
|
SettingInfo::DynamicString(
|
||||||
StrId::STR_KOREADER_USERNAME, [] { return KOREADER_STORE.getUsername(); },
|
StrId::STR_KOREADER_USERNAME, [] { return KOREADER_STORE.getUsername(); },
|
||||||
[](const std::string& v) {
|
[](const std::string& v) {
|
||||||
@@ -161,13 +172,6 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
},
|
},
|
||||||
"koPassword", StrId::STR_KOREADER_SYNC)
|
"koPassword", StrId::STR_KOREADER_SYNC)
|
||||||
.withObfuscated(),
|
.withObfuscated(),
|
||||||
SettingInfo::DynamicString(
|
|
||||||
StrId::STR_SYNC_SERVER_URL, [] { return KOREADER_STORE.getServerUrl(); },
|
|
||||||
[](const std::string& v) {
|
|
||||||
KOREADER_STORE.setServerUrl(v);
|
|
||||||
KOREADER_STORE.saveToFile();
|
|
||||||
},
|
|
||||||
"koServerUrl", StrId::STR_KOREADER_SYNC),
|
|
||||||
SettingInfo::DynamicEnum(
|
SettingInfo::DynamicEnum(
|
||||||
StrId::STR_DOCUMENT_MATCHING, {StrId::STR_FILENAME, StrId::STR_BINARY},
|
StrId::STR_DOCUMENT_MATCHING, {StrId::STR_FILENAME, StrId::STR_BINARY},
|
||||||
[] { return static_cast<uint8_t>(KOREADER_STORE.getMatchMethod()); },
|
[] { return static_cast<uint8_t>(KOREADER_STORE.getMatchMethod()); },
|
||||||
@@ -185,6 +189,7 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
SettingInfo::String(StrId::STR_PASSWORD, SETTINGS.opdsPassword, sizeof(SETTINGS.opdsPassword), "opdsPassword",
|
SettingInfo::String(StrId::STR_PASSWORD, SETTINGS.opdsPassword, sizeof(SETTINGS.opdsPassword), "opdsPassword",
|
||||||
StrId::STR_OPDS_BROWSER)
|
StrId::STR_OPDS_BROWSER)
|
||||||
.withObfuscated(),
|
.withObfuscated(),
|
||||||
|
|
||||||
// --- Status Bar Settings (web-only, uses StatusBarSettingsActivity) ---
|
// --- Status Bar Settings (web-only, uses StatusBarSettingsActivity) ---
|
||||||
SettingInfo::Toggle(StrId::STR_CHAPTER_PAGE_COUNT, &CrossPointSettings::statusBarChapterPageCount,
|
SettingInfo::Toggle(StrId::STR_CHAPTER_PAGE_COUNT, &CrossPointSettings::statusBarChapterPageCount,
|
||||||
"statusBarChapterPageCount", StrId::STR_CUSTOMISE_STATUS_BAR),
|
"statusBarChapterPageCount", StrId::STR_CUSTOMISE_STATUS_BAR),
|
||||||
|
|||||||
@@ -177,7 +177,9 @@ void ActivityManager::loop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (requestedUpdate) {
|
if (requestedUpdate) {
|
||||||
|
taskENTER_CRITICAL(nullptr);
|
||||||
requestedUpdate = false;
|
requestedUpdate = false;
|
||||||
|
taskEXIT_CRITICAL(nullptr);
|
||||||
// Using direct notification to signal the render task to update
|
// Using direct notification to signal the render task to update
|
||||||
// Increment counter so multiple rapid calls won't be lost
|
// Increment counter so multiple rapid calls won't be lost
|
||||||
if (renderTaskHandle) {
|
if (renderTaskHandle) {
|
||||||
@@ -299,7 +301,9 @@ void ActivityManager::requestUpdate(bool immediate) {
|
|||||||
} else {
|
} else {
|
||||||
// Deferring the update until current loop is finished
|
// Deferring the update until current loop is finished
|
||||||
// This is to avoid multiple updates being requested in the same loop
|
// This is to avoid multiple updates being requested in the same loop
|
||||||
|
taskENTER_CRITICAL(nullptr);
|
||||||
requestedUpdate = true;
|
requestedUpdate = true;
|
||||||
|
taskEXIT_CRITICAL(nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void ActivityManager::requestUpdateAndWait() {
|
void ActivityManager::requestUpdateAndWait() {
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ class ActivityManager {
|
|||||||
|
|
||||||
// Whether to trigger a render after the current loop()
|
// Whether to trigger a render after the current loop()
|
||||||
// This variable must only be set by the main loop, to avoid race conditions
|
// This variable must only be set by the main loop, to avoid race conditions
|
||||||
bool requestedUpdate = false;
|
volatile bool requestedUpdate = false;
|
||||||
|
|
||||||
// When true, input events are consumed (discarded) until all buttons are released
|
// When true, input events are consumed (discarded) until all buttons are released
|
||||||
// and no press/release events remain. Armed automatically on activity transitions
|
// and no press/release events remain. Armed automatically on activity transitions
|
||||||
|
|||||||
@@ -345,13 +345,17 @@ void HomeActivity::render(RenderLock&&) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (hasOpdsUrl) {
|
if (hasOpdsUrl) {
|
||||||
// Insert OPDS Browser after Recents (and Global Bookmarks if present)
|
|
||||||
menuItems.insert(menuItems.begin() + insertAfterRecents, tr(STR_OPDS_BROWSER));
|
menuItems.insert(menuItems.begin() + insertAfterRecents, tr(STR_OPDS_BROWSER));
|
||||||
menuIcons.insert(menuIcons.begin() + insertAfterRecents, Library);
|
menuIcons.insert(menuIcons.begin() + insertAfterRecents, Library);
|
||||||
}
|
}
|
||||||
|
|
||||||
const HomeScreenLayout layout =
|
const int totalItems = static_cast<int>(recentBooks.size() + menuItems.size());
|
||||||
computeHomeScreenLayout(metrics, contentRect.height, static_cast<int>(menuItems.size()));
|
if (selectorIndex >= totalItems) {
|
||||||
|
selectorIndex = std::max(0, totalItems - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
const int menuCount = static_cast<int>(menuItems.size());
|
||||||
|
const HomeScreenLayout layout = computeHomeScreenLayout(metrics, contentRect.height, menuCount);
|
||||||
|
|
||||||
GUI.drawRecentBookCover(renderer,
|
GUI.drawRecentBookCover(renderer,
|
||||||
Rect{contentRect.x, metrics.homeTopPadding, contentRect.width, layout.recentTileHeight},
|
Rect{contentRect.x, metrics.homeTopPadding, contentRect.width, layout.recentTileHeight},
|
||||||
@@ -362,7 +366,7 @@ void HomeActivity::render(RenderLock&&) {
|
|||||||
renderer,
|
renderer,
|
||||||
Rect{contentRect.x, metrics.homeTopPadding + layout.recentTileHeight + layout.recentToMenuGap, contentRect.width,
|
Rect{contentRect.x, metrics.homeTopPadding + layout.recentTileHeight + layout.recentToMenuGap, contentRect.width,
|
||||||
layout.menuHeight},
|
layout.menuHeight},
|
||||||
static_cast<int>(menuItems.size()), selectorIndex - recentBooks.size(),
|
menuCount, selectorIndex - static_cast<int>(recentBooks.size()),
|
||||||
[&menuItems](int index) { return std::string(menuItems[index]); },
|
[&menuItems](int index) { return std::string(menuItems[index]); },
|
||||||
[&menuIcons](int index) { return menuIcons[index]; });
|
[&menuIcons](int index) { return menuIcons[index]; });
|
||||||
|
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ void CrossPointWebServerActivity::onExit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LOG_DBG("WEBACT", "Free heap at onExit end: %d bytes", ESP.getFreeHeap());
|
LOG_DBG("WEBACT", "Free heap at onExit end: %d bytes", ESP.getFreeHeap());
|
||||||
|
requestUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrossPointWebServerActivity::onNetworkModeSelected(const NetworkMode mode) {
|
void CrossPointWebServerActivity::onNetworkModeSelected(const NetworkMode mode) {
|
||||||
|
|||||||
Reference in New Issue
Block a user