forked from qt-creator/qt-creator
Add support for contents() to BinEditorDocument
Change-Id: I41c7541984ecc5128c8d742ee44f8b3227c671b6 Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
@@ -63,6 +63,8 @@ public:
|
|||||||
|
|
||||||
Q_INVOKABLE void setSizes(quint64 startAddr, int range, int blockSize = 4096);
|
Q_INVOKABLE void setSizes(quint64 startAddr, int range, int blockSize = 4096);
|
||||||
int dataBlockSize() const { return m_blockSize; }
|
int dataBlockSize() const { return m_blockSize; }
|
||||||
|
QByteArray contents() const { return dataMid(0, m_size); }
|
||||||
|
|
||||||
Q_INVOKABLE void addData(quint64 block, const QByteArray &data);
|
Q_INVOKABLE void addData(quint64 block, const QByteArray &data);
|
||||||
|
|
||||||
bool newWindowRequestAllowed() const { return m_canRequestNewWindow; }
|
bool newWindowRequestAllowed() const { return m_canRequestNewWindow; }
|
||||||
|
|||||||
@@ -232,13 +232,19 @@ public:
|
|||||||
this, SLOT(provideData(quint64)));
|
this, SLOT(provideData(quint64)));
|
||||||
connect(m_widget, SIGNAL(newRangeRequested(quint64)),
|
connect(m_widget, SIGNAL(newRangeRequested(quint64)),
|
||||||
this, SLOT(provideNewRange(quint64)));
|
this, SLOT(provideNewRange(quint64)));
|
||||||
|
connect(m_widget, &BinEditorWidget::dataChanged, this, &IDocument::contentsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray contents() const override
|
||||||
|
{
|
||||||
|
return m_widget->contents();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool setContents(const QByteArray &contents) override
|
bool setContents(const QByteArray &contents) override
|
||||||
{
|
{
|
||||||
if (!contents.isEmpty())
|
|
||||||
return false;
|
|
||||||
m_widget->clear();
|
m_widget->clear();
|
||||||
|
m_widget->setSizes(0, contents.length(), contents.length());
|
||||||
|
m_widget->addData(0, contents);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user