feat: context-aware screenshot filenames with book title (#1589)
## Summary I love the new screenshot feature but I can tell that soon I'm gonna have a folder full of screenshots and not know what's what. It would be great if the folder could self organize. When a screenshot is taken while reading, the filename would now include the book title, chapter (EPUB), page number, and progress percentage. Example: My-Great-Book_ch3_p5_42pct_12345.bmp * **What is the goal of this PR?** (e.g., Implements the new feature for file uploading.) * **What changes are included?** ## Additional Context * Non-reader screens keep the existing screenshot-<millis>.bmp naming. --- ### AI Usage While CrossPoint doesn't have restrictions on AI tools in contributing, please be transparent about their usage as it helps set the right context for reviewers. Did you use AI tools to help write this code? _**< YES >**_ I reviewed all the changes but I don't have any experience with this project so this is my best guess
This commit is contained in:
@@ -546,3 +546,17 @@ void TxtReaderActivity::savePageIndexCache() const {
|
||||
|
||||
LOG_DBG("TRS", "Saved page index cache: %d pages", totalPages);
|
||||
}
|
||||
|
||||
ScreenshotInfo TxtReaderActivity::getScreenshotInfo() const {
|
||||
ScreenshotInfo info;
|
||||
info.readerType = ScreenshotInfo::ReaderType::Txt;
|
||||
if (txt) {
|
||||
const std::string t = txt->getTitle();
|
||||
snprintf(info.title, sizeof(info.title), "%s", t.c_str());
|
||||
}
|
||||
info.currentPage = currentPage + 1;
|
||||
info.totalPages = totalPages;
|
||||
info.progressPercent = totalPages > 0 ? static_cast<int>((currentPage + 1) * 100.0f / totalPages + 0.5f) : 0;
|
||||
if (info.progressPercent > 100) info.progressPercent = 100;
|
||||
return info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user