no custom settings for confirm & back single clicks
This commit is contained in:
@@ -58,6 +58,11 @@ void applyLegacyFrontButtonLayout(CrossPointSettings& settings) {
|
||||
}
|
||||
}
|
||||
|
||||
void enforceFixedShortActions(CrossPointSettings& settings) {
|
||||
settings.btnShortBack = static_cast<uint8_t>(CrossPointSettings::BUTTON_ACTION::BTN_DEFAULT);
|
||||
settings.btnShortConfirm = static_cast<uint8_t>(CrossPointSettings::BUTTON_ACTION::BTN_DEFAULT);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void CrossPointSettings::validateFrontButtonMapping(CrossPointSettings& settings) {
|
||||
@@ -88,11 +93,14 @@ bool CrossPointSettings::loadFromFile() {
|
||||
if (!json.isEmpty()) {
|
||||
bool resave = false;
|
||||
bool result = JsonSettingsIO::loadSettings(*this, json.c_str(), &resave);
|
||||
if (result && resave) {
|
||||
if (saveToFile()) {
|
||||
LOG_DBG("CPS", "Resaved settings to update format");
|
||||
} else {
|
||||
LOG_ERR("CPS", "Failed to resave settings after format update");
|
||||
if (result) {
|
||||
enforceFixedShortActions(*this);
|
||||
if (resave) {
|
||||
if (saveToFile()) {
|
||||
LOG_DBG("CPS", "Resaved settings to update format");
|
||||
} else {
|
||||
LOG_ERR("CPS", "Failed to resave settings after format update");
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -102,6 +110,7 @@ bool CrossPointSettings::loadFromFile() {
|
||||
// Fall back to binary migration
|
||||
if (Storage.exists(SETTINGS_FILE_BIN)) {
|
||||
if (loadFromBinaryFile()) {
|
||||
enforceFixedShortActions(*this);
|
||||
if (saveToFile()) {
|
||||
Storage.rename(SETTINGS_FILE_BIN, SETTINGS_FILE_BAK);
|
||||
LOG_DBG("CPS", "Migrated settings.bin to settings.json");
|
||||
|
||||
+3
-3
@@ -144,8 +144,8 @@ inline const std::vector<SettingInfo> list = {
|
||||
StrId::STR_BTN_ACT_KOREADER_SYNC
|
||||
|
||||
// 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)
|
||||
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortBack, {StrId::STR_BTN_DEF_EXIT_READER},
|
||||
"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,
|
||||
@@ -156,7 +156,7 @@ inline const std::vector<SettingInfo> list = {
|
||||
.withSubmenu(StrId::STR_BTN_BACK),
|
||||
// Confirm button: short=reader menu, double=ignore, long=KOReader sync
|
||||
SettingInfo::Enum(StrId::STR_BTN_SHORT_PRESS, &CrossPointSettings::btnShortConfirm,
|
||||
{StrId::STR_BTN_DEF_READER_MENU, BTN_ACT_OPTIONS}, "btnShortConfirm", StrId::STR_CAT_CONTROLS)
|
||||
{StrId::STR_BTN_DEF_READER_MENU}, "btnShortConfirm", StrId::STR_CAT_CONTROLS)
|
||||
.withSubmenu(StrId::STR_BTN_CONFIRM),
|
||||
SettingInfo::Enum(StrId::STR_BTN_DOUBLE_PRESS, &CrossPointSettings::btnDoubleConfirm,
|
||||
{StrId::STR_BTN_DEF_IGNORE, BTN_ACT_OPTIONS}, "btnDoubleConfirm", StrId::STR_CAT_CONTROLS)
|
||||
|
||||
Reference in New Issue
Block a user