Add chapter select support to XTC files (#145)
## Summary - **What is the goal of this PR?** Add chapter selection support to the XTC reader activity, including parsing chapter metadata from XTC files. - **What changes are included?** Implemented XTC chapter parsing and exposure in the XTC library, added a chapter selection activity for XTC, integrated it into XtcReaderActivity, and normalized chapter page indices by shifting them to 0-based. ## Additional Context - The reader uses 0-based page indexing (first page = 0), but the XTC chapter table appears to be 1-based (first page = 1), so chapter start/end pages are shifted down by 1 during parsing.
This commit is contained in:
@@ -87,6 +87,21 @@ std::string Xtc::getTitle() const {
|
||||
return filepath.substr(lastSlash, lastDot - lastSlash);
|
||||
}
|
||||
|
||||
bool Xtc::hasChapters() const {
|
||||
if (!loaded || !parser) {
|
||||
return false;
|
||||
}
|
||||
return parser->hasChapters();
|
||||
}
|
||||
|
||||
const std::vector<xtc::ChapterInfo>& Xtc::getChapters() const {
|
||||
static const std::vector<xtc::ChapterInfo> kEmpty;
|
||||
if (!loaded || !parser) {
|
||||
return kEmpty;
|
||||
}
|
||||
return parser->getChapters();
|
||||
}
|
||||
|
||||
std::string Xtc::getCoverBmpPath() const { return cachePath + "/cover.bmp"; }
|
||||
|
||||
bool Xtc::generateCoverBmp() const {
|
||||
|
||||
Reference in New Issue
Block a user