Path: blob/master/src/duckstation-qt/aboutdialog.cpp
7468 views
// SPDX-FileCopyrightText: 2019-2025 Connor McLaughlin <[email protected]>1// SPDX-License-Identifier: CC-BY-NC-ND-4.023#include "aboutdialog.h"4#include "qthost.h"5#include "qtutils.h"67#include "core/settings.h"89#include "common/file_system.h"10#include "common/path.h"1112#include "scmversion/scmversion.h"1314#include <QtCore/QString>15#include <QtWidgets/QDialog>16#include <QtWidgets/QDialogButtonBox>17#include <QtWidgets/QPushButton>18#include <QtWidgets/QTextBrowser>1920#include "moc_aboutdialog.cpp"2122AboutDialog::AboutDialog(QWidget* parent /* = nullptr */) : QDialog(parent)23{24m_ui.setupUi(this);25m_ui.icon->setPixmap(QtHost::GetAppLogo());2627setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);28setFixedSize(geometry().width(), geometry().height());2930QFont title_font(m_ui.title->font());31title_font.setPixelSize(20);32m_ui.title->setFont(title_font);3334m_ui.scmversion->setText(35tr("%1 (%2)").arg(QLatin1StringView(g_scm_tag_str)).arg(QLatin1StringView(g_scm_branch_str)));3637m_ui.description->setText(QStringLiteral(R"(38<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">39<html><head><meta name="qrichtext" content="1" /><style type="text/css">40p, li { white-space: pre-wrap; }41</style></head><body style=" font-size:10pt; font-weight:400; font-style:normal;">42<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">%1</p>43<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>44<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>45<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>46<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>47<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>48)")49.arg(tr("DuckStation is a free simulator/emulator of the Sony PlayStation<span "50"style=\"vertical-align:super;\">TM</span> console, focusing on playability, "51"speed, and long-term maintainability."))52.arg(tr("Authors"))53.arg(tr("and other contributors"))54.arg(tr("Icon by"))55.arg(tr("License")));5657connect(m_ui.buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);58}5960AboutDialog::~AboutDialog() = default;6162void AboutDialog::openThirdPartyNotices(QWidget* parent)63{64QDialog* const dialog = new QDialog(parent);65dialog->setAttribute(Qt::WA_DeleteOnClose);66dialog->setMinimumSize(700, 400);67dialog->setWindowTitle(tr("DuckStation Third-Party Notices"));6869QVBoxLayout* const layout = new QVBoxLayout(dialog);70QTextBrowser* const tb = new QTextBrowser(dialog);71tb->setAcceptRichText(true);72tb->setReadOnly(true);73tb->setOpenExternalLinks(true);74if (std::optional<std::string> notice =75FileSystem::ReadFileToString(Path::Combine(EmuFolders::Resources, "thirdparty.html").c_str());76notice.has_value())77{78tb->setText(QString::fromStdString(notice.value()));79}80else81{82tb->setText(tr("Missing thirdparty.html file. You should request it from where-ever you obtained DuckStation."));83}84layout->addWidget(tb, 1);8586QDialogButtonBox* const bb = new QDialogButtonBox(QDialogButtonBox::Ok, dialog);87connect(bb, &QDialogButtonBox::accepted, dialog, &QDialog::accept);88layout->addWidget(bb, 0);8990dialog->open();91}929394