mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration
Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch: Activities (migrated to new ActivityManager pattern): - Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity - Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity, DictionaryWordSelectActivity, LookedUpWordsActivity - Bookmark: EpubReaderBookmarkSelectionActivity - Book management: BookManageMenuActivity, EndOfBookMenuActivity - OPDS: OpdsServerListActivity, OpdsSettingsActivity - Utility: DirectoryPickerActivity, NumericStepperActivity Utilities (unchanged): - BookManager, BookSettings, BookmarkStore, BootNtpSync - Dictionary, LookupHistory, TimeSync, OpdsServerStore Libraries: PlaceholderCover, TableData, ChapterXPathIndexer Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover Docs: KOReader sync XPath mapping Migration changes: - ActivityWithSubactivity -> Activity base class - Callback constructors -> finish()/setResult() pattern - enterNewActivity() -> startActivityForResult() - Activity::RenderLock&& -> RenderLock&& These files won't compile yet - they reference mod settings and I18n strings that will be added in subsequent phases. Made-with: Cursor
This commit is contained in:
31
src/util/BookSettings.h
Normal file
31
src/util/BookSettings.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
|
||||
#include "CrossPointSettings.h"
|
||||
|
||||
// Per-book settings stored in the book's cache directory.
|
||||
// Fields default to sentinel values (0xFF) meaning "use global setting".
|
||||
class BookSettings {
|
||||
public:
|
||||
// 0xFF = use global default; otherwise one of SLEEP_SCREEN_LETTERBOX_FILL values (0-2).
|
||||
uint8_t letterboxFillOverride = USE_GLOBAL;
|
||||
|
||||
static constexpr uint8_t USE_GLOBAL = 0xFF;
|
||||
|
||||
// Returns the effective letterbox fill mode: the per-book override if set,
|
||||
// otherwise the global setting from CrossPointSettings.
|
||||
uint8_t getEffectiveLetterboxFill() const {
|
||||
if (letterboxFillOverride != USE_GLOBAL &&
|
||||
letterboxFillOverride < CrossPointSettings::SLEEP_SCREEN_LETTERBOX_FILL_COUNT) {
|
||||
return letterboxFillOverride;
|
||||
}
|
||||
return SETTINGS.sleepScreenLetterboxFill;
|
||||
}
|
||||
|
||||
static BookSettings load(const std::string& cachePath);
|
||||
static bool save(const std::string& cachePath, const BookSettings& settings);
|
||||
|
||||
private:
|
||||
static std::string filePath(const std::string& cachePath);
|
||||
};
|
||||
Reference in New Issue
Block a user