diff options
Diffstat (limited to 'qtmips_gui')
-rw-r--r-- | qtmips_gui/MainWindow.ui | 31 | ||||
-rw-r--r-- | qtmips_gui/aboutdialog.cpp | 133 | ||||
-rw-r--r-- | qtmips_gui/aboutdialog.h | 61 | ||||
-rw-r--r-- | qtmips_gui/mainwindow.cpp | 14 | ||||
-rw-r--r-- | qtmips_gui/mainwindow.h | 3 | ||||
-rw-r--r-- | qtmips_gui/qtmips_gui.pro | 6 |
6 files changed, 246 insertions, 2 deletions
diff --git a/qtmips_gui/MainWindow.ui b/qtmips_gui/MainWindow.ui index bdaba23..6954603 100644 --- a/qtmips_gui/MainWindow.ui +++ b/qtmips_gui/MainWindow.ui @@ -68,6 +68,8 @@ <addaction name="actionMemory"/> <addaction name="actionProgram_Cache"/> <addaction name="actionData_Cache"/> + <addaction name="actionPeripherals"/> + <addaction name="actionTerminal"/> </widget> <widget class="QMenu" name="menuMachine"> <property name="title"> @@ -82,12 +84,21 @@ <addaction name="ips5"/> <addaction name="ips10"/> <addaction name="ipsUnlimited"/> + <addaction name="ipsMax"/> <addaction name="separator"/> <addaction name="actionRestart"/> </widget> + <widget class="QMenu" name="menuHelp"> + <property name="title"> + <string>Help</string> + </property> + <addaction name="actionAbout"/> + <addaction name="actionAboutQt"/> + </widget> <addaction name="menuFile"/> <addaction name="menuMachine"/> <addaction name="menuWindows"/> + <addaction name="menuHelp"/> </widget> <widget class="QStatusBar" name="statusBar"/> <widget class="QToolBar" name="toolBar"> @@ -327,6 +338,11 @@ <string>Ctrl+2</string> </property> </action> + <action name="actionAbout"> + <property name="text"> + <string>&About Qt Mips</string> + </property> + </action> <action name="ipsMax"> <property name="checkable"> <bool>true</bool> @@ -341,6 +357,21 @@ <string>Ctrl+M</string> </property> </action> + <action name="actionAboutQt"> + <property name="text"> + <string>About Qt</string> + </property> + </action> + <action name="actionPeripherals"> + <property name="text"> + <string>Peripherals</string> + </property> + </action> + <action name="actionTerminal"> + <property name="text"> + <string>Terminal</string> + </property> + </action> </widget> <layoutdefault spacing="6" margin="11"/> <resources> diff --git a/qtmips_gui/aboutdialog.cpp b/qtmips_gui/aboutdialog.cpp new file mode 100644 index 0000000..83ab1b7 --- /dev/null +++ b/qtmips_gui/aboutdialog.cpp @@ -0,0 +1,133 @@ +// SPDX-License-Identifier: GPL-2.0+ +/******************************************************************************* + * QtMips - MIPS 32-bit Architecture Subset Simulator + * + * Implemented to support following courses: + * + * B35APO - Computer Architectures + * https://cw.fel.cvut.cz/wiki/courses/b35apo + * + * B4M35PAP - Advanced Computer Architectures + * https://cw.fel.cvut.cz/wiki/courses/b4m35pap/start + * + * Copyright (c) 2017-2019 Karel Koci<cynerd@email.cz> + * Copyright (c) 2019 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * + * Faculty of Electrical Engineering (http://www.fel.cvut.cz) + * Czech Technical University (http://www.cvut.cz/) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + ******************************************************************************/ + +#include "aboutdialog.h" + +#include <QObject> +#include <QTabWidget> +#include <QVBoxLayout> +#include <QPlainTextEdit> +#include <QTextBrowser> +#include <QLabel> +#include <QPushButton> +#include <QApplication> +#include <QDebug> + + +AboutDialog::AboutDialog(QWidget *parent) + : QDialog(parent) +{ + QLabel *lbl; + + setWindowTitle(tr("About Qt Mips")); + + all = new QVBoxLayout(this); + + QWidget *hbox = new QWidget(); + QHBoxLayout *hl = new QHBoxLayout(hbox); + hl->setContentsMargins(0,0,0,0); + + all->addWidget(hbox); + + QWidget *vbox = new QWidget(); + QVBoxLayout *vl = new QVBoxLayout(vbox); + //vl->setContentsMargins(0,0,0,0); + hl->addWidget(vbox); + + QString versionText; + versionText = "Version 0.5 \n"; + + vl->addWidget(new QLabel("<span style='font-size:x-large; font-weight:bold;'>Qt Mips - MIPS Architecture Simulator</span>")); + lbl = new QLabel(versionText); + lbl->setAlignment(Qt::AlignHCenter); + lbl->setOpenExternalLinks(true); + vl->addWidget(lbl); + vl->addWidget(new QLabel("Copyright (C) 2017-2019 Karel Kočí " + "<a href=\"mailto://cynerd@email.cz\">cynerd@email.cz</a><br/>" + "Copyright (C) 2019 Pavel Píša " + "<a href=\"mailto://pisa@cmp.felk.cvut.cz\">pisa@cmp.felk.cvut.cz</a>")); + + QString supportText; + supportText = "Home Page : <a href=\"https://github.com/ppisa/QtMips\">https://github.com/ppisa/QtMips</a><br/>" + "Home Page : <a href=\"https://github.com/Cynerd/QtMips\">https://github.com/Cynerd/QtMips</a><br/>" + "Implemented for<br/>" + "<a href=\"https://cw.fel.cvut.cz/wiki/courses/b35apo/start\">Computer Architectures</a><br/>" + "and<br/>" + "<a href=\"https://cw.fel.cvut.cz/wiki/courses/b4m35pap/start\">Advanced Computer Achitectures</a><br/>" + "courses at<br/>" + "<a href=\"https://www.cvut.cz/\">Czech Technical University in Prague</a><br/>" + "<a href=\"https://www.fel.cvut.cz/\">Faculty of Electrical Engineering</a><br/>"; + + QTextBrowser *supportBrowser = new QTextBrowser; + supportBrowser->setOpenExternalLinks(true); + supportBrowser->setHtml(supportText); + vl->addWidget(supportBrowser); + + QString licenseText; + licenseText = "This program is free software; you can redistribute it and/or\n" + "modify it under the terms of the GNU General Public License\n" + "as published by the Free Software Foundation; either version 2\n" + "of the License, or (at your option) any later version.\n" + "<br/>\n" + "<br/>\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "<br/>\n" + "<br/>\n" + "You should have received a copy of the GNU General Public License\n" + "along with this program; if not, write to the Free Software\n" + "Foundation, Inc., 51 Franklin Street, Fifth Floor,\n" + "Boston, MA 02110-1301, USA.\n"; + + QTextBrowser *licenseBrowser = new QTextBrowser; + licenseBrowser->setOpenExternalLinks(true); + licenseBrowser->setHtml(licenseText); + vl->addWidget(licenseBrowser); + + QWidget *hbBtn = new QWidget(); + QHBoxLayout *hlBtn = new QHBoxLayout(hbBtn); + hlBtn->setContentsMargins(0,0,0,0); + vl->addWidget(hbBtn); + + QPushButton *okButton = new QPushButton(tr("&OK"), parent); + okButton->setFocus(); + connect(okButton, SIGNAL(clicked()), this, SLOT(close())); + hlBtn->addStretch(); + hlBtn->addWidget(okButton); + + prevTab = 0; // first Tab is selected by default +} diff --git a/qtmips_gui/aboutdialog.h b/qtmips_gui/aboutdialog.h new file mode 100644 index 0000000..8470429 --- /dev/null +++ b/qtmips_gui/aboutdialog.h @@ -0,0 +1,61 @@ +// SPDX-License-Identifier: GPL-2.0+ +/******************************************************************************* + * QtMips - MIPS 32-bit Architecture Subset Simulator + * + * Implemented to support following courses: + * + * B35APO - Computer Architectures + * https://cw.fel.cvut.cz/wiki/courses/b35apo + * + * B4M35PAP - Advanced Computer Architectures + * https://cw.fel.cvut.cz/wiki/courses/b4m35pap/start + * + * Copyright (c) 2017-2019 Karel Koci<cynerd@email.cz> + * Copyright (c) 2019 Pavel Pisa <pisa@cmp.felk.cvut.cz> + * + * Faculty of Electrical Engineering (http://www.fel.cvut.cz) + * Czech Technical University (http://www.cvut.cz/) + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. + * + ******************************************************************************/ + +#ifndef ABOUTDIALOG_H +#define ABOUTDIALOG_H + +#include <random> +#include <array> + +#include <QDialog> +#include <QVBoxLayout> + +class QString; +class QTextBrowser; + +class AboutDialog : public QDialog { + Q_OBJECT + +public: + AboutDialog(QWidget *parent = 0); + +private: + QVBoxLayout *all; + QTextBrowser *authorsBrowser; + + int prevTab; +}; + +#endif diff --git a/qtmips_gui/mainwindow.cpp b/qtmips_gui/mainwindow.cpp index 6c752f0..4e716cb 100644 --- a/qtmips_gui/mainwindow.cpp +++ b/qtmips_gui/mainwindow.cpp @@ -34,6 +34,7 @@ ******************************************************************************/ #include "mainwindow.h" +#include "aboutdialog.h" MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { machine = nullptr; @@ -79,6 +80,8 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { connect(ui->actionMemory, SIGNAL(triggered(bool)), this, SLOT(show_memory())); connect(ui->actionProgram_Cache, SIGNAL(triggered(bool)), this, SLOT(show_cache_program())); connect(ui->actionData_Cache, SIGNAL(triggered(bool)), this, SLOT(show_cache_data())); + connect(ui->actionAbout, SIGNAL(triggered(bool)), this, SLOT(about_qtmips())); + connect(ui->actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(about_qt())); connect(ui->ips1, SIGNAL(toggled(bool)), this, SLOT(set_speed())); connect(ui->ips2, SIGNAL(toggled(bool)), this, SLOT(set_speed())); connect(ui->ips5, SIGNAL(toggled(bool)), this, SLOT(set_speed())); @@ -210,6 +213,17 @@ SHOW_HANDLER(cache_program) SHOW_HANDLER(cache_data) #undef SHOW_HANDLER +void MainWindow::about_qtmips() +{ + AboutDialog *aboutdialog = new AboutDialog(this); + aboutdialog->exec(); +} + +void MainWindow::about_qt() +{ + QMessageBox::aboutQt(this); +} + void MainWindow::set_speed() { if (machine == nullptr) return; // just ignore diff --git a/qtmips_gui/mainwindow.h b/qtmips_gui/mainwindow.h index 71d59c5..48883e5 100644 --- a/qtmips_gui/mainwindow.h +++ b/qtmips_gui/mainwindow.h @@ -70,6 +70,9 @@ public slots: void show_memory(); void show_cache_data(); void show_cache_program(); + // Actions - help menu + void about_qtmips(); + void about_qt(); // Actions - execution speed void set_speed(); // Machine signals diff --git a/qtmips_gui/qtmips_gui.pro b/qtmips_gui/qtmips_gui.pro index 273297f..8822e38 100644 --- a/qtmips_gui/qtmips_gui.pro +++ b/qtmips_gui/qtmips_gui.pro @@ -50,7 +50,8 @@ SOURCES += \ memorytableview.cpp \ hexlineedit.cpp \ programmodel.cpp \ - programtableview.cpp + programtableview.cpp \ + aboutdialog.cpp HEADERS += \ mainwindow.h \ @@ -81,7 +82,8 @@ HEADERS += \ memorytableview.h \ hexlineedit.h \ programmodel.h \ - programtableview.h + programtableview.h \ + aboutdialog.h FORMS += \ NewDialog.ui \ |