X3 fixes
This commit is contained in:
+2
-4
@@ -130,9 +130,7 @@ inline const std::vector<SettingInfo> list = {
|
||||
"syntheticTocFallback", StrId::STR_CAT_READER)
|
||||
.withSubcategory(StrId::STR_MENU_READER_TWEAKS),
|
||||
|
||||
// --- Controls ---
|
||||
SettingInfo::Separator(StrId::STR_MENU_BTN_PHYSICAL),
|
||||
|
||||
// --- Controls ---
|
||||
// --- Button Actions (short / double / long press per logical button) ---
|
||||
// All entries share the same ordered action-label list; the submenu groups them behind
|
||||
// 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_KOREADER_SYNC
|
||||
|
||||
SettingInfo::Separator(StrId::STR_MENU_BTN_ACTIONS),
|
||||
// Back button: short=exit reader, double=ignore, long=go home
|
||||
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack,
|
||||
{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),
|
||||
SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleBack,
|
||||
{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(),
|
||||
[&item](const SubmenuData& d) { return d.id == item.submenu; });
|
||||
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, {}});
|
||||
it = preparedSubmenus.end() - 1;
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ bool SettingsActivity::isListItemSelectable(int settingIdx) const {
|
||||
|
||||
void SettingsActivity::onEnter() {
|
||||
Activity::onEnter();
|
||||
needsHalfRefresh = true;
|
||||
|
||||
// Build per-category vectors from the shared settings list.
|
||||
// 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.
|
||||
controlsSettings.insert(controlsSettings.begin(),
|
||||
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,
|
||||
SettingInfo::Action(StrId::STR_CUSTOMISE_STATUS_BAR, SettingAction::CustomiseStatusBar));
|
||||
@@ -217,11 +220,15 @@ void SettingsActivity::toggleCurrentSetting() {
|
||||
if (setting.type == SettingType::ACTION) {
|
||||
auto resultHandler = [this](const ActivityResult& result) {
|
||||
SETTINGS.saveToFile();
|
||||
needsHalfRefresh = true;
|
||||
const auto* menuResult = std::get_if<MenuResult>(&result.data);
|
||||
if (menuResult && menuResult->action != -1) {
|
||||
auto activity = createActivityForAction(static_cast<SettingAction>(menuResult->action), renderer, mappedInput);
|
||||
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));
|
||||
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];
|
||||
|
||||
std::vector<SettingInfo::SubmenuData> submenuData;
|
||||
bool needsHalfRefresh = false;
|
||||
|
||||
void enterCategory(int categoryIndex);
|
||||
void toggleCurrentSetting();
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
void SettingsSubmenuActivity::onEnter() {
|
||||
Activity::onEnter();
|
||||
needsHalfRefresh = true;
|
||||
initMenuList();
|
||||
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));
|
||||
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 {
|
||||
StrId titleId;
|
||||
std::function<std::string(const SettingInfo&)> itemValueStringOverride;
|
||||
bool needsHalfRefresh = false;
|
||||
|
||||
// MenuListActivity overrides
|
||||
void onEnter() override;
|
||||
|
||||
Reference in New Issue
Block a user