aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui')
-rw-r--r--qtmips_gui/memoryview.cpp11
-rw-r--r--qtmips_gui/memoryview.h4
2 files changed, 15 insertions, 0 deletions
diff --git a/qtmips_gui/memoryview.cpp b/qtmips_gui/memoryview.cpp
index 3f5fbc3..1ce02d7 100644
--- a/qtmips_gui/memoryview.cpp
+++ b/qtmips_gui/memoryview.cpp
@@ -31,6 +31,8 @@ MemoryView::MemoryView(QWidget *parent, std::uint32_t addr0) : QWidget(parent) {
void MemoryView::setup(machine::QtMipsMachine *machine) {
memory = (machine == nullptr) ? nullptr : machine->memory();
+ if (machine != nullptr)
+ connect(machine, SIGNAL(post_tick()), this, SLOT(check_for_updates()));
reload_content();
}
@@ -58,9 +60,18 @@ void MemoryView::edit_load_focus() {
go_edit->setText(QString("0x%1").arg(focus(), 8, 16, QChar('0')));
}
+void MemoryView::check_for_updates() {
+ if (memory != nullptr) {
+ if (change_counter != memory->get_change_counter())
+ reload_content();
+ }
+}
+
void MemoryView::reload_content() {
int count = memf->widg->count();
memf->widg->clearRows();
+ if (memory != nullptr)
+ change_counter = memory->get_change_counter();
update_content(count, 0);
}
diff --git a/qtmips_gui/memoryview.h b/qtmips_gui/memoryview.h
index 1aeaf10..7b63d47 100644
--- a/qtmips_gui/memoryview.h
+++ b/qtmips_gui/memoryview.h
@@ -27,6 +27,9 @@ public:
void edit_load_focus(); // Set current focus to edit field
+public slots:
+ void check_for_updates();
+
protected:
const machine::Memory *memory;
@@ -43,6 +46,7 @@ private slots:
void go_edit_finish();
private:
+ std::uint32_t change_counter;
unsigned count;
std::uint32_t addr_0; // First address in view