| 1 | // Copyright 2016 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/AboutDialog.h" |
| 5 | |
| 6 | #include <QLabel> |
| 7 | #include <QTextEdit> |
| 8 | #include <QVBoxLayout> |
| 9 | #include <QtGlobal> |
| 10 | |
| 11 | #include "Common/Version.h" |
| 12 | |
| 13 | #include "DolphinQt/Resources.h" |
| 14 | |
| 15 | AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent) |
| 16 | { |
| 17 | setWindowTitle(tr("About Dolphin")); |
| 18 | |
| 19 | QString branch_str = QString::fromStdString(Common::GetScmBranchStr()); |
| 20 | const int commits_ahead = Common::GetScmCommitsAheadMaster(); |
| 21 | if (commits_ahead > 0) |
| 22 | { |
| 23 | branch_str = tr("%1 (%2)").arg( |
| 24 | branch_str, |
| 25 | // i18n: A positive number of version control commits made compared to some named branch |
| 26 | tr("%1 commit(s) ahead of %2").arg(commits_ahead).arg(QStringLiteral("master"))); |
| 27 | } |
| 28 | |
| 29 | const QString text = |
| 30 | QStringLiteral(R"( |
| 31 | <p style='font-size:38pt; font-weight:400;'>Dolphin</p> |
| 32 | |
| 33 | <p style='font-size:18pt;'>%VERSION_STRING%</p> |
| 34 | |
| 35 | <p style='font-size: small;'> |
| 36 | %BRANCH%<br> |
| 37 | %REVISION%<br><br> |
| 38 | %QT_VERSION% |
| 39 | </p> |
| 40 | |
| 41 | <p> |
| 42 | %CHECK_FOR_UPDATES%: <a href='https://dolphin-emu.org/download'>dolphin-emu.org/download</a> |
| 43 | </p> |
| 44 | |
| 45 | <p> |
| 46 | %ABOUT_DOLPHIN% |
| 47 | </p> |
| 48 | |
| 49 | <p> |
| 50 | %GAMES_YOU_OWN% |
| 51 | </p> |
| 52 | |
| 53 | <p> |
| 54 | <a href='https://github.com/dolphin-emu/dolphin/blob/master/COPYING'>%LICENSE%</a> | |
| 55 | <a href='https://github.com/dolphin-emu/dolphin/graphs/contributors'>%AUTHORS%</a> | |
| 56 | <a href='https://forums.dolphin-emu.org/'>%SUPPORT%</a> |
| 57 | )") |
| 58 | .replace(QStringLiteral("%VERSION_STRING%"), |
| 59 | QString::fromUtf8(Common::GetScmDescStr().c_str())) |
| 60 | .replace(QStringLiteral("%BRANCH%"), |
| 61 | // i18n: "Branch" means the version control term, not a literal tree branch. |
| 62 | tr("Branch: %1").arg(branch_str)) |
| 63 | .replace(QStringLiteral("%REVISION%"), |
| 64 | tr("Revision: %1").arg(QString::fromUtf8(Common::GetScmRevGitStr().c_str()))) |
| 65 | .replace(QStringLiteral("%QT_VERSION%"), |
| 66 | tr("Using Qt %1").arg(QStringLiteral(QT_VERSION_STR))) |
| 67 | .replace(QStringLiteral("%CHECK_FOR_UPDATES%"), tr("Check for updates")) |
| 68 | .replace(QStringLiteral("%ABOUT_DOLPHIN%"), |
| 69 | // i18n: The word "free" in the standard phrase "free and open source" |
| 70 | // is "free" as in "freedom" - it refers to certain properties of the |
| 71 | // software's license, not the software's price. (It is true that Dolphin |
| 72 | // can be downloaded at no cost, but that's not what this message says.) |
| 73 | tr("Dolphin is a free and open-source GameCube and Wii emulator.")) |
| 74 | .replace(QStringLiteral("%GAMES_YOU_OWN%"), |
| 75 | tr("This software should not be used to play games you do not legally own.")) |
| 76 | .replace(QStringLiteral("%LICENSE%"), tr("License")) |
| 77 | .replace(QStringLiteral("%AUTHORS%"), tr("Authors")) |
| 78 | .replace(QStringLiteral("%SUPPORT%"), tr("Support")); |
| 79 | |
| 80 | QLabel* text_label = new QLabel(text); |
| 81 | text_label->setTextInteractionFlags(Qt::TextBrowserInteraction); |
| 82 | text_label->setOpenExternalLinks(true); |
| 83 | |
| 84 | QLabel* copyright = new QLabel( |
| 85 | QStringLiteral("<small>%1</small>") |
| 86 | .arg( |
| 87 | // i18n: This message uses curly quotes in English. If you want to use curly quotes |
| 88 | // in your translation, please use the type of curly quotes that's appropriate for |
| 89 | // your language. If you aren't sure which type is appropriate, see |
| 90 | // https://en.wikipedia.org/wiki/Quotation_mark#Specific_language_features |
| 91 | tr("\u00A9 2003-2024+ Dolphin Team. \u201cGameCube\u201d and \u201cWii\u201d are " |
| 92 | "trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way."))); |
| 93 | |
| 94 | QLabel* logo = new QLabel(); |
| 95 | logo->setPixmap(Resources::GetAppIcon().pixmap(200, 200)); |
| 96 | logo->setContentsMargins(30, 0, 30, 0); |
| 97 | |
| 98 | QVBoxLayout* main_layout = new QVBoxLayout; |
| 99 | QHBoxLayout* h_layout = new QHBoxLayout; |
| 100 | |
| 101 | setLayout(main_layout); |
| 102 | main_layout->setSizeConstraint(QLayout::SetFixedSize); |
| 103 | main_layout->addLayout(h_layout); |
| 104 | main_layout->addWidget(copyright); |
| 105 | copyright->setAlignment(Qt::AlignCenter); |
| 106 | copyright->setContentsMargins(0, 15, 0, 0); |
| 107 | |
| 108 | h_layout->setAlignment(Qt::AlignLeft); |
| 109 | h_layout->addWidget(logo); |
| 110 | h_layout->addWidget(text_label); |
| 111 | } |