Enforce 16 packet limit in Local Enhancement list
This commit is contained in:
@@ -27,13 +27,13 @@
|
||||
|
||||
LevelOnePage::LevelOnePage()
|
||||
{
|
||||
m_enhancements.reserve(208);
|
||||
m_enhancements.reserve(maxEnhancements());
|
||||
clearPage();
|
||||
}
|
||||
|
||||
LevelOnePage::LevelOnePage(const PageBase &other)
|
||||
{
|
||||
m_enhancements.reserve(208);
|
||||
m_enhancements.reserve(maxEnhancements());
|
||||
clearPage();
|
||||
|
||||
for (int i=0; i<26; i++)
|
||||
|
||||
@@ -52,6 +52,8 @@ public:
|
||||
|
||||
void clearPage();
|
||||
|
||||
int maxEnhancements() const { return 208; };
|
||||
|
||||
/* void setSubPageNumber(int); */
|
||||
int cycleValue() const { return m_cycleValue; };
|
||||
void setCycleValue(int);
|
||||
|
||||
@@ -32,6 +32,7 @@ class PageX26Base : public PageBase //: public QObject
|
||||
|
||||
public:
|
||||
QList<X26Triplet> *enhancements() { return &m_enhancements; };
|
||||
virtual int maxEnhancements() const =0;
|
||||
|
||||
protected:
|
||||
QByteArray packetFromEnhancementList(int) const;
|
||||
|
||||
@@ -799,6 +799,9 @@ bool X26Model::insertRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
|
||||
if (m_parentMainWidget->document()->currentSubPage()->enhancements()->size() + count > m_parentMainWidget->document()->currentSubPage()->maxEnhancements())
|
||||
return false;
|
||||
|
||||
m_parentMainWidget->document()->undoStack()->push(new InsertTripletCommand(m_parentMainWidget->document(), this, row, count, m_parentMainWidget->document()->currentSubPage()->enhancements()->at(row)));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user