Manager: Add Help menu
Move the About dialog into its own file and object
This commit is contained in:
@@ -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
|
||||
|
||||
75
src/qt/qt_about.cpp
Normal file
75
src/qt/qt_about.cpp
Normal file
@@ -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 <jgilje@jgilje.net>
|
||||
* 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 <QMessageBox>
|
||||
#include <QIcon>
|
||||
#include <QPushButton>
|
||||
#include <QUrl>
|
||||
#include <QDesktopServices>
|
||||
|
||||
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("<b>%3%1%2</b>").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;
|
||||
13
src/qt/qt_about.hpp
Normal file
13
src/qt/qt_about.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef QT_ABOUT_HPP
|
||||
#define QT_ABOUT_HPP
|
||||
|
||||
#include <QMessageBox>
|
||||
|
||||
class About final : public QMessageBox {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit About(QWidget *parent = nullptr);
|
||||
~About() override;
|
||||
};
|
||||
#endif // QT_ABOUT_HPP
|
||||
@@ -97,6 +97,7 @@ extern bool cpu_thread_running;
|
||||
#include <unordered_map>
|
||||
|
||||
#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("<b>%3%1%2</b>").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
|
||||
|
||||
@@ -22,10 +22,12 @@
|
||||
#if EMU_BUILD_NUM != 0
|
||||
# include "qt_updatecheckdialog.hpp"
|
||||
#endif
|
||||
#include "qt_about.hpp"
|
||||
|
||||
#include <QLineEdit>
|
||||
#include <QStringListModel>
|
||||
#include <QCompleter>
|
||||
#include <QDesktopServices>
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -38,8 +38,17 @@
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionExit"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuHelp">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="actionDocumentation"/>
|
||||
<addaction name="actionAbout_86Box"/>
|
||||
<addaction name="actionAbout_Qt"/>
|
||||
</widget>
|
||||
<addaction name="menuFile"/>
|
||||
<addaction name="menuTools"/>
|
||||
<addaction name="menuHelp"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
@@ -71,11 +80,6 @@
|
||||
<addaction name="actionSettings"/>
|
||||
<addaction name="actionNew_Machine"/>
|
||||
</widget>
|
||||
<action name="actionDo_something">
|
||||
<property name="text">
|
||||
<string>Do something</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionStartPause">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
@@ -217,6 +221,30 @@
|
||||
<enum>QAction::QuitRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDocumentation">
|
||||
<property name="text">
|
||||
<string>&Documentation...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout_86Box">
|
||||
<property name="text">
|
||||
<string>&About 86Box...</string>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::AboutRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionAbout_Qt">
|
||||
<property name="text">
|
||||
<string>About Qt</string>
|
||||
</property>
|
||||
<property name="visible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="menuRole">
|
||||
<enum>QAction::AboutQtRole</enum>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../qt_resources.qrc"/>
|
||||
|
||||
Reference in New Issue
Block a user