Add end of book actions screen

This commit is contained in:
jpirnay
2026-05-12 18:11:55 +02:00
parent 8d2cfb17a7
commit a91c151979
13 changed files with 1116 additions and 15 deletions
+39 -1
View File
@@ -13,6 +13,7 @@
#include "CrossPointSettings.h"
#include "CrossPointState.h"
#include "FinishedBookActivity.h"
#include "MappedInputManager.h"
#include "MdReaderTocSelectionActivity.h"
#include "ReaderActivity.h"
@@ -276,7 +277,44 @@ void MdReaderActivity::loop() {
currentHeadingIndex = getHeadingIndexForOffset(pageOffsets[currentPage]);
requestUpdate();
} else {
onGoHome();
saveProgress();
const std::string currentBookPath = txt ? txt->getPath() : std::string();
const std::string nextBookPath =
BookFinished::findNextBookInDirectory(currentBookPath, std::string(), std::string());
startActivityForResult(
std::make_unique<FinishedBookActivity>(renderer, mappedInput, currentBookPath, nextBookPath,
SETTINGS.moveFinishedBooksToCompleted),
[this, currentBookPath, nextBookPath](const ActivityResult& result) {
if (result.isCancelled) {
requestUpdate();
return;
}
const auto& menuResult = std::get<MenuResult>(result.data);
if (menuResult.action == static_cast<int>(BookFinished::FinishedBookAction::GoHome)) {
if (SETTINGS.moveFinishedBooksToCompleted) {
std::string movedPath;
BookFinished::moveFinishedBookToCompleted(currentBookPath, movedPath);
}
if (SETTINGS.removeFinishedBooksFromRecents) {
RECENT_BOOKS.removeBook(currentBookPath);
}
activityManager.goHome();
return;
}
if (menuResult.action == static_cast<int>(BookFinished::FinishedBookAction::OpenNextBook) &&
!nextBookPath.empty()) {
if (SETTINGS.moveFinishedBooksToCompleted) {
std::string movedPath;
BookFinished::moveFinishedBookToCompleted(currentBookPath, movedPath);
}
if (SETTINGS.removeFinishedBooksFromRecents) {
RECENT_BOOKS.removeBook(currentBookPath);
}
activityManager.goToReader(nextBookPath);
return;
}
requestUpdate();
});
}
return;
}