Reduce debug logging

This commit is contained in:
jpirnay
2026-04-17 20:43:36 +02:00
parent b4881e1563
commit 6ca8de8329
8 changed files with 163 additions and 13 deletions
+20
View File
@@ -9,6 +9,7 @@
#include <Utf8.h>
#include <Xtc.h>
#include <algorithm>
#include <cstring>
#include <vector>
@@ -211,15 +212,27 @@ void HomeActivity::onEnter() {
recentsLoaded = true;
}
// Apply focus: book path takes priority, else combined selector index (covers
// "return to the menu entry I was on").
bool focused = false;
if (!focusBookPath.empty()) {
for (size_t i = 0; i < recentBooks.size(); ++i) {
if (recentBooks[i].path == focusBookPath) {
selectorIndex = static_cast<int>(i);
focused = true;
break;
}
}
focusBookPath.clear();
}
if (!focused && focusSelectorIndex >= 0) {
rebuildMenuEntries(); // need menu count to clamp; rebuild is idempotent
const int combinedSize = static_cast<int>(recentBooks.size() + menuEntries.size());
if (combinedSize > 0) {
selectorIndex = std::min(focusSelectorIndex, combinedSize - 1);
}
}
focusSelectorIndex = -1;
// Trigger first update
menuEntriesDirty = true;
@@ -366,6 +379,13 @@ void HomeActivity::onSelectBook(const std::string& path) {
}
void HomeActivity::dispatchMenuAction(MenuAction action) {
// Record where the menu entry was focused so that when the launched activity exits
// (via returnFromChild() or an empty-stack finish()), we come back to the same row.
ReturnHint hint;
hint.target = ReturnTo::Home;
hint.selectIndex = selectorIndex;
activityManager.setReturnHint(std::move(hint));
switch (action) {
case MenuAction::FileBrowser:
activityManager.goToFileBrowser();