Add RE command to TTI file handling

This commit is contained in:
Gavin MacGregor
2025-03-02 23:01:33 +00:00
parent c9b797cff4
commit 564243822e
3 changed files with 12 additions and 4 deletions

View File

@@ -79,6 +79,12 @@ bool LoadTTIFormat::load(QFile *inFile, TeletextDocument *document)
loadingPage->setDefaultNOS(((pageStatusRead & 0x0200) >> 9) | ((pageStatusRead & 0x0100) >> 7) | ((pageStatusRead & 0x0080) >> 5));
}
}
if (inLine.startsWith("RE,")) {
bool regionValueOk;
int regionValueRead = inLine.remove(0, 3).toInt(&regionValueOk);
if (regionValueOk)
loadingPage->setDefaultCharSet(regionValueRead);
}
if (inLine.startsWith("CT,") && (inLine.endsWith(",C") || inLine.endsWith(",T"))) {
bool cycleValueOk;
int cycleValueRead = inLine.mid(3, inLine.size()-5).toInt(&cycleValueOk);

View File

@@ -190,10 +190,12 @@ void SaveTTIFormat::writeSubPageStart(const PageBase &subPage, int subPageNumber
writeString(QString("PS,%1").arg(0x8000 | statusBits, 4, 16, QChar('0')));
if (m_document->pageFunction() == TeletextDocument::PFLevelOnePage)
if (m_document->pageFunction() == TeletextDocument::PFLevelOnePage) {
// Level One Page: page region and cycle
writeString(QString("RE,%1").arg(static_cast<const LevelOnePage *>(&subPage)->defaultCharSet()));
writeString(QString("CT,%1,%2").arg(static_cast<const LevelOnePage *>(&subPage)->cycleValue()).arg(static_cast<const LevelOnePage *>(&subPage)->cycleType()==LevelOnePage::CTcycles ? 'C' : 'T'));
else
// X/28/0 specifies page function and coding but the PF command
} else
// Not a Level One Page: X/28/0 specifies page function and coding but the PF command
// should make it obvious to a human that this is not a Level One Page
writeString(QString("PF,%1,%2").arg(m_document->pageFunction()).arg(m_document->packetCoding()));
}