Path: blob/master/src/duckstation-qt/aboutdialog.cpp
4242 views
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#include "aboutdialog.h"4#include "qtutils.h"56#include "core/settings.h"78#include "common/file_system.h"9#include "common/path.h"1011#include "scmversion/scmversion.h"1213#include <QtCore/QString>14#include <QtWidgets/QDialog>15#include <QtWidgets/QDialogButtonBox>16#include <QtWidgets/QPushButton>17#include <QtWidgets/QTextBrowser>1819#include "moc_aboutdialog.cpp"2021AboutDialog::AboutDialog(QWidget* parent /* = nullptr */) : QDialog(parent)22{23m_ui.setupUi(this);2425setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);26setFixedSize(geometry().width(), geometry().height());2728m_ui.scmversion->setTextInteractionFlags(Qt::TextSelectableByMouse);29m_ui.scmversion->setText(30tr("%1 (%2)").arg(QLatin1StringView(g_scm_tag_str)).arg(QLatin1StringView(g_scm_branch_str)));3132m_ui.description->setTextInteractionFlags(Qt::TextBrowserInteraction);33m_ui.description->setOpenExternalLinks(true);34m_ui.description->setText(QStringLiteral(R"(35<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">36<html><head><meta name="qrichtext" content="1" /><style type="text/css">37p, li { white-space: pre-wrap; }38</style></head><body style=" font-size:10pt; font-weight:400; font-style:normal;">39<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%1</p>40<p style=" margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">%2</span>:</p>41<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> Connor McLaughlin <[email protected]></p>42<p style=" margin-top:0px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"> and other <a href="https://github.com/stenzek/duckstation/blob/master/CONTRIBUTORS.md">contributors</a></p>43<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%3 <a href="https://icons8.com/icon/74847/platforms.undefined.short-title"><span style=" text-decoration: underline; color:#0057ae;">icons8</span></a></p>44<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><a href="https://github.com/stenzek/duckstation/blob/master/LICENSE"><span style=" text-decoration: underline; color:#0057ae;">%4</span></a> | <a href="https://github.com/stenzek/duckstation"><span style=" text-decoration: underline; color:#0057ae;">GitHub</span></a> | <a href="https://www.duckstation.org/discord.html"><span style=" text-decoration: underline; color:#0057ae;">Discord</span></a></p></body></html>45)")46.arg(tr("DuckStation is a free simulator/emulator of the Sony PlayStation<span "47"style=\"vertical-align:super;\">TM</span> console, focusing on playability, "48"speed, and long-term maintainability."))49.arg(tr("Authors"))50.arg(tr("Icon by"))51.arg(tr("License")));52}5354AboutDialog::~AboutDialog() = default;5556void AboutDialog::showThirdPartyNotices(QWidget* parent)57{58QDialog dialog(parent);59dialog.setMinimumSize(700, 400);60dialog.setWindowTitle(tr("DuckStation Third-Party Notices"));6162QIcon icon;63icon.addFile(QString::fromUtf8(":/icons/duck.png"), QSize(), QIcon::Normal, QIcon::Off);64dialog.setWindowIcon(icon);6566QVBoxLayout* layout = new QVBoxLayout(&dialog);6768QTextBrowser* tb = new QTextBrowser(&dialog);69tb->setAcceptRichText(true);70tb->setReadOnly(true);71tb->setOpenExternalLinks(true);72if (std::optional<std::string> notice =73FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, "thirdparty.html").c_str());74notice.has_value())75{76tb->setText(QString::fromStdString(notice.value()));77}78else79{80tb->setText(tr("Missing thirdparty.html file. You should request it from where-ever you obtained DuckStation."));81}82layout->addWidget(tb, 1);8384QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, &dialog);85connect(bb, &QDialogButtonBox::rejected, &dialog, &QDialog::accept);86layout->addWidget(bb, 0);8788dialog.exec();89}909192