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
2.1 KiB
2.1 KiB
Implement Dictionary Word Lookup Feature (PR #857)
Task
Ported upstream PR #857 (dictionary word lookup feature) into the local codebase on mod/add-dictionary branch. Two adaptations were made:
-
Vector compatibility: PR #857 was written against upstream
masterwhich usedstd::listfor word storage. Our codebase already has PR #802 applied (list-to-vector). TheTextBlock.hgetters added by PR #857 were changed to returnconst std::vector<...>&instead ofconst std::list<...>&. -
Dictionary path tweak: Changed dictionary file lookup from SD card root (
/dictionary.idx,/dictionary.dict) to a/.dictionary/subfolder (/.dictionary/dictionary.idx,/.dictionary/dictionary.dict).
Changes Made
New files (10)
src/util/Dictionary.h/.cpp-- StarDict 3 format dictionary lookup (sparse index + binary search)src/util/LookupHistory.h/.cpp-- Per-book lookup history stored in book cache dirsrc/activities/reader/DictionaryDefinitionActivity.h/.cpp-- Definition display with paginationsrc/activities/reader/DictionaryWordSelectActivity.h/.cpp-- Word selection from current page with orientation-aware navigationsrc/activities/reader/LookedUpWordsActivity.h/.cpp-- Lookup history browser with long-press delete
Modified files (5)
lib/Epub/Epub/blocks/TextBlock.h-- AddedgetWords(),getWordXpos(),getWordStyles()accessors (returningstd::vector)lib/Epub/Epub/Page.h-- AddedgetBlock()accessor toPageLinesrc/activities/reader/EpubReaderMenuActivity.h-- AddedLOOKUP/LOOKED_UP_WORDSenum values,hasDictionaryconstructor param, dynamicbuildMenuItems()src/activities/reader/EpubReaderActivity.h-- Added includes for new activity headerssrc/activities/reader/EpubReaderActivity.cpp-- Added includes,Dictionary::exists()check,LOOKUPandLOOKED_UP_WORDScase handling
Follow-up Items
- Dictionary files (
dictionary.idx,dictionary.dict,dictionary.ifo) must be placed in/.dictionary/folder on the SD card root - Menu items "Lookup" and "Lookup History" only appear when dictionary files are detected