feat: add setting that allows removing books from recent list when read (#2043)
This commit is contained in:
@@ -268,6 +268,7 @@ STR_IMAGES_DISPLAY: "Паказваць"
|
||||
STR_IMAGES_PLACEHOLDER: "Запаўняльнік"
|
||||
STR_IMAGES_SUPPRESS: "Хаваць"
|
||||
STR_SHOW_HIDDEN_FILES: "Паказваць схаваныя файлы"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Ачышчаць прачытаныя кнігі са спісу нядаўніх"
|
||||
STR_MOVE_FINISHED_TO_READ: "Перамяшчаць прачытаныя кнігі ў тэчку Read"
|
||||
STR_SELECTED: "Выбрана"
|
||||
STR_SHOW: "Паказаць"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Alineació de paràgrafs del lector"
|
||||
STR_HYPHENATION: "Partició de mots"
|
||||
STR_TIME_TO_SLEEP: "Temps per entrar en repòs"
|
||||
STR_SHOW_HIDDEN_FILES: "Mostra fitxers ocults"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Esborra els llibres llegits de la llista de recents"
|
||||
STR_MOVE_FINISHED_TO_READ: "Mou els llibres acabats a la carpeta Read"
|
||||
STR_REFRESH_FREQ: "Freqüència de refresc"
|
||||
STR_KOREADER_SYNC: "Sincronització del KOReader"
|
||||
|
||||
@@ -80,6 +80,7 @@ STR_SCREEN_MARGIN: "Okraj obrazovky čtečky"
|
||||
STR_PARA_ALIGNMENT: "Zarovnání odstavců čtečky"
|
||||
STR_HYPHENATION: "Dělení slov"
|
||||
STR_TIME_TO_SLEEP: "Čas do uspání"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Vymazat přečtené knihy ze seznamu nedávných"
|
||||
STR_MOVE_FINISHED_TO_READ: "Přesunout přečtené knihy do složky Read"
|
||||
STR_REFRESH_FREQ: "Frekvence obnovení"
|
||||
STR_KOREADER_SYNC: "KOReaderu Sync"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Afsnitsjustering"
|
||||
STR_HYPHENATION: "Orddeling"
|
||||
STR_TIME_TO_SLEEP: "Tid til hvile"
|
||||
STR_SHOW_HIDDEN_FILES: "Vis skjulte filer"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Ryd læste bøger fra listen Seneste"
|
||||
STR_MOVE_FINISHED_TO_READ: "Flyt læste bøger til Read-mappen"
|
||||
STR_REFRESH_FREQ: "Opdateringsfrekvens"
|
||||
STR_KOREADER_SYNC: "KOReader Sync"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Uitlijning alinea lezer"
|
||||
STR_HYPHENATION: "Woordafbreking"
|
||||
STR_TIME_TO_SLEEP: "Tijd tot slaapstand"
|
||||
STR_SHOW_HIDDEN_FILES: "Toon verborgen bestanden"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Gelezen boeken wissen uit de lijst Recent"
|
||||
STR_MOVE_FINISHED_TO_READ: "Voltooide boeken naar de Read-map verplaatsen"
|
||||
STR_REFRESH_FREQ: "Verversingsfrequentie"
|
||||
STR_KOREADER_SYNC: "KOReader Sync"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Reader Paragraph Alignment"
|
||||
STR_HYPHENATION: "Hyphenation"
|
||||
STR_TIME_TO_SLEEP: "Time to Sleep"
|
||||
STR_SHOW_HIDDEN_FILES: "Show Hidden Files"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Clear Read Books from Recent List"
|
||||
STR_MOVE_FINISHED_TO_READ: "Move Finished Books to Read Folder"
|
||||
STR_REFRESH_FREQ: "Refresh Frequency"
|
||||
STR_KOREADER_SYNC: "KOReader Sync"
|
||||
|
||||
@@ -80,6 +80,7 @@ STR_SCREEN_MARGIN: "Lukijan näyttömarginaali"
|
||||
STR_PARA_ALIGNMENT: "Lukijan kappaletasaus"
|
||||
STR_HYPHENATION: "Tavutus"
|
||||
STR_TIME_TO_SLEEP: "Aika lepotilaan"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Tyhjennä luetut kirjat viimeisimpien listalta"
|
||||
STR_MOVE_FINISHED_TO_READ: "Siirrä luetut kirjat Read-kansioon"
|
||||
STR_REFRESH_FREQ: "Päivitystaajuus"
|
||||
STR_KOREADER_SYNC: "KOReader-synkronointi"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Alignement du texte"
|
||||
STR_HYPHENATION: "Césure"
|
||||
STR_TIME_TO_SLEEP: "Mise en veille auto"
|
||||
STR_SHOW_HIDDEN_FILES: "Afficher les fichiers cachés"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Effacer les livres lus de la liste des récents"
|
||||
STR_MOVE_FINISHED_TO_READ: "Déplacer les livres terminés vers le dossier Read"
|
||||
STR_REFRESH_FREQ: "Fréquence rafraîchissement"
|
||||
STR_KOREADER_SYNC: "Synchro KOReader"
|
||||
|
||||
@@ -303,6 +303,7 @@ STR_IMAGES_DISPLAY: "Darstellung"
|
||||
STR_IMAGES_PLACEHOLDER: "Platzhalter"
|
||||
STR_IMAGES_SUPPRESS: "Unterdrücken"
|
||||
STR_SHOW_HIDDEN_FILES: "Versteckte Dateien anzeigen"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Gelesene Bücher aus der Zuletzt-Liste löschen"
|
||||
STR_MOVE_FINISHED_TO_READ: "Gelesene Bücher in den Read-Ordner verschieben"
|
||||
STR_PAGE_OVERLAY: "Seiten-Overlay"
|
||||
STR_RECENTS: "Zuletzt"
|
||||
|
||||
@@ -82,6 +82,7 @@ STR_PARA_ALIGNMENT: "Olvasó szövegigazítás"
|
||||
STR_HYPHENATION: "Elválasztás"
|
||||
STR_TIME_TO_SLEEP: "Alvó mód aktiválása"
|
||||
STR_SHOW_HIDDEN_FILES: "Rejtett fájlok megjelenítése"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Olvasott könyvek törlése a legutóbbiak listájáról"
|
||||
STR_MOVE_FINISHED_TO_READ: "Befejezett könyvek áthelyezése a Read mappába"
|
||||
STR_REFRESH_FREQ: "Frissítési frekvencia"
|
||||
STR_KOREADER_SYNC: "KOReader szinkronizálás"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Allineamento paragrafo"
|
||||
STR_HYPHENATION: "Sillabazione"
|
||||
STR_TIME_TO_SLEEP: "Timeout sospensione"
|
||||
STR_SHOW_HIDDEN_FILES: "Mostra file nascosti"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Cancella i libri letti dall'elenco dei recenti"
|
||||
STR_MOVE_FINISHED_TO_READ: "Sposta i libri finiti nella cartella Read"
|
||||
STR_REFRESH_FREQ: "Frequenza di aggiornamento"
|
||||
STR_KOREADER_SYNC: "Sincronizzazione KOReader"
|
||||
|
||||
@@ -76,6 +76,7 @@ STR_SCREEN_MARGIN: "Оқырман экран жиегі"
|
||||
STR_PARA_ALIGNMENT: "Оқырман абзац туралануы"
|
||||
STR_HYPHENATION: "Буын бөлу"
|
||||
STR_TIME_TO_SLEEP: "Ұйқы уақыты"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Оқылған кітаптарды соңғылар тізімінен тазалау"
|
||||
STR_MOVE_FINISHED_TO_READ: "Оқылған кітаптарды Read қалтасына жылжыту"
|
||||
STR_REFRESH_FREQ: "Жаңарту жиілігі"
|
||||
STR_KOREADER_SYNC: "KOReader синхронизациясы"
|
||||
|
||||
@@ -82,6 +82,7 @@ STR_PARA_ALIGNMENT: "Lygiavimas"
|
||||
STR_HYPHENATION: "Skiemenuoti"
|
||||
STR_TIME_TO_SLEEP: "Užmigti po"
|
||||
STR_SHOW_HIDDEN_FILES: "Rod. paslėptus failus"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Išvalyti perskaitytas knygas iš paskutinių sąrašo"
|
||||
STR_MOVE_FINISHED_TO_READ: "Perkelti perskaitytas knygas į aplanką Read"
|
||||
STR_REFRESH_FREQ: "Atnaujinimo dažnis"
|
||||
STR_KOREADER_SYNC: "KOReader sinchr."
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Wyjustowanie paragrafów"
|
||||
STR_HYPHENATION: "Dzielenie wyrazów"
|
||||
STR_TIME_TO_SLEEP: "Czas do uśpienia"
|
||||
STR_SHOW_HIDDEN_FILES: "Pokaż ukryte pliki"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Wyczyść przeczytane książki z listy ostatnich"
|
||||
STR_MOVE_FINISHED_TO_READ: "Przenoś przeczytane książki do folderu Read"
|
||||
STR_REFRESH_FREQ: "Częstotliwość odświeżania"
|
||||
STR_KOREADER_SYNC: "KOReader Sync"
|
||||
|
||||
@@ -80,6 +80,7 @@ STR_SCREEN_MARGIN: "Margens da tela"
|
||||
STR_PARA_ALIGNMENT: "Alinhamento parágrafo"
|
||||
STR_HYPHENATION: "Hifenização"
|
||||
STR_TIME_TO_SLEEP: "Tempo para repousar"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Limpar livros lidos da lista de recentes"
|
||||
STR_MOVE_FINISHED_TO_READ: "Mover livros lidos para a pasta Read"
|
||||
STR_REFRESH_FREQ: "Frequência atualização"
|
||||
STR_KOREADER_SYNC: "Sincronização KOReader"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Aliniere paragrafe reader"
|
||||
STR_HYPHENATION: "Silabisire"
|
||||
STR_TIME_TO_SLEEP: "Timp până la repaus"
|
||||
STR_SHOW_HIDDEN_FILES: "Afişează fişierele ascunse"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Șterge cărțile citite din lista de recente"
|
||||
STR_MOVE_FINISHED_TO_READ: "Mută cărţile terminate în folderul Read"
|
||||
STR_REFRESH_FREQ: "Frecvenţă reîmprospătare"
|
||||
STR_KOREADER_SYNC: "Sincronizare KOReader"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Выравнивание абзаца"
|
||||
STR_HYPHENATION: "Перенос слов"
|
||||
STR_TIME_TO_SLEEP: "Сон через"
|
||||
STR_SHOW_HIDDEN_FILES: "Показать скрытые файлы"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Очищать прочитанные книги из списка недавних"
|
||||
STR_MOVE_FINISHED_TO_READ: "Перемещать прочитанные книги в папку Read"
|
||||
STR_REFRESH_FREQ: "Частота обновления"
|
||||
STR_KOREADER_SYNC: "Синхронизация KOReader"
|
||||
|
||||
@@ -82,6 +82,7 @@ STR_PARA_ALIGNMENT: "Poravnava odstavkov"
|
||||
STR_HYPHENATION: "Deljenje besed"
|
||||
STR_TIME_TO_SLEEP: "Čas do spanja"
|
||||
STR_SHOW_HIDDEN_FILES: "Prikaži skrite datoteke"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Počisti prebrane knjige s seznama nedavnih"
|
||||
STR_MOVE_FINISHED_TO_READ: "Premakni prebrane knjige v mapo Read"
|
||||
STR_REFRESH_FREQ: "Pogostost osveževanja"
|
||||
STR_KOREADER_SYNC: "KOReader sinhronizacija"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Ajuste de párrafo"
|
||||
STR_HYPHENATION: "División de palabras"
|
||||
STR_TIME_TO_SLEEP: "Auto suspensión"
|
||||
STR_SHOW_HIDDEN_FILES: "Mostrar archivos ocultos"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Borrar libros leídos de la lista de recientes"
|
||||
STR_MOVE_FINISHED_TO_READ: "Mover libros terminados a la carpeta Read"
|
||||
STR_REFRESH_FREQ: "Frecuencia de refresco"
|
||||
STR_KOREADER_SYNC: "Sincronización de KOReader"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Eboksläsarens paragrafjustering"
|
||||
STR_HYPHENATION: "Avstavning"
|
||||
STR_TIME_TO_SLEEP: "Tid för att gå i vila"
|
||||
STR_SHOW_HIDDEN_FILES: "Visa dolda filer"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Rensa lästa böcker från listan Senaste"
|
||||
STR_MOVE_FINISHED_TO_READ: "Flytta lästa böcker till Read-mappen"
|
||||
STR_REFRESH_FREQ: "Uppdateringsfrekvens"
|
||||
STR_KOREADER_SYNC: "KOReader-synkronisering"
|
||||
|
||||
@@ -80,6 +80,7 @@ STR_PARA_ALIGNMENT: "Okuyucu Paragraf Hizalaması"
|
||||
STR_HYPHENATION: "Hecelerden Ayırma"
|
||||
STR_TIME_TO_SLEEP: "Uykuya Geçme Süresi"
|
||||
STR_SHOW_HIDDEN_FILES: "Gizli Dosyaları Göster"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Okunan kitapları Son listesinden temizle"
|
||||
STR_MOVE_FINISHED_TO_READ: "Biten kitapları Read klasörüne taşı"
|
||||
STR_REFRESH_FREQ: "Yenileme Sıklığı"
|
||||
STR_KOREADER_SYNC: "KOReader Senkronizasyonu"
|
||||
|
||||
@@ -85,6 +85,7 @@ STR_PARA_ALIGNMENT: "Вирівнювання тексту"
|
||||
STR_HYPHENATION: "Перенесення слів"
|
||||
STR_TIME_TO_SLEEP: "Перехід в режим сну"
|
||||
STR_SHOW_HIDDEN_FILES: "Показати приховані файли"
|
||||
STR_REMOVE_READ_FROM_RECENTS: "Очищати прочитані книги зі списку останніх"
|
||||
STR_MOVE_FINISHED_TO_READ: "Переміщати прочитані книги до теки Read"
|
||||
STR_REFRESH_FREQ: "Частота оновлення екрану"
|
||||
STR_KOREADER_SYNC: "Синхронізація KOReader"
|
||||
|
||||
@@ -231,6 +231,8 @@ class CrossPointSettings {
|
||||
char sdFontFamilyName[32] = "";
|
||||
// Show hidden files/directories (starting with '.') in the file browser (0 = hidden, 1 = show)
|
||||
uint8_t showHiddenFiles = 0;
|
||||
// Remove a book from the Recent Books list when its End-of-Book screen is reached (0 = off, 1 = on)
|
||||
uint8_t removeReadBooksFromRecents = 0;
|
||||
// Move epub to /Read/ folder on SD card when finished (0 = disabled, 1 = enabled)
|
||||
uint8_t moveFinishedToReadFolder = 0;
|
||||
// Image rendering mode in EPUB reader
|
||||
|
||||
@@ -56,6 +56,21 @@ void RecentBooksStore::updateBook(const std::string& path, const std::string& ti
|
||||
}
|
||||
}
|
||||
|
||||
bool RecentBooksStore::removeByPath(const std::string& path) {
|
||||
auto it =
|
||||
std::find_if(recentBooks.begin(), recentBooks.end(), [&](const RecentBook& book) { return book.path == path; });
|
||||
if (it == recentBooks.end()) {
|
||||
return false;
|
||||
}
|
||||
recentBooks.erase(it);
|
||||
if (!saveToFile()) {
|
||||
// In-memory removal succeeded; persistence is best-effort here (consistent with
|
||||
// addBook/updateBook). Log the failure but still report the entry as removed.
|
||||
LOG_ERR("RBS", "Failed to persist removal of recent book: %s", path.c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void RecentBooksStore::updatePath(const std::string& oldPath, const std::string& newPath,
|
||||
const std::string& oldCachePath, const std::string& newCachePath) {
|
||||
auto it = std::find_if(recentBooks.begin(), recentBooks.end(),
|
||||
|
||||
@@ -37,6 +37,11 @@ class RecentBooksStore {
|
||||
void updateBook(const std::string& path, const std::string& title, const std::string& author,
|
||||
const std::string& coverBmpPath);
|
||||
|
||||
// Remove the entry whose path matches (used when a book is finished/read).
|
||||
// Returns true if an entry was found and removed (no-op + false otherwise).
|
||||
// Persistence is best-effort: a failed save is logged, not reflected in the return.
|
||||
bool removeByPath(const std::string& path);
|
||||
|
||||
// Repoint an entry's path (and coverBmpPath, if it lived under the old cache dir) after the
|
||||
// backing file and cache dir were moved on disk. No-op if no entry matches oldPath.
|
||||
// Persists on success. Keeps the entry's list position (does not reorder).
|
||||
|
||||
@@ -178,6 +178,8 @@ inline std::vector<SettingInfo> getSettingsList(const SdCardFontRegistry* regist
|
||||
"sleepTimeout", StrId::STR_CAT_SYSTEM),
|
||||
SettingInfo::Toggle(StrId::STR_SHOW_HIDDEN_FILES, &CrossPointSettings::showHiddenFiles, "showHiddenFiles",
|
||||
StrId::STR_CAT_SYSTEM),
|
||||
SettingInfo::Toggle(StrId::STR_REMOVE_READ_FROM_RECENTS, &CrossPointSettings::removeReadBooksFromRecents,
|
||||
"removeReadBooksFromRecents", StrId::STR_CAT_SYSTEM),
|
||||
SettingInfo::Toggle(StrId::STR_MOVE_FINISHED_TO_READ, &CrossPointSettings::moveFinishedToReadFolder,
|
||||
"moveFinishedToReadFolder", StrId::STR_CAT_SYSTEM),
|
||||
|
||||
|
||||
@@ -190,10 +190,30 @@ void EpubReaderActivity::loop() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Being on the "End of Book" screen (currentSpineIndex == spine count) means the book is
|
||||
// finished. Arm the move here so ANY exit path (Back, Home, file browser) relocates the
|
||||
// book in onExit(); paging back off the end screen disarms it (book not actually finished).
|
||||
if (currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount()) {
|
||||
// End-of-Book screen reached (currentSpineIndex == spine count) means the book is
|
||||
// finished. Two independent finished-book features key off this same condition.
|
||||
const bool atEndOfBook = currentSpineIndex > 0 && currentSpineIndex >= epub->getSpineItemsCount();
|
||||
|
||||
// Drop this book from the Recent Books list; if the reader then pages back into the book,
|
||||
// re-add it. So removal only sticks if the reader leaves while still on the End-of-Book
|
||||
// screen. Acts only on the transition (guarded by recentsEntryRemoved) — no per-frame writes.
|
||||
if (SETTINGS.removeReadBooksFromRecents) {
|
||||
if (atEndOfBook && !recentsEntryRemoved) {
|
||||
// Only treat the book as "removed by us" if it was actually in the list, so the
|
||||
// re-add branch below doesn't insert a book the feature never removed.
|
||||
recentsEntryRemoved = RECENT_BOOKS.removeByPath(epub->getPath());
|
||||
} else if (!atEndOfBook && recentsEntryRemoved) {
|
||||
// Re-add (goes to front of the list via addBook — accepted ordering side effect).
|
||||
RECENT_BOOKS.addBook(epub->getPath(), epub->getTitle(), epub->getAuthor(), epub->getThumbBmpPath());
|
||||
recentsEntryRemoved = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Arm the move here so ANY exit path (Back, Home, file browser) relocates the book into
|
||||
// /Read/ in onExit(); paging back off the end screen disarms it (book not actually
|
||||
// finished). If removeReadBooksFromRecents also fired, RecentBooksStore::updatePath in the
|
||||
// move path becomes a safe no-op since the entry was already removed.
|
||||
if (atEndOfBook) {
|
||||
pendingReadFolderMove = SETTINGS.moveFinishedToReadFolder && !isInReadFolder(epub->getPath());
|
||||
} else {
|
||||
pendingReadFolderMove = false;
|
||||
|
||||
@@ -31,6 +31,9 @@ class EpubReaderActivity final : public Activity {
|
||||
bool pendingSyncSaveError = false;
|
||||
bool skipNextButtonCheck = false; // Skip button processing for one frame after subactivity exit
|
||||
bool automaticPageTurnActive = false;
|
||||
// Tracks whether this book is currently removed from Recent Books by the
|
||||
// removeReadBooksFromRecents feature (set at End-of-Book, cleared if paged back in).
|
||||
bool recentsEntryRemoved = false;
|
||||
// Set when the reader is left at end-of-book and SETTINGS.moveFinishedToReadFolder is on.
|
||||
// Consumed in onExit() to relocate the finished book into /Read/.
|
||||
bool pendingReadFolderMove = false;
|
||||
|
||||
Reference in New Issue
Block a user