X3 fixes
This commit is contained in:
+2
-4
@@ -130,9 +130,7 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
"syntheticTocFallback", StrId::STR_CAT_READER)
|
"syntheticTocFallback", StrId::STR_CAT_READER)
|
||||||
.withSubcategory(StrId::STR_MENU_READER_TWEAKS),
|
.withSubcategory(StrId::STR_MENU_READER_TWEAKS),
|
||||||
|
|
||||||
// --- Controls ---
|
// --- Controls ---
|
||||||
SettingInfo::Separator(StrId::STR_MENU_BTN_PHYSICAL),
|
|
||||||
|
|
||||||
// --- Button Actions (short / double / long press per logical button) ---
|
// --- Button Actions (short / double / long press per logical button) ---
|
||||||
// All entries share the same ordered action-label list; the submenu groups them behind
|
// All entries share the same ordered action-label list; the submenu groups them behind
|
||||||
// a single placeholder row in the device UI.
|
// a single placeholder row in the device UI.
|
||||||
@@ -145,10 +143,10 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, StrId::STR_BTN_ACT_READER_MENU, \
|
StrId::STR_BTN_ACT_PREV_SECTION, StrId::STR_BTN_ACT_EXIT_READER, StrId::STR_BTN_ACT_READER_MENU, \
|
||||||
StrId::STR_BTN_ACT_KOREADER_SYNC
|
StrId::STR_BTN_ACT_KOREADER_SYNC
|
||||||
|
|
||||||
SettingInfo::Separator(StrId::STR_MENU_BTN_ACTIONS),
|
|
||||||
// Back button: short=exit reader, double=ignore, long=go home
|
// Back button: short=exit reader, double=ignore, long=go home
|
||||||
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack,
|
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack,
|
||||||
{StrId::STR_BTN_DEF_EXIT_READER, BTN_ACT_OPTIONS}, "btnShortBack", StrId::STR_CAT_CONTROLS)
|
{StrId::STR_BTN_DEF_EXIT_READER, BTN_ACT_OPTIONS}, "btnShortBack", StrId::STR_CAT_CONTROLS)
|
||||||
|
.withSubcategory(StrId::STR_MENU_BTN_ACTIONS)
|
||||||
.withSubmenu(StrId::STR_BTN_BACK),
|
.withSubmenu(StrId::STR_BTN_BACK),
|
||||||
SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleBack,
|
SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleBack,
|
||||||
{StrId::STR_BTN_DEF_IGNORE, BTN_ACT_OPTIONS}, "btnDoubleBack", StrId::STR_CAT_CONTROLS)
|
{StrId::STR_BTN_DEF_IGNORE, BTN_ACT_OPTIONS}, "btnDoubleBack", StrId::STR_CAT_CONTROLS)
|
||||||
|
|||||||
@@ -264,7 +264,9 @@ inline void SettingInfo::prepareSubmenus(std::vector<SettingInfo>& items,
|
|||||||
auto it = std::find_if(preparedSubmenus.begin(), preparedSubmenus.end(),
|
auto it = std::find_if(preparedSubmenus.begin(), preparedSubmenus.end(),
|
||||||
[&item](const SubmenuData& d) { return d.id == item.submenu; });
|
[&item](const SubmenuData& d) { return d.id == item.submenu; });
|
||||||
if (it == preparedSubmenus.end()) {
|
if (it == preparedSubmenus.end()) {
|
||||||
preparedItems.push_back(SettingInfo::SubmenuEntry(item.submenu));
|
auto placeholder = SettingInfo::SubmenuEntry(item.submenu);
|
||||||
|
placeholder.subcategory = item.subcategory; // inherit so addTo inserts the separator
|
||||||
|
preparedItems.push_back(std::move(placeholder));
|
||||||
preparedSubmenus.push_back({item.submenu, {}});
|
preparedSubmenus.push_back({item.submenu, {}});
|
||||||
it = preparedSubmenus.end() - 1;
|
it = preparedSubmenus.end() - 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ bool SettingsActivity::isListItemSelectable(int settingIdx) const {
|
|||||||
|
|
||||||
void SettingsActivity::onEnter() {
|
void SettingsActivity::onEnter() {
|
||||||
Activity::onEnter();
|
Activity::onEnter();
|
||||||
|
needsHalfRefresh = true;
|
||||||
|
|
||||||
// Build per-category vectors from the shared settings list.
|
// Build per-category vectors from the shared settings list.
|
||||||
// addTo tracks the last subcategory per vector and automatically inserts a separator
|
// addTo tracks the last subcategory per vector and automatically inserts a separator
|
||||||
@@ -80,6 +81,8 @@ void SettingsActivity::onEnter() {
|
|||||||
// Device-only ACTION items — subcategory drives separator insertion automatically.
|
// Device-only ACTION items — subcategory drives separator insertion automatically.
|
||||||
controlsSettings.insert(controlsSettings.begin(),
|
controlsSettings.insert(controlsSettings.begin(),
|
||||||
SettingInfo::Action(StrId::STR_REMAP_FRONT_BUTTONS, SettingAction::RemapFrontButtons));
|
SettingInfo::Action(StrId::STR_REMAP_FRONT_BUTTONS, SettingAction::RemapFrontButtons));
|
||||||
|
controlsSettings.insert(controlsSettings.begin(), SettingInfo::Separator(StrId::STR_MENU_BTN_PHYSICAL));
|
||||||
|
lastControlsSub = StrId::STR_MENU_BTN_PHYSICAL;
|
||||||
|
|
||||||
addToMoved(readerSettings, lastReaderSub,
|
addToMoved(readerSettings, lastReaderSub,
|
||||||
SettingInfo::Action(StrId::STR_CUSTOMISE_STATUS_BAR, SettingAction::CustomiseStatusBar));
|
SettingInfo::Action(StrId::STR_CUSTOMISE_STATUS_BAR, SettingAction::CustomiseStatusBar));
|
||||||
@@ -217,11 +220,15 @@ void SettingsActivity::toggleCurrentSetting() {
|
|||||||
if (setting.type == SettingType::ACTION) {
|
if (setting.type == SettingType::ACTION) {
|
||||||
auto resultHandler = [this](const ActivityResult& result) {
|
auto resultHandler = [this](const ActivityResult& result) {
|
||||||
SETTINGS.saveToFile();
|
SETTINGS.saveToFile();
|
||||||
|
needsHalfRefresh = true;
|
||||||
const auto* menuResult = std::get_if<MenuResult>(&result.data);
|
const auto* menuResult = std::get_if<MenuResult>(&result.data);
|
||||||
if (menuResult && menuResult->action != -1) {
|
if (menuResult && menuResult->action != -1) {
|
||||||
auto activity = createActivityForAction(static_cast<SettingAction>(menuResult->action), renderer, mappedInput);
|
auto activity = createActivityForAction(static_cast<SettingAction>(menuResult->action), renderer, mappedInput);
|
||||||
if (activity) {
|
if (activity) {
|
||||||
startActivityForResult(std::move(activity), [this](const ActivityResult&) { SETTINGS.saveToFile(); });
|
startActivityForResult(std::move(activity), [this](const ActivityResult&) {
|
||||||
|
SETTINGS.saveToFile();
|
||||||
|
needsHalfRefresh = true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -279,5 +286,7 @@ void SettingsActivity::render(RenderLock&&) {
|
|||||||
const auto labels = mappedInput.mapLabels(tr(STR_BACK), confirmLabel, tr(STR_DIR_UP), tr(STR_DIR_DOWN));
|
const auto labels = mappedInput.mapLabels(tr(STR_BACK), confirmLabel, tr(STR_DIR_UP), tr(STR_DIR_DOWN));
|
||||||
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
||||||
|
|
||||||
renderer.displayBuffer(gpio.deviceIsX3() ? HalDisplay::HALF_REFRESH : HalDisplay::FAST_REFRESH);
|
const bool halfRefresh = gpio.deviceIsX3() && needsHalfRefresh;
|
||||||
|
needsHalfRefresh = false;
|
||||||
|
renderer.displayBuffer(halfRefresh ? HalDisplay::HALF_REFRESH : HalDisplay::FAST_REFRESH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class SettingsActivity final : public Activity {
|
|||||||
static const StrId categoryNames[categoryCount];
|
static const StrId categoryNames[categoryCount];
|
||||||
|
|
||||||
std::vector<SettingInfo::SubmenuData> submenuData;
|
std::vector<SettingInfo::SubmenuData> submenuData;
|
||||||
|
bool needsHalfRefresh = false;
|
||||||
|
|
||||||
void enterCategory(int categoryIndex);
|
void enterCategory(int categoryIndex);
|
||||||
void toggleCurrentSetting();
|
void toggleCurrentSetting();
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
|
|
||||||
void SettingsSubmenuActivity::onEnter() {
|
void SettingsSubmenuActivity::onEnter() {
|
||||||
Activity::onEnter();
|
Activity::onEnter();
|
||||||
|
needsHalfRefresh = true;
|
||||||
initMenuList();
|
initMenuList();
|
||||||
requestUpdate();
|
requestUpdate();
|
||||||
}
|
}
|
||||||
@@ -65,5 +66,7 @@ void SettingsSubmenuActivity::render(RenderLock&&) {
|
|||||||
const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN));
|
const auto labels = mappedInput.mapLabels(tr(STR_BACK), tr(STR_SELECT), tr(STR_DIR_UP), tr(STR_DIR_DOWN));
|
||||||
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
GUI.drawButtonHints(renderer, labels.btn1, labels.btn2, labels.btn3, labels.btn4);
|
||||||
|
|
||||||
renderer.displayBuffer(gpio.deviceIsX3() ? HalDisplay::HALF_REFRESH : HalDisplay::FAST_REFRESH);
|
const bool halfRefresh = gpio.deviceIsX3() && needsHalfRefresh;
|
||||||
|
needsHalfRefresh = false;
|
||||||
|
renderer.displayBuffer(halfRefresh ? HalDisplay::HALF_REFRESH : HalDisplay::FAST_REFRESH);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
class SettingsSubmenuActivity final : public MenuListActivity {
|
class SettingsSubmenuActivity final : public MenuListActivity {
|
||||||
StrId titleId;
|
StrId titleId;
|
||||||
std::function<std::string(const SettingInfo&)> itemValueStringOverride;
|
std::function<std::string(const SettingInfo&)> itemValueStringOverride;
|
||||||
|
bool needsHalfRefresh = false;
|
||||||
|
|
||||||
// MenuListActivity overrides
|
// MenuListActivity overrides
|
||||||
void onEnter() override;
|
void onEnter() override;
|
||||||
|
|||||||
Reference in New Issue
Block a user