AboutDialog.cpp 4.3 KB

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