aboutsummaryrefslogtreecommitdiff
path: root/qtmips_gui/mainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qtmips_gui/mainwindow.cpp')
-rw-r--r--qtmips_gui/mainwindow.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp
index ea48736..157baf4 100644
--- a/qtmips_gui/mainwindow.cpp
+++ b/qtmips_gui/mainwindow.cpp
@@ -18,11 +18,11 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
registers->hide();
// Connect signals from menu
- QObject::connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(close()));
- QObject::connect(ui->actionNew, SIGNAL(triggered(bool)), this, SLOT(new_machine()));
- QObject::connect(ui->actionCache, SIGNAL(triggered(bool)), this, SLOT(show_cache_content()));
- QObject::connect(ui->actionCache_statistics, SIGNAL(triggered(bool)), this, SLOT(show_cache_statictics()));
- QObject::connect(ui->actionRegisters, SIGNAL(triggered(bool)), this, SLOT(show_registers()));
+ connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(close()));
+ connect(ui->actionNew, SIGNAL(triggered(bool)), this, SLOT(new_machine()));
+ 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->actionRegisters, SIGNAL(triggered(bool)), this, SLOT(show_registers()));
// Restore application state from settings
restoreState(settings->value("windowState").toByteArray());
@@ -39,6 +39,8 @@ MainWindow::~MainWindow() {
delete cache_statictics;
delete registers;
delete ui;
+ if (machine != nullptr)
+ delete machine;
}
void MainWindow::start() {
@@ -50,9 +52,19 @@ void MainWindow::create_core(MachineConfig *config) {
// Create machine
machine = new QtMipsMachine(config);
// Create machine view
- coreview = new CoreView(this);
+ coreview = new CoreView(this, machine);
this->setCentralWidget(coreview);
- // TODO connect signals
+
+ machine->set_speed(1000); // Set default speed to 1 sec
+
+ // Connect machine signals
+ connect(ui->actionRun, SIGNAL(triggered(bool)), machine, SLOT(play()));
+ connect(ui->actionPause, SIGNAL(triggered(bool)), machine, SLOT(pause()));
+ connect(ui->actionStep, SIGNAL(triggered(bool)), machine, SLOT(step()));
+ connect(ui->actionRestart, SIGNAL(triggered(bool)), machine, SLOT(restart()));
+
+ // Setup docks
+ registers->setup(machine);
}
void MainWindow::new_machine() {