Add enum representing page Control Bits
This commit is contained in:
@@ -99,8 +99,8 @@ void TeletextDocument::loadDocument(QFile *inFile)
|
|||||||
bool pageStatusOk;
|
bool pageStatusOk;
|
||||||
int pageStatusRead = inLine.mid(3, 4).toInt(&pageStatusOk, 16);
|
int pageStatusRead = inLine.mid(3, 4).toInt(&pageStatusOk, 16);
|
||||||
if (pageStatusOk) {
|
if (pageStatusOk) {
|
||||||
loadingPage->setControlBit(0, pageStatusRead & 0x4000);
|
loadingPage->setControlBit(PageBase::C4ErasePage, pageStatusRead & 0x4000);
|
||||||
for (int i=1, pageStatusBit=0x0001; i<8; i++, pageStatusBit<<=1)
|
for (int i=PageBase::C5Newsflash, pageStatusBit=0x0001; i<=PageBase::C11SerialMagazine; i++, pageStatusBit<<=1)
|
||||||
loadingPage->setControlBit(i, pageStatusRead & pageStatusBit);
|
loadingPage->setControlBit(i, pageStatusRead & pageStatusBit);
|
||||||
loadingPage->setDefaultNOS(((pageStatusRead & 0x0200) >> 9) | ((pageStatusRead & 0x0100) >> 7) | ((pageStatusRead & 0x0080) >> 5));
|
loadingPage->setDefaultNOS(((pageStatusRead & 0x0200) >> 9) | ((pageStatusRead & 0x0100) >> 7) | ((pageStatusRead & 0x0080) >> 5));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ LevelOnePage::LevelOnePage(const PageBase &other)
|
|||||||
localEnhance.reserve(208);
|
localEnhance.reserve(208);
|
||||||
clearPage();
|
clearPage();
|
||||||
|
|
||||||
for (int i=0; i<8; i++)
|
for (int i=PageBase::C4ErasePage; i<=PageBase::C11SerialMagazine; i++)
|
||||||
setControlBit(i, other.controlBit(i));
|
setControlBit(i, other.controlBit(i));
|
||||||
for (int i=0; i<90; i++)
|
for (int i=0; i<90; i++)
|
||||||
if (other.packetNeededArrayIndex(i))
|
if (other.packetNeededArrayIndex(i))
|
||||||
@@ -426,8 +426,8 @@ void LevelOnePage::savePage(QTextStream *outStream, int pageNumber, int subPageN
|
|||||||
int LevelOnePage::controlBitsToPS() const
|
int LevelOnePage::controlBitsToPS() const
|
||||||
{
|
{
|
||||||
//TODO map page language for regions other than 0
|
//TODO map page language for regions other than 0
|
||||||
int pageStatus = 0x8000 | (controlBit(0) << 14) | ((m_defaultNOS & 1) << 9) | ((m_defaultNOS & 2) << 7) | ((m_defaultNOS & 4) << 5);
|
int pageStatus = 0x8000 | (controlBit(PageBase::C4ErasePage) << 14) | ((m_defaultNOS & 1) << 9) | ((m_defaultNOS & 2) << 7) | ((m_defaultNOS & 4) << 5);
|
||||||
for (int i=1; i<8; i++)
|
for (int i=C5Newsflash; i<=C11SerialMagazine; i++)
|
||||||
pageStatus |= controlBit(i) << (i-1);
|
pageStatus |= controlBit(i) << (i-1);
|
||||||
return pageStatus;
|
return pageStatus;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,13 +26,13 @@ PageBase::PageBase()
|
|||||||
// We use nullptrs to keep track of allocated packets, so initialise them this way
|
// We use nullptrs to keep track of allocated packets, so initialise them this way
|
||||||
for (int i=0; i<90; i++)
|
for (int i=0; i<90; i++)
|
||||||
m_packets[i] = nullptr;
|
m_packets[i] = nullptr;
|
||||||
for (int i=0; i<8; i++)
|
for (int i=PageBase::C4ErasePage; i<=PageBase::C11SerialMagazine; i++)
|
||||||
m_controlBits[i] = false;
|
m_controlBits[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PageBase::PageBase(const PageBase &other)
|
PageBase::PageBase(const PageBase &other)
|
||||||
{
|
{
|
||||||
for (int i=0; i<8; i++)
|
for (int i=PageBase::C4ErasePage; i<=PageBase::C11SerialMagazine; i++)
|
||||||
setControlBit(i, other.controlBit(i));
|
setControlBit(i, other.controlBit(i));
|
||||||
for (int i=0; i<90; i++)
|
for (int i=0; i<90; i++)
|
||||||
if (other.packetNeededArrayIndex(i))
|
if (other.packetNeededArrayIndex(i))
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class PageBase //: public QObject
|
|||||||
//Q_OBJECT
|
//Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum ControlBitsEnum { C4ErasePage, C5Newsflash, C6Subtitle, C7SuppressHeader, C8Update, C9InterruptedSequence, C10InhibitDisplay, C11SerialMagazine };
|
||||||
|
|
||||||
PageBase();
|
PageBase();
|
||||||
PageBase(const PageBase &);
|
PageBase(const PageBase &);
|
||||||
~PageBase();
|
~PageBase();
|
||||||
|
|||||||
@@ -321,14 +321,14 @@ void TeletextPageRender::renderPage(int r)
|
|||||||
return;
|
return;
|
||||||
int charWidth = resultAttributes.display.doubleWidth ? 24 : 12;
|
int charWidth = resultAttributes.display.doubleWidth ? 24 : 12;
|
||||||
int charHeight = resultAttributes.display.doubleHeight ? 20 : 10;
|
int charHeight = resultAttributes.display.doubleHeight ? 20 : 10;
|
||||||
bool transparentBackground = (m_levelOnePage->controlBit(1) || m_levelOnePage->controlBit(2) || m_mix) && !resultAttributes.display.boxingWindow;
|
bool transparentBackground = (m_levelOnePage->controlBit(PageBase::C5Newsflash) || m_levelOnePage->controlBit(PageBase::C6Subtitle) || m_mix) && !resultAttributes.display.boxingWindow;
|
||||||
// bool transparentForeground = false;
|
// bool transparentForeground = false;
|
||||||
if (transparentBackground) {
|
if (transparentBackground) {
|
||||||
pixmapPainter.setCompositionMode(QPainter::CompositionMode_Clear);
|
pixmapPainter.setCompositionMode(QPainter::CompositionMode_Clear);
|
||||||
pixmapPainter.eraseRect(c*12, r*10, charWidth, charHeight);
|
pixmapPainter.eraseRect(c*12, r*10, charWidth, charHeight);
|
||||||
pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
pixmapPainter.setCompositionMode(QPainter::CompositionMode_SourceOver);
|
||||||
}
|
}
|
||||||
if ((m_levelOnePage->controlBit(1) || m_levelOnePage->controlBit(2)) && !resultAttributes.display.boxingWindow) {
|
if ((m_levelOnePage->controlBit(PageBase::C5Newsflash) || m_levelOnePage->controlBit(PageBase::C6Subtitle)) && !resultAttributes.display.boxingWindow) {
|
||||||
// Outside a boxed area
|
// Outside a boxed area
|
||||||
resultCharacter = { 0x20, 0, 0 };
|
resultCharacter = { 0x20, 0, 0 };
|
||||||
underlined = false;
|
underlined = false;
|
||||||
@@ -629,7 +629,7 @@ void TeletextPageRender::updateFlashRequired(int newFlashRequired)
|
|||||||
|
|
||||||
inline void TeletextPageRender::setFullScreenColour(int newColour)
|
inline void TeletextPageRender::setFullScreenColour(int newColour)
|
||||||
{
|
{
|
||||||
if (m_mix || m_levelOnePage->controlBit(1) || m_levelOnePage->controlBit(2)) {
|
if (m_mix || m_levelOnePage->controlBit(PageBase::C5Newsflash) || m_levelOnePage->controlBit(PageBase::C6Subtitle)) {
|
||||||
m_finalFullScreenQColor = QColor(0, 0, 0, 0);
|
m_finalFullScreenQColor = QColor(0, 0, 0, 0);
|
||||||
emit fullScreenColourChanged(QColor(0, 0, 0, 0));
|
emit fullScreenColourChanged(QColor(0, 0, 0, 0));
|
||||||
return;
|
return;
|
||||||
@@ -644,7 +644,7 @@ inline void TeletextPageRender::setFullScreenColour(int newColour)
|
|||||||
|
|
||||||
inline void TeletextPageRender::setFullRowColour(int row, int newColour)
|
inline void TeletextPageRender::setFullRowColour(int row, int newColour)
|
||||||
{
|
{
|
||||||
if (m_mix || m_levelOnePage->controlBit(1) || m_levelOnePage->controlBit(2)) {
|
if (m_mix || m_levelOnePage->controlBit(PageBase::C5Newsflash) || m_levelOnePage->controlBit(PageBase::C6Subtitle)) {
|
||||||
m_fullRowQColor[row] = QColor(0, 0, 0, 0);
|
m_fullRowQColor[row] = QColor(0, 0, 0, 0);
|
||||||
emit fullRowColourChanged(row, QColor(0, 0, 0, 0));
|
emit fullRowColourChanged(row, QColor(0, 0, 0, 0));
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user