Commit 8d6b43bc authored by Nikita Baryshnikov's avatar Nikita Baryshnikov Committed by hjk
Browse files

BinEditor remove m_widget member



As it is stored in IContext, done similar to BaseTextEditor

Change-Id: I858c75f38d55edf9b13e9c04ca2ff1586e06670e
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 417f8a7c
...@@ -363,8 +363,7 @@ public: ...@@ -363,8 +363,7 @@ public:
BinEditor(BinEditorWidget *widget) BinEditor(BinEditorWidget *widget)
{ {
setWidget(widget); setWidget(widget);
m_widget = widget; m_file = new BinEditorDocument(widget);
m_file = new BinEditorDocument(m_widget);
m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); m_context.add(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID);
m_context.add(Constants::C_BINEDITOR); m_context.add(Constants::C_BINEDITOR);
m_addressEdit = new QLineEdit; m_addressEdit = new QLineEdit;
...@@ -387,13 +386,14 @@ public: ...@@ -387,13 +386,14 @@ public:
widget->setEditor(this); widget->setEditor(this);
connect(m_widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int))); connect(widget, SIGNAL(cursorPositionChanged(int)), SLOT(updateCursorPosition(int)));
connect(m_addressEdit, SIGNAL(editingFinished()), SLOT(jumpToAddress())); connect(m_addressEdit, SIGNAL(editingFinished()), SLOT(jumpToAddress()));
connect(m_widget, SIGNAL(modificationChanged(bool)), m_file, SIGNAL(changed())); connect(widget, SIGNAL(modificationChanged(bool)), m_file, SIGNAL(changed()));
updateCursorPosition(m_widget->cursorPosition()); updateCursorPosition(widget->cursorPosition());
} }
~BinEditor() { ~BinEditor()
{
delete m_widget; delete m_widget;
} }
...@@ -407,16 +407,22 @@ public: ...@@ -407,16 +407,22 @@ public:
private slots: private slots:
void updateCursorPosition(int position) { void updateCursorPosition(int position) {
m_addressEdit->setText(QString::number(m_widget->baseAddress() + position, 16)); m_addressEdit->setText(QString::number(editorWidget()->baseAddress() + position, 16));
} }
void jumpToAddress() { void jumpToAddress() {
m_widget->jumpToAddress(m_addressEdit->text().toULongLong(0, 16)); editorWidget()->jumpToAddress(m_addressEdit->text().toULongLong(0, 16));
updateCursorPosition(m_widget->cursorPosition()); updateCursorPosition(editorWidget()->cursorPosition());
}
private:
inline BinEditorWidget *editorWidget() const
{
QTC_ASSERT(qobject_cast<BinEditorWidget *>(m_widget.data()), return 0);
return static_cast<BinEditorWidget *>(m_widget.data());
} }
private: private:
BinEditorWidget *m_widget;
BinEditorDocument *m_file; BinEditorDocument *m_file;
QToolBar *m_toolBar; QToolBar *m_toolBar;
QLineEdit *m_addressEdit; QLineEdit *m_addressEdit;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment