Path: blob/master/src/duckstation-qt/aboutdialog.cpp
4802 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;"> <a href="https://github.com/stenzek/duckstation/blob/master/CONTRIBUTORS.md"><span style=" text-decoration: none;">%3</span></a></p>43<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%4 <a href="https://icons8.com/icon/74847/platforms.undefined.short-title"><span style=" text-decoration: none;">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: none;">%5</span></a> | <a href="https://github.com/stenzek/duckstation"><span style=" text-decoration: none;">GitHub</span></a> | <a href="https://www.duckstation.org/discord.html"><span style=" text-decoration: none;">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("and other contributors"))51.arg(tr("Icon by"))52.arg(tr("License")));53}5455AboutDialog::~AboutDialog() = default;5657void AboutDialog::showThirdPartyNotices(QWidget* parent)58{59QDialog dialog(parent);60dialog.setMinimumSize(700, 400);61dialog.setWindowTitle(tr("DuckStation Third-Party Notices"));6263QIcon icon;64icon.addFile(QString::fromUtf8(":/icons/duck.png"), QSize(), QIcon::Normal, QIcon::Off);65dialog.setWindowIcon(icon);6667QVBoxLayout* layout = new QVBoxLayout(&dialog);6869QTextBrowser* tb = new QTextBrowser(&dialog);70tb->setAcceptRichText(true);71tb->setReadOnly(true);72tb->setOpenExternalLinks(true);73if (std::optional<std::string> notice =74FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, "thirdparty.html").c_str());75notice.has_value())76{77tb->setText(QString::fromStdString(notice.value()));78}79else80{81tb->setText(tr("Missing thirdparty.html file. You should request it from where-ever you obtained DuckStation."));82}83layout->addWidget(tb, 1);8485QDialogButtonBox* bb = new QDialogButtonBox(QDialogButtonBox::Close, &dialog);86connect(bb, &QDialogButtonBox::rejected, &dialog, &QDialog::accept);87layout->addWidget(bb, 0);8889dialog.exec();90}919293