diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index aee0e2864..0479ff3f8 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -88,6 +88,8 @@ add_library(ui STATIC qt_openglrenderer.cpp qt_openglrenderer.hpp qt_glsl_parser.cpp + qt_about.cpp + qt_about.hpp qt_settings.cpp qt_settings.hpp diff --git a/src/qt/qt_about.cpp b/src/qt/qt_about.cpp new file mode 100644 index 000000000..96cde8522 --- /dev/null +++ b/src/qt/qt_about.cpp @@ -0,0 +1,75 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * About dialog module. + * + * + * + * Authors: Joakim L. Gilje + * Cacodemon345 + * Teemu Korhonen + * dob205 + * + * Copyright 2021 Joakim L. Gilje + * Copyright 2021-2022 Cacodemon345 + * Copyright 2021-2022 Teemu Korhonen + * Copyright 2022 dob205 + */ +#include "qt_about.hpp" + +extern "C" { +#include <86box/86box.h> +#include <86box/version.h> +} + +#include +#include +#include +#include +#include + +About::About(QWidget *parent) +{ + setTextFormat(Qt::RichText); + QString versioninfo; +#ifdef EMU_GIT_HASH + versioninfo = QString(" [%1]").arg(EMU_GIT_HASH); +#endif +#ifdef USE_DYNAREC +# ifdef USE_NEW_DYNAREC +# define DYNAREC_STR "new dynarec" +# else +# define DYNAREC_STR "old dynarec" +# endif +#else +# define DYNAREC_STR "no dynarec" +#endif + versioninfo.append(QString(" [%1, %2]").arg(QSysInfo::buildCpuArchitecture(), tr(DYNAREC_STR))); + setText(QString("%3%1%2").arg(EMU_VERSION_FULL, versioninfo, tr("86Box v"))); + setInformativeText(tr("An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information.")); + setWindowTitle(tr("About 86Box")); + const auto closeButton = addButton("OK", QMessageBox::ButtonRole::AcceptRole); + setEscapeButton(closeButton); + const auto webSiteButton = addButton(EMU_SITE, QMessageBox::ButtonRole::HelpRole); + webSiteButton->connect(webSiteButton, &QPushButton::released, []() { + QDesktopServices::openUrl(QUrl("https://" EMU_SITE)); + }); +#ifdef RELEASE_BUILD + setIconPixmap(QIcon(":/settings/qt/icons/86Box-green.ico").pixmap(32, 32)); +#elif defined ALPHA_BUILD + setIconPixmap(QIcon(":/settings/qt/icons/86Box-red.ico").pixmap(32, 32)); +#elif defined BETA_BUILD + setIconPixmap(QIcon(":/settings/qt/icons/86Box-yellow.ico").pixmap(32, 32)); +#else + setIconPixmap(QIcon(":/settings/qt/icons/86Box-gray.ico").pixmap(32, 32)); +#endif + setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); +} + +About::~About() + = default; diff --git a/src/qt/qt_about.hpp b/src/qt/qt_about.hpp new file mode 100644 index 000000000..206aab37b --- /dev/null +++ b/src/qt/qt_about.hpp @@ -0,0 +1,13 @@ +#ifndef QT_ABOUT_HPP +#define QT_ABOUT_HPP + +#include + +class About final : public QMessageBox { + Q_OBJECT + +public: + explicit About(QWidget *parent = nullptr); + ~About() override; +}; +#endif // QT_ABOUT_HPP \ No newline at end of file diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 27eb5a14a..1b480152d 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -97,6 +97,7 @@ extern bool cpu_thread_running; #include #include "qt_settings.hpp" +#include "qt_about.hpp" #include "qt_machinestatus.hpp" #include "qt_mediamenu.hpp" #include "qt_util.hpp" @@ -1908,42 +1909,8 @@ MainWindow::on_actionAbout_Qt_triggered() void MainWindow::on_actionAbout_86Box_triggered() { - QMessageBox msgBox; - msgBox.setTextFormat(Qt::RichText); - QString versioninfo; -#ifdef EMU_GIT_HASH - versioninfo = QString(" [%1]").arg(EMU_GIT_HASH); -#endif -#ifdef USE_DYNAREC -# ifdef USE_NEW_DYNAREC -# define DYNAREC_STR "new dynarec" -# else -# define DYNAREC_STR "old dynarec" -# endif -#else -# define DYNAREC_STR "no dynarec" -#endif - versioninfo.append(QString(" [%1, %2]").arg(QSysInfo::buildCpuArchitecture(), tr(DYNAREC_STR))); - msgBox.setText(QString("%3%1%2").arg(EMU_VERSION_FULL, versioninfo, tr("86Box v"))); - msgBox.setInformativeText(tr("An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information.")); - msgBox.setWindowTitle(tr("About 86Box")); - const auto closeButton = msgBox.addButton("OK", QMessageBox::ButtonRole::AcceptRole); - msgBox.setEscapeButton(closeButton); - const auto webSiteButton = msgBox.addButton(EMU_SITE, QMessageBox::ButtonRole::HelpRole); - webSiteButton->connect(webSiteButton, &QPushButton::released, []() { - QDesktopServices::openUrl(QUrl("https://" EMU_SITE)); - }); -#ifdef RELEASE_BUILD - msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-green.ico").pixmap(32, 32)); -#elif defined ALPHA_BUILD - msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-red.ico").pixmap(32, 32)); -#elif defined BETA_BUILD - msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-yellow.ico").pixmap(32, 32)); -#else - msgBox.setIconPixmap(QIcon(":/settings/qt/icons/86Box-gray.ico").pixmap(32, 32)); -#endif - msgBox.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint); - msgBox.exec(); + const auto msgBox = new About(this); + msgBox->exec(); } void diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index a349740e7..0bedfa224 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -22,10 +22,12 @@ #if EMU_BUILD_NUM != 0 # include "qt_updatecheckdialog.hpp" #endif +#include "qt_about.hpp" #include #include #include +#include VMManagerMainWindow:: VMManagerMainWindow(QWidget *parent) @@ -186,8 +188,27 @@ VMManagerMainWindow::checkForUpdatesTriggered() } #endif -void VMManagerMainWindow::on_actionExit_triggered() +void +VMManagerMainWindow::on_actionExit_triggered() { this->close(); } +void +VMManagerMainWindow::on_actionAbout_Qt_triggered() +{ + QApplication::aboutQt(); +} + +void +VMManagerMainWindow::on_actionAbout_86Box_triggered() +{ + const auto msgBox = new About(this); + msgBox->exec(); +} + +void +VMManagerMainWindow::on_actionDocumentation_triggered() +{ + QDesktopServices::openUrl(QUrl(EMU_DOCS_URL)); +} diff --git a/src/qt/qt_vmmanager_mainwindow.hpp b/src/qt/qt_vmmanager_mainwindow.hpp index 7a38750c4..f0e14b395 100644 --- a/src/qt/qt_vmmanager_mainwindow.hpp +++ b/src/qt/qt_vmmanager_mainwindow.hpp @@ -55,6 +55,9 @@ private slots: #endif void on_actionExit_triggered(); + void on_actionDocumentation_triggered(); + void on_actionAbout_86Box_triggered(); + void on_actionAbout_Qt_triggered(); protected: void closeEvent(QCloseEvent *event) override; diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index 1067c1e49..00dd8a4eb 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -38,8 +38,17 @@ + + + &Help + + + + + + @@ -71,11 +80,6 @@ - - - Do something - - true @@ -217,6 +221,30 @@ QAction::QuitRole + + + &Documentation... + + + + + &About 86Box... + + + QAction::AboutRole + + + + + About Qt + + + false + + + QAction::AboutQtRole + +