diff options
author | Karel Kočí <cynerd@email.cz> | 2017-12-15 22:45:28 +0100 |
---|---|---|
committer | Karel Kočí <cynerd@email.cz> | 2017-12-15 22:45:28 +0100 |
commit | e6ca4b4568e311b47239bfe83de15ed9e91c57b9 (patch) | |
tree | 3da2f72faf360058bae02c35b0c724233bd64d61 /qtmips_gui/mainwindow.cpp | |
parent | bbea996112eb7ac81ec50d2af08f4bd681d0e50d (diff) | |
download | qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.gz qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.tar.bz2 qtmips-e6ca4b4568e311b47239bfe83de15ed9e91c57b9.zip |
Implement few initial graphic elements
Diffstat (limited to 'qtmips_gui/mainwindow.cpp')
-rw-r--r-- | qtmips_gui/mainwindow.cpp | 26 |
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() { |