X3 fixes
This commit is contained in:
@@ -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