diff options
author | Karel Kočí <cynerd@email.cz> | 2018-04-17 10:36:06 +0200 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2018-04-17 10:36:06 +0200 |
commit | fda5c2613695268e75c9be99617660ecec50baa7 (patch) | |
tree | 2890ff4aeb016adbdd02b6f89a130d75630d2fdf /qtmips_gui/memoryview.cpp | |
parent | 731701ee554833c5e69c1eb77764cda425ca9308 (diff) | |
download | qtmips-fda5c2613695268e75c9be99617660ecec50baa7.tar.gz qtmips-fda5c2613695268e75c9be99617660ecec50baa7.tar.bz2 qtmips-fda5c2613695268e75c9be99617660ecec50baa7.zip |
Store memory and program view address position
This reloads memoryview with same base address as it was closed with.
It somewhat works but with program view it seems to be buggy and shifts
stuff down. But let's say that it's good enough for now.
Diffstat (limited to 'qtmips_gui/memoryview.cpp')
-rw-r--r-- | qtmips_gui/memoryview.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp index d2f33d3..b2d0a66 100644 --- a/qtmips_gui/memoryview.cpp +++ b/qtmips_gui/memoryview.cpp @@ -9,9 +9,9 @@ #define ANGLE_SCROLL 4 /////////////////////////// -MemoryView::MemoryView(QWidget *parent) : QWidget(parent) { +MemoryView::MemoryView(QWidget *parent, std::uint32_t addr0) : QWidget(parent) { memory = nullptr; - addr_0 = 0; + addr_0 = addr0; layout = new QVBoxLayout(this); @@ -38,6 +38,7 @@ void MemoryView::set_focus(std::uint32_t address) { if (address < addr_0 || (address - addr_0)/4 > (unsigned)memf->widg->count()) { // This is outside of loaded area so just move it and reload everything addr_0 = address - 4*memf->focussed(); + addr0_save_change(addr_0); reload_content(); } else { memf->focus((address - addr_0) / 4); @@ -45,10 +46,14 @@ void MemoryView::set_focus(std::uint32_t address) { edit_load_focus(); } -std::uint32_t MemoryView::focus() { +std::uint32_t MemoryView::focus() const { return addr_0 + 4*memf->focussed(); } +std::uint32_t MemoryView::addr0() const { + return addr_0; +} + void MemoryView::edit_load_focus() { go_edit->setText(QString("0x%1").arg(focus(), 8, 16, QChar('0'))); } @@ -89,8 +94,11 @@ void MemoryView::update_content(int count, int shift) { else for (int i = 0; i > d_e; i--) memf->widg->removeRow(memf->widg->count() - 1); + addr0_save_change(addr_0); } +void MemoryView::addr0_save_change(std::uint32_t val) { /* ignore */ } + void MemoryView::go_edit_finish() { QString hex = go_edit->text(); hex.remove(0, 2); |