Qt/AboutDialog: Clean up code a bit

This commit is contained in:
spycrab 2019-10-13 16:04:13 +02:00
parent 5be061e27f
commit 1975e57b73
1 changed files with 57 additions and 42 deletions

View File

@ -5,6 +5,7 @@
#include <QLabel> #include <QLabel>
#include <QTextEdit> #include <QTextEdit>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QtGlobal>
#include "Common/Version.h" #include "Common/Version.h"
@ -16,56 +17,70 @@ AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
setWindowTitle(tr("About Dolphin")); setWindowTitle(tr("About Dolphin"));
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
const QString small = const QString text =
QStringLiteral("<p style='margin-top:0; margin-bottom:0; font-size:small;'>"); QStringLiteral(R"(
const QString medium = QStringLiteral("<p style='margin-top:15px;'>"); <p style='font-size:38pt; font-weight:400;'>Dolphin</p>
QString text; <p style='font-size:18pt;'>%VERSION_STRING%</p>
text.append(QStringLiteral("<p style='font-size:38pt; font-weight:400; margin-bottom:0;'>") +
tr("Dolphin") + QStringLiteral("</p>"));
text.append(QStringLiteral("<p style='font-size:18pt; margin-top:0;'>%1</p>")
.arg(QString::fromUtf8(Common::scm_desc_str.c_str())));
text.append(small + tr("Branch: ") + QString::fromUtf8(Common::scm_branch_str.c_str()) + <p style='font-size: small;'>
QStringLiteral("</p>")); %BRANCH%:<br>
text.append(small + tr("Revision: ") + QString::fromUtf8(Common::scm_rev_git_str.c_str()) + %REVISION%<br><br>
QStringLiteral("</p>")); %QT_VERSION%
</p>
text.append(medium + tr("Check for updates: ") + <p>
QStringLiteral( %CHECK_FOR_UPDATES%: <a href='https://dolphin-emu.org/download'>dolphin-emu.org/download</a>
"<a href='https://dolphin-emu.org/download'>dolphin-emu.org/download</a></p>")); </p>
<p>
%ABOUT_DOLPHIN%
</p>
<p>
%GAMES_YOU_OWN%
</p>
<p>
<a href='https://github.com/dolphin-emu/dolphin/blob/master/license.txt'>%LICENSE%</a> |
<a href='https://github.com/dolphin-emu/dolphin/graphs/contributors'>%AUTHORS%</a> |
<a href='https://forums.dolphin-emu.org/'>%SUPPORT%</a>
)")
.replace(QStringLiteral("%VERSION_STRING%"),
QString::fromUtf8(Common::scm_desc_str.c_str()))
.replace(QStringLiteral("%BRANCH%"),
// i18n: "Branch" means the version control term, not a literal tree branch.
tr("Branch: %1").arg(QString::fromUtf8(Common::scm_branch_str.c_str())))
.replace(QStringLiteral("%REVISION%"),
tr("Revision: %1").arg(QString::fromUtf8(Common::scm_rev_git_str.c_str())))
.replace(QStringLiteral("%QT_VERSION%"),
tr("Using Qt %1").arg(QStringLiteral(QT_VERSION_STR)))
.replace(QStringLiteral("%CHECK_FOR_UPDATES%"), tr("Check for updates"))
.replace(QStringLiteral("%ABOUT_DOLPHIN%"),
// i18n: The word "free" in the standard phrase "free and open source" // i18n: The word "free" in the standard phrase "free and open source"
// is "free" as in "freedom" - it refers to certain properties of the // is "free" as in "freedom" - it refers to certain properties of the
// software's license, not the software's price. (It is true that Dolphin // software's license, not the software's price. (It is true that Dolphin
// can be downloaded at no cost, but that's not what this message says.) // can be downloaded at no cost, but that's not what this message says.)
text.append(medium + tr("Dolphin is a free and open-source GameCube and Wii emulator.") + tr("Dolphin is a free and open-source GameCube and Wii emulator."))
QStringLiteral("</p>")); .replace(QStringLiteral("%GAMES_YOU_OWN%"),
text.append(medium + tr("This software should not be used to play games you do not legally own."))
tr("This software should not be used to play games you do not legally own.") + .replace(QStringLiteral("%LICENSE%"), tr("License"))
QStringLiteral("</p>")); .replace(QStringLiteral("%AUTHORS%"), tr("Authors"))
text.append( .replace(QStringLiteral("%SUPPORT%"), tr("Support"));
medium +
QStringLiteral(
"<a href='https://github.com/dolphin-emu/dolphin/blob/master/license.txt'>%1</a> | "
"<a href='https://github.com/dolphin-emu/dolphin/graphs/contributors'>%2</a> | "
"<a href='https://forums.dolphin-emu.org/'>%3</a></p>")
.arg(tr("License"))
.arg(tr("Authors"))
.arg(tr("Support")));
QLabel* text_label = new QLabel(text); QLabel* text_label = new QLabel(text);
text_label->setTextInteractionFlags(Qt::TextBrowserInteraction); text_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
text_label->setOpenExternalLinks(true); text_label->setOpenExternalLinks(true);
QLabel* copyright = QLabel* copyright = new QLabel(
new QLabel(small + QStringLiteral("<small>%1</small>")
.arg(
// i18n: This message uses curly quotes in English. If you want to use curly quotes // i18n: This message uses curly quotes in English. If you want to use curly quotes
// in your translation, please use the type of curly quotes that's appropriate for // in your translation, please use the type of curly quotes that's appropriate for
// your language. If you aren't sure which type is appropriate, see // your language. If you aren't sure which type is appropriate, see
// https://en.wikipedia.org/wiki/Quotation_mark#Specific_language_features // https://en.wikipedia.org/wiki/Quotation_mark#Specific_language_features
tr("\u00A9 2003-2015+ Dolphin Team. \u201cGameCube\u201d and \u201cWii\u201d are " tr("\u00A9 2003-2015+ Dolphin Team. \u201cGameCube\u201d and \u201cWii\u201d are "
"trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way.") + "trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way.")));
QStringLiteral("</p>"));
QLabel* logo = new QLabel(); QLabel* logo = new QLabel();
logo->setPixmap(Resources::GetMisc(Resources::MiscID::LogoLarge)); logo->setPixmap(Resources::GetMisc(Resources::MiscID::LogoLarge));