Move page status bits to PageBase superclass
This commit is contained in:
@@ -40,8 +40,6 @@ void LevelOnePage::clearPage()
|
|||||||
for (int r=0; r<25; r++)
|
for (int r=0; r<25; r++)
|
||||||
for (int c=0; c<40; c++)
|
for (int c=0; c<40; c++)
|
||||||
m_level1Page[r][c] = 0x20;
|
m_level1Page[r][c] = 0x20;
|
||||||
for (int i=0; i<8; i++)
|
|
||||||
m_controlBits[i] = false;
|
|
||||||
/* m_subPageNumber = 0x0000; */
|
/* m_subPageNumber = 0x0000; */
|
||||||
m_cycleValue = 8;
|
m_cycleValue = 8;
|
||||||
m_cycleType = CTseconds;
|
m_cycleType = CTseconds;
|
||||||
@@ -316,9 +314,9 @@ 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 | (m_controlBits[0] << 14) | ((m_defaultNOS & 1) << 9) | ((m_defaultNOS & 2) << 7) | ((m_defaultNOS & 4) << 5);
|
int pageStatus = 0x8000 | (controlBit(0) << 14) | ((m_defaultNOS & 1) << 9) | ((m_defaultNOS & 2) << 7) | ((m_defaultNOS & 4) << 5);
|
||||||
for (int i=1; i<8; i++)
|
for (int i=1; i<8; i++)
|
||||||
pageStatus |= m_controlBits[i] << (i-1);
|
pageStatus |= controlBit(i) << (i-1);
|
||||||
return pageStatus;
|
return pageStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +377,6 @@ QString LevelOnePage::exportURLHash(QString pageHash)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* void LevelOnePage::setSubPageNumber(int newSubPageNumber) { m_subPageNumber = newSubPageNumber; } */
|
/* void LevelOnePage::setSubPageNumber(int newSubPageNumber) { m_subPageNumber = newSubPageNumber; } */
|
||||||
void LevelOnePage::setControlBit(int bitNumber, bool active) { m_controlBits[bitNumber] = active; }
|
|
||||||
void LevelOnePage::setCycleValue(int newValue) { m_cycleValue = newValue; };
|
void LevelOnePage::setCycleValue(int newValue) { m_cycleValue = newValue; };
|
||||||
void LevelOnePage::setCycleType(CycleTypeEnum newType) { m_cycleType = newType; }
|
void LevelOnePage::setCycleType(CycleTypeEnum newType) { m_cycleType = newType; }
|
||||||
void LevelOnePage::setDefaultCharSet(int newDefaultCharSet) { m_defaultCharSet = newDefaultCharSet; }
|
void LevelOnePage::setDefaultCharSet(int newDefaultCharSet) { m_defaultCharSet = newDefaultCharSet; }
|
||||||
|
|||||||
@@ -53,8 +53,6 @@ public:
|
|||||||
QString exportURLHash(QString);
|
QString exportURLHash(QString);
|
||||||
|
|
||||||
/* void setSubPageNumber(int); */
|
/* void setSubPageNumber(int); */
|
||||||
bool controlBit(int bitNumber) const { return m_controlBits[bitNumber]; }
|
|
||||||
void setControlBit(int, bool);
|
|
||||||
int cycleValue() const { return m_cycleValue; };
|
int cycleValue() const { return m_cycleValue; };
|
||||||
void setCycleValue(int);
|
void setCycleValue(int);
|
||||||
CycleTypeEnum cycleType() const { return m_cycleType; };
|
CycleTypeEnum cycleType() const { return m_cycleType; };
|
||||||
@@ -96,7 +94,6 @@ protected:
|
|||||||
private:
|
private:
|
||||||
unsigned char m_level1Page[25][40];
|
unsigned char m_level1Page[25][40];
|
||||||
/* int m_subPageNumber; */
|
/* int m_subPageNumber; */
|
||||||
bool m_controlBits[8];
|
|
||||||
int m_cycleValue;
|
int m_cycleValue;
|
||||||
CycleTypeEnum m_cycleType;
|
CycleTypeEnum m_cycleType;
|
||||||
int m_defaultCharSet, m_defaultNOS, m_secondCharSet, m_secondNOS;
|
int m_defaultCharSet, m_defaultNOS, m_secondCharSet, m_secondNOS;
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ 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++)
|
||||||
|
m_controlBits[i] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
PageBase::~PageBase()
|
PageBase::~PageBase()
|
||||||
@@ -89,6 +91,12 @@ bool PageBase::deletePacket(int packetNumber, int designationCode)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PageBase::setControlBit(int bitNumber, bool active)
|
||||||
|
{
|
||||||
|
m_controlBits[bitNumber] = active;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
PageBase::PacketCodingEnum PageBase::packetCoding(int packetNumber, int designationCode) const
|
PageBase::PacketCodingEnum PageBase::packetCoding(int packetNumber, int designationCode) const
|
||||||
{
|
{
|
||||||
switch (packetNumber) {
|
switch (packetNumber) {
|
||||||
|
|||||||
@@ -41,12 +41,16 @@ public:
|
|||||||
bool setPacket(int, int, QByteArray);
|
bool setPacket(int, int, QByteArray);
|
||||||
bool deletePacket(int, int=0);
|
bool deletePacket(int, int=0);
|
||||||
|
|
||||||
|
bool controlBit(int bitNumber) const { return m_controlBits[bitNumber]; }
|
||||||
|
bool setControlBit(int, bool);
|
||||||
|
|
||||||
PageFunctionEnum pageFunction() const { return m_pageFunction; }
|
PageFunctionEnum pageFunction() const { return m_pageFunction; }
|
||||||
bool setPageFunction(PageFunctionEnum);
|
bool setPageFunction(PageFunctionEnum);
|
||||||
PacketCodingEnum packetCoding(int=0, int=0) const;
|
PacketCodingEnum packetCoding(int=0, int=0) const;
|
||||||
bool setPacketCoding(PacketCodingEnum);
|
bool setPacketCoding(PacketCodingEnum);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
bool m_controlBits[8];
|
||||||
PageFunctionEnum m_pageFunction;
|
PageFunctionEnum m_pageFunction;
|
||||||
PacketCodingEnum m_packetCoding;
|
PacketCodingEnum m_packetCoding;
|
||||||
QByteArray *m_packets[90]; // X/0 to X/25, plus 16 packets for X/26, another 16 for X/27, for X28 and for X/29
|
QByteArray *m_packets[90]; // X/0 to X/25, plus 16 packets for X/26, another 16 for X/27, for X28 and for X/29
|
||||||
|
|||||||
Reference in New Issue
Block a user