Esempio n. 1
0
void plPageInfo::write(hsStream* S) {
    if (S->getVer().isUniversal()) {
        S->writeShort(-1);
        fLocation.write(S);
        S->writeSafeStr(fAge);
        S->writeSafeStr(fPage);
        S->writeInt(fFlags);
    } else if (S->getVer().isEoa()) {
        S->writeShort(6);
        S->writeShort(fClassList.size());
        for (size_t i=0; i<fClassList.size(); i++) {
            S->writeShort(pdUnifiedTypeMap::MappedToPlasma(fClassList[i], S->getVer()));
            S->writeShort(pdUnifiedTypeMap::ClassVersion(fClassList[i], S->getVer()));
        }
        fLocation.write(S);
        S->writeSafeStr(getAge());
        S->writeSafeStr(getPage());
    } else if (S->getVer().isHexIsle()) {
        S->writeShort(9);
        S->writeShort(fClassList.size());
        for (size_t i=0; i<fClassList.size(); i++) {
            S->writeShort(pdUnifiedTypeMap::MappedToPlasma(fClassList[i], S->getVer()));
            S->writeShort(pdUnifiedTypeMap::ClassVersion(fClassList[i], S->getVer()));
        }
        fLocation.write(S);
        S->writeSafeStr(getAge());
        S->writeSafeStr(getPage());
    } else if (S->getVer().isMoul()) {
        S->writeInt(6);
        fLocation.write(S);
        S->writeSafeStr(getAge());
        S->writeSafeStr(getPage());
        S->writeShort(70);
    } else {
        S->writeInt(5);
        fLocation.write(S);
        S->writeSafeStr(getAge());
        S->writeSafeStr(getChapter());
        S->writeSafeStr(getPage());
        S->writeShort(63);
        S->writeShort(S->getVer().revMinor());
        S->writeInt(fReleaseVersion);
        S->writeInt(fFlags);
    }
    S->writeInt(fChecksum);
    S->writeInt(fDataStart);
    S->writeInt(fIdxStart);

    if (S->getVer().isMoul()) {
        S->writeShort(fClassList.size());
        for (size_t i=0; i<fClassList.size(); i++) {
            S->writeShort(pdUnifiedTypeMap::MappedToPlasma(fClassList[i], S->getVer()));
            S->writeShort(pdUnifiedTypeMap::ClassVersion(fClassList[i], S->getVer()));
        }
    }
}
Esempio n. 2
0
void YVCache::getNextChapter() {
    ++s_chapIdx;
    if (s_chapIdx > qobject_cast<BookNode*>(s_translation->books()[s_bookIdx])->chapters()) { // recall that it's 1-indexed
        getNextBook();

        return;

    }

    emit status("Caching " + QString::fromUtf8(yvGetBookName(s_idx, s_bookIdx).toLatin1().data()) + " Chapter " +QString::number(s_chapIdx) + "...");
    m_reply = m_nm->get(QNetworkRequest(QUrl::fromPercentEncoding(QString("https://www.youversion.com/bible/"+QString::number(yvVersionIds[s_translation->idx()])+"/"+yvGetBookAbbrev(s_idx, s_bookIdx)+"."+QString::number(s_chapIdx)+".json").toLatin1())));
    connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(failure()));
    connect(m_reply, SIGNAL(finished()), this, SLOT(getChapter()));
}
Esempio n. 3
0
void OMXReader::getChapterName(std::string& strChapterName)
{
    strChapterName = "";
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,14,0)
    int chapterIdx = getChapter();
    if(chapterIdx <= 0)
        return;
#if LIBAVFORMAT_VERSION_INT >= AV_VERSION_INT(52,83,0)
    // API added on: 2010-10-15
    // (Note that while the function was available earlier, the generic
    // metadata tags were not populated by default)
    AVDictionaryEntry *titleTag = av_dict_get(avFormatContext->chapters[chapterIdx-1]->metadata,
                                              "title", NULL, 0);
    if (titleTag)
        strChapterName = titleTag->value;
#else
    if (avFormatContext->chapters[chapterIdx-1]->title)
        strChapterName = avFormatContext->chapters[chapterIdx-1]->title;
#endif
#endif
}