summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/AboutDialog.cpp
blob: 5261decdbdc4b735ea1b09183ab673a3058fef01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Copyright 2016 Dolphin Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later

#include "DolphinQt/AboutDialog.h"

#include <QLabel>
#include <QTextEdit>
#include <QVBoxLayout>
#include <QtGlobal>
#ifdef HAVE_SDL3
#include <SDL3/SDL_version.h>
#endif

#include "Common/Version.h"

#include "DolphinQt/Resources.h"

AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
{
  setWindowTitle(tr("About Dolphin"));

  QString branch_str = QString::fromStdString(Common::GetScmBranchStr());
  const int commits_ahead = Common::GetScmCommitsAheadMaster();
  if (commits_ahead > 0)
  {
    branch_str = tr("%1 (%2)").arg(
        branch_str,
        // i18n: A positive number of version control commits made compared to some named branch
        tr("%1 commit(s) ahead of %2").arg(commits_ahead).arg(QStringLiteral("master")));
  }

#ifdef HAVE_SDL3
  const int sdl_version = SDL_GetVersion();
  QString sdl_str = QString::fromStdString("%1.%2.%3")
                        .arg(SDL_VERSIONNUM_MAJOR(sdl_version))
                        .arg(SDL_VERSIONNUM_MINOR(sdl_version))
                        .arg(SDL_VERSIONNUM_MICRO(sdl_version));
#endif

  const QString text =
      QStringLiteral(R"(
<p style='font-size:38pt; font-weight:400;'>Dolphin</p>

<p style='font-size:18pt;'>%VERSION_STRING%</p>

<p style='font-size: small;'>
%BRANCH%<br>
%REVISION%<br><br>
%QT_VERSION%<br>
%SDL_VERSION%
</p>

<p>
%CHECK_FOR_UPDATES%: <a href='https://dolphin-emu.org/download'>dolphin-emu.org/download</a>
</p>

<p>
%ABOUT_DOLPHIN%
</p>

<p>
%GAMES_YOU_OWN%
</p>

<p>
<a href='https://github.com/dolphin-emu/dolphin/blob/master/COPYING'>%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::GetScmDescStr().c_str()))
          .replace(QStringLiteral("%BRANCH%"),
                   // i18n: "Branch" means the version control term, not a literal tree branch.
                   tr("Branch: %1").arg(branch_str))
          .replace(QStringLiteral("%REVISION%"),
                   tr("Revision: %1").arg(QString::fromUtf8(Common::GetScmRevGitStr().c_str())))
          .replace(QStringLiteral("%QT_VERSION%"),
                   tr("Using Qt %1").arg(QStringLiteral(QT_VERSION_STR)))
#ifdef HAVE_SDL3
          .replace(QStringLiteral("%SDL_VERSION%"), tr("Using SDL %1").arg(sdl_str))
#else
          .replace(QStringLiteral("%SDL_VERSION%"), tr("SDL disabled"))
#endif
          .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"
                   // 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
                   // can be downloaded at no cost, but that's not what this message says.)
                   tr("Dolphin is a free and open-source GameCube and Wii emulator."))
          .replace(QStringLiteral("%GAMES_YOU_OWN%"),
                   tr("This software should not be used to play games you do not legally own."))
          .replace(QStringLiteral("%LICENSE%"), tr("License"))
          .replace(QStringLiteral("%AUTHORS%"), tr("Authors"))
          .replace(QStringLiteral("%SUPPORT%"), tr("Support"));

  QLabel* text_label = new QLabel(text);
  text_label->setTextInteractionFlags(Qt::TextBrowserInteraction);
  text_label->setOpenExternalLinks(true);

  QLabel* copyright = new QLabel(
      QStringLiteral("<small>%1</small>")
          .arg(
              // 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
              // your language. If you aren't sure which type is appropriate, see
              // https://en.wikipedia.org/wiki/Quotation_mark#Specific_language_features
              tr("\u00A9 2003-2024+ Dolphin Team. \u201cGameCube\u201d and \u201cWii\u201d are "
                 "trademarks of Nintendo. Dolphin is not affiliated with Nintendo in any way.")));

  QLabel* logo = new QLabel();
  logo->setPixmap(Resources::GetAppIcon().pixmap(200, 200));
  logo->setContentsMargins(30, 0, 30, 0);

  QVBoxLayout* main_layout = new QVBoxLayout;
  QHBoxLayout* h_layout = new QHBoxLayout;

  setLayout(main_layout);
  main_layout->setSizeConstraint(QLayout::SetFixedSize);
  main_layout->addLayout(h_layout);
  main_layout->addWidget(copyright);
  copyright->setAlignment(Qt::AlignCenter);
  copyright->setContentsMargins(0, 15, 0, 0);

  h_layout->setAlignment(Qt::AlignLeft);
  h_layout->addWidget(logo);
  h_layout->addWidget(text_label);
}