From 8025ccc2091228f9d089532852a2380f5f5a80b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Fri, 5 Jan 2018 17:08:04 +0100 Subject: Add template for Memory dock For now a memory view is missing so there is no content. --- qtmips_gui/mainwindow.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'qtmips_gui/mainwindow.cpp') diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp index 6b8d19b..a286f0d 100644 --- a/qtmips_gui/mainwindow.cpp +++ b/qtmips_gui/mainwindow.cpp @@ -18,6 +18,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { registers->hide(); program = new ProgramDock(this); program->hide(); + memory = new MemoryDock(this); + memory->hide(); cache_content = new CacheContentDock(this); cache_content->hide(); cache_statictics = new CacheStatisticsDock(this); @@ -36,6 +38,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { connect(ui->actionNew, SIGNAL(triggered(bool)), this, SLOT(new_machine())); connect(ui->actionRegisters, SIGNAL(triggered(bool)), this, SLOT(show_registers())); connect(ui->actionProgram_memory, SIGNAL(triggered(bool)), this, SLOT(show_program())); + connect(ui->actionMemory, SIGNAL(triggered(bool)), this, SLOT(show_memory())); connect(ui->actionCache, SIGNAL(triggered(bool)), this, SLOT(show_cache_content())); connect(ui->actionCache_statistics, SIGNAL(triggered(bool)), this, SLOT(show_cache_statictics())); connect(ui->ips1, SIGNAL(toggled(bool)), this, SLOT(set_speed())); @@ -59,6 +62,8 @@ MainWindow::~MainWindow() { delete cache_content; delete cache_statictics; delete registers; + delete program; + delete memory; delete ui; if (machine != nullptr) delete machine; @@ -104,21 +109,16 @@ void MainWindow::new_machine() { ndialog->show(); } -void MainWindow::show_cache_content() { - show_dockwidget(cache_content); -} - -void MainWindow::show_cache_statictics() { - show_dockwidget(cache_statictics); -} +#define SHOW_HANDLER(NAME) void MainWindow::show_##NAME() { \ + show_dockwidget(NAME); \ + } \ -void MainWindow::show_registers() { - show_dockwidget(registers); -} - -void MainWindow::show_program() { - show_dockwidget(program); -} +SHOW_HANDLER(registers) +SHOW_HANDLER(program) +SHOW_HANDLER(memory) +SHOW_HANDLER(cache_content) +SHOW_HANDLER(cache_statictics) +#undef SHOW_HANDLER void MainWindow::set_speed() { if (machine == nullptr) -- cgit v1.2.3