yaclf
This commit is contained in:
+8
-20
@@ -34,21 +34,13 @@
|
|||||||
// deep inside the heap allocator chain — enough stack to overflow the 8 KB loop task stack
|
// deep inside the heap allocator chain — enough stack to overflow the 8 KB loop task stack
|
||||||
// when called from inside SETTINGS.loadFromFile() at boot time.
|
// when called from inside SETTINGS.loadFromFile() at boot time.
|
||||||
namespace SettingsListDetail {
|
namespace SettingsListDetail {
|
||||||
inline uint8_t getKoReaderMatchMethod(const void*) {
|
inline uint8_t getKoReaderMatchMethod(const void*) { return static_cast<uint8_t>(KOREADER_STORE.getMatchMethod()); }
|
||||||
return static_cast<uint8_t>(KOREADER_STORE.getMatchMethod());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string getKoReaderServerUrl(void*) {
|
inline std::string getKoReaderServerUrl(void*) { return KOREADER_STORE.getServerUrl(); }
|
||||||
return KOREADER_STORE.getServerUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string getKoReaderUsername(void*) {
|
inline std::string getKoReaderUsername(void*) { return KOREADER_STORE.getUsername(); }
|
||||||
return KOREADER_STORE.getUsername();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline std::string getKoReaderPassword(void*) {
|
inline std::string getKoReaderPassword(void*) { return KOREADER_STORE.getPassword(); }
|
||||||
return KOREADER_STORE.getPassword();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const std::vector<SettingInfo> list = {
|
inline const std::vector<SettingInfo> list = {
|
||||||
// --- Display ---
|
// --- Display ---
|
||||||
@@ -167,24 +159,21 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
|
|
||||||
// --- KOReader Sync (web-only, uses KOReaderCredentialStore) ---
|
// --- KOReader Sync (web-only, uses KOReaderCredentialStore) ---
|
||||||
SettingInfo::DynamicString(
|
SettingInfo::DynamicString(
|
||||||
StrId::STR_SYNC_SERVER_URL,
|
StrId::STR_SYNC_SERVER_URL, static_cast<SettingInfo::StringGetterFn>(getKoReaderServerUrl),
|
||||||
static_cast<SettingInfo::StringGetterFn>(getKoReaderServerUrl),
|
|
||||||
[](void*, const std::string& v) {
|
[](void*, const std::string& v) {
|
||||||
KOREADER_STORE.setServerUrl(v);
|
KOREADER_STORE.setServerUrl(v);
|
||||||
KOREADER_STORE.saveToFile();
|
KOREADER_STORE.saveToFile();
|
||||||
},
|
},
|
||||||
"koServerUrl", StrId::STR_KOREADER_SYNC),
|
"koServerUrl", StrId::STR_KOREADER_SYNC),
|
||||||
SettingInfo::DynamicString(
|
SettingInfo::DynamicString(
|
||||||
StrId::STR_KOREADER_USERNAME,
|
StrId::STR_KOREADER_USERNAME, static_cast<SettingInfo::StringGetterFn>(getKoReaderUsername),
|
||||||
static_cast<SettingInfo::StringGetterFn>(getKoReaderUsername),
|
|
||||||
[](void*, const std::string& v) {
|
[](void*, const std::string& v) {
|
||||||
KOREADER_STORE.setCredentials(v, KOREADER_STORE.getPassword());
|
KOREADER_STORE.setCredentials(v, KOREADER_STORE.getPassword());
|
||||||
KOREADER_STORE.saveToFile();
|
KOREADER_STORE.saveToFile();
|
||||||
},
|
},
|
||||||
"koUsername", StrId::STR_KOREADER_SYNC),
|
"koUsername", StrId::STR_KOREADER_SYNC),
|
||||||
SettingInfo::DynamicString(
|
SettingInfo::DynamicString(
|
||||||
StrId::STR_KOREADER_PASSWORD,
|
StrId::STR_KOREADER_PASSWORD, static_cast<SettingInfo::StringGetterFn>(getKoReaderPassword),
|
||||||
static_cast<SettingInfo::StringGetterFn>(getKoReaderPassword),
|
|
||||||
[](void*, const std::string& v) {
|
[](void*, const std::string& v) {
|
||||||
KOREADER_STORE.setCredentials(KOREADER_STORE.getUsername(), v);
|
KOREADER_STORE.setCredentials(KOREADER_STORE.getUsername(), v);
|
||||||
KOREADER_STORE.saveToFile();
|
KOREADER_STORE.saveToFile();
|
||||||
@@ -192,8 +181,7 @@ inline const std::vector<SettingInfo> list = {
|
|||||||
"koPassword", StrId::STR_KOREADER_SYNC)
|
"koPassword", StrId::STR_KOREADER_SYNC)
|
||||||
.withObfuscated(),
|
.withObfuscated(),
|
||||||
SettingInfo::DynamicEnum(
|
SettingInfo::DynamicEnum(
|
||||||
StrId::STR_DOCUMENT_MATCHING, {StrId::STR_FILENAME, StrId::STR_BINARY},
|
StrId::STR_DOCUMENT_MATCHING, {StrId::STR_FILENAME, StrId::STR_BINARY}, getKoReaderMatchMethod,
|
||||||
getKoReaderMatchMethod,
|
|
||||||
[](void*, uint8_t v) {
|
[](void*, uint8_t v) {
|
||||||
KOREADER_STORE.setMatchMethod(static_cast<DocumentMatchMethod>(v));
|
KOREADER_STORE.setMatchMethod(static_cast<DocumentMatchMethod>(v));
|
||||||
KOREADER_STORE.saveToFile();
|
KOREADER_STORE.saveToFile();
|
||||||
|
|||||||
@@ -24,9 +24,10 @@ void KOReaderSettingsActivity::buildMenuItems() {
|
|||||||
menuItems.push_back(SettingInfo::Action(StrId::STR_PASSWORD, SettingAction::None));
|
menuItems.push_back(SettingInfo::Action(StrId::STR_PASSWORD, SettingAction::None));
|
||||||
|
|
||||||
// Document matching: DynamicEnum toggling between Filename and Binary
|
// Document matching: DynamicEnum toggling between Filename and Binary
|
||||||
menuItems.push_back(SettingInfo::DynamicEnum(
|
menuItems.push_back(SettingInfo::DynamicEnum(StrId::STR_DOCUMENT_MATCHING, {StrId::STR_FILENAME, StrId::STR_BINARY},
|
||||||
StrId::STR_DOCUMENT_MATCHING, {StrId::STR_FILENAME, StrId::STR_BINARY},
|
static_cast<SettingInfo::ValueGetterFn>([](const void*) -> uint8_t {
|
||||||
static_cast<SettingInfo::ValueGetterFn>([](const void*) -> uint8_t { return static_cast<uint8_t>(KOREADER_STORE.getMatchMethod()); }),
|
return static_cast<uint8_t>(KOREADER_STORE.getMatchMethod());
|
||||||
|
}),
|
||||||
[](void*, uint8_t v) {
|
[](void*, uint8_t v) {
|
||||||
KOREADER_STORE.setMatchMethod(static_cast<DocumentMatchMethod>(v));
|
KOREADER_STORE.setMatchMethod(static_cast<DocumentMatchMethod>(v));
|
||||||
KOREADER_STORE.saveToFile();
|
KOREADER_STORE.saveToFile();
|
||||||
|
|||||||
Reference in New Issue
Block a user