mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
Qt: Detach markup from dialog translations
This commit is contained in:
parent
b2ed787c3a
commit
ff40128df6
6 changed files with 72 additions and 60 deletions
|
@ -16,16 +16,12 @@ about_dialog::about_dialog(QWidget* parent) : QDialog(parent), ui(new Ui::about_
|
|||
ui->close->setDefault(true);
|
||||
ui->icon->load(QStringLiteral(":/rpcs3.svg"));
|
||||
ui->version->setText(tr("RPCS3 Version: %1").arg(QString::fromStdString(rpcs3::get_verbose_version())));
|
||||
ui->description->setText(tr(
|
||||
R"(
|
||||
<p style="white-space: nowrap;">
|
||||
RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.<br>
|
||||
It is written in C++ for Windows, Linux, FreeBSD and MacOS funded with <a %0 href="https://rpcs3.net/patreon">Patreon</a>.<br>
|
||||
Our developers and contributors are always working hard to ensure this project is the best that it can be.<br>
|
||||
There are still plenty of implementations to make and optimizations to do.
|
||||
</p>
|
||||
)"
|
||||
).arg(gui::utils::get_link_style()));
|
||||
ui->description->setText(gui::utils::make_paragraph(tr(
|
||||
"RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.\n"
|
||||
"It is written in C++ for Windows, Linux, FreeBSD and MacOS funded with %0.\n"
|
||||
"Our developers and contributors are always working hard to ensure this project is the best that it can be.\n"
|
||||
"There are still plenty of implementations to make and optimizations to do.")
|
||||
.arg(gui::utils::make_link(tr("Patreon"), "https://rpcs3.net/patreon"))));
|
||||
|
||||
// Events
|
||||
connect(ui->gitHub, &QPushButton::clicked, [] { QDesktopServices::openUrl(QUrl("https://www.github.com/RPCS3")); });
|
||||
|
|
|
@ -101,17 +101,15 @@ bool gui_application::Init()
|
|||
msg.setTextFormat(Qt::RichText);
|
||||
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msg.setDefaultButton(QMessageBox::No);
|
||||
msg.setText(tr(
|
||||
R"(
|
||||
<p style="white-space: nowrap;">
|
||||
Please understand that this build is not an official RPCS3 release.<br>
|
||||
This build contains changes that may break games, or even <b>damage</b> your data.<br>
|
||||
We recommend to download and use the official build from the <a %0 href='https://rpcs3.net/download'>RPCS3 website</a>.<br><br>
|
||||
Build origin: %1<br>
|
||||
Do you wish to use this build anyway?
|
||||
</p>
|
||||
)"
|
||||
).arg(gui::utils::get_link_style()).arg(Qt::convertFromPlainText(branch_name.data())));
|
||||
msg.setText(gui::utils::make_paragraph(tr(
|
||||
"Please understand that this build is not an official RPCS3 release.\n"
|
||||
"This build contains changes that may break games, or even <b>damage</b> your data.\n"
|
||||
"We recommend to download and use the official build from the %0.\n"
|
||||
"\n"
|
||||
"Build origin: %1\n"
|
||||
"Do you wish to use this build anyway?")
|
||||
.arg(gui::utils::make_link(tr("RPCS3 website"), "https://rpcs3.net/download"))
|
||||
.arg(Qt::convertFromPlainText(branch_name.data()))));
|
||||
msg.layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
||||
if (msg.exec() == QMessageBox::No)
|
||||
|
|
|
@ -232,6 +232,23 @@ namespace gui
|
|||
return QString("style=\"color: %0;\"").arg(get_link_color_string(name));
|
||||
}
|
||||
|
||||
QString make_link(const QString& text, const QString& url)
|
||||
{
|
||||
return QString("<a %0 href=\"%1\">%2</a>").arg(get_link_style()).arg(url).arg(text);
|
||||
}
|
||||
|
||||
QString make_bold(const QString& text)
|
||||
{
|
||||
return QString("<span style=\"font-weight:600;\">%0</span>").arg(text);
|
||||
}
|
||||
|
||||
QString make_paragraph(QString text, const QString& white_space_style)
|
||||
{
|
||||
return QString(R"(<p%0>%1</p>)")
|
||||
.arg(white_space_style.isEmpty() ? "" : "style=\"white-space: nowrap;\"")
|
||||
.arg(text.replace("\n", "<br>"));
|
||||
}
|
||||
|
||||
QPixmap get_centered_pixmap(QPixmap pixmap, const QSize& icon_size, int offset_x, int offset_y, qreal device_pixel_ratio, Qt::TransformationMode mode)
|
||||
{
|
||||
// Create empty canvas for expanded image
|
||||
|
|
|
@ -92,6 +92,15 @@ namespace gui
|
|||
// Returns the style for richtext <a> links. e.g. style="color: #123456;"
|
||||
QString get_link_style(const QString& name = "richtext_link_color");
|
||||
|
||||
// Returns a richtext link
|
||||
QString make_link(const QString& text, const QString& url);
|
||||
|
||||
// Returns a bold richtext string
|
||||
QString make_bold(const QString& text);
|
||||
|
||||
// Returns a richtext paragraph with white-space: nowrap;
|
||||
QString make_paragraph(QString text, const QString& white_space_style = "nowrap");
|
||||
|
||||
template <typename T>
|
||||
void set_font_size(T& qobj, int size)
|
||||
{
|
||||
|
|
|
@ -313,29 +313,25 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> gui_settings, std
|
|||
if (!utils::has_mpx())
|
||||
{
|
||||
title = tr("Haswell/Broadwell TSX Warning");
|
||||
message = tr(
|
||||
R"(
|
||||
<p style="white-space: nowrap;">
|
||||
RPCS3 has detected that you are using TSX functions on a Haswell or Broadwell CPU.<br>
|
||||
Intel has deactivated these functions in newer Microcode revisions, since they can lead to unpredicted behaviour.<br>
|
||||
That means using TSX may break games or even <font color="red"><b>damage</b></font> your data.<br>
|
||||
We recommend to disable this feature and update your computer BIOS.<br><br>
|
||||
Do you wish to use TSX anyway?
|
||||
</p>
|
||||
)");
|
||||
message = gui::utils::make_paragraph(tr(
|
||||
"RPCS3 has detected that you are using TSX functions on a Haswell or Broadwell CPU.\n"
|
||||
"Intel has deactivated these functions in newer Microcode revisions, since they can lead to unpredicted behaviour.\n"
|
||||
"That means using TSX may break games or even <font color=\"red\"><b>damage</b></font> your data.\n"
|
||||
"We recommend to disable this feature and update your computer BIOS.\n"
|
||||
"\n"
|
||||
"Do you wish to use TSX anyway?"
|
||||
));
|
||||
}
|
||||
else
|
||||
{
|
||||
title = tr("TSX-FA Warning");
|
||||
message = tr(
|
||||
R"(
|
||||
<p style="white-space: nowrap;">
|
||||
RPCS3 has detected your CPU only supports TSX-FA.<br>
|
||||
That means using TSX may break games or even <font color="red"><b>damage</b></font> your data.<br>
|
||||
We recommend to disable this feature.<br><br>
|
||||
Do you wish to use TSX anyway?
|
||||
</p>
|
||||
)");
|
||||
message = gui::utils::make_paragraph(tr(
|
||||
"RPCS3 has detected your CPU only supports TSX-FA.\n"
|
||||
"That means using TSX may break games or even <font color=\"red\"><b>damage</b></font> your data.\n"
|
||||
"We recommend to disable this feature.\n"
|
||||
"\n"
|
||||
"Do you wish to use TSX anyway?"
|
||||
));
|
||||
}
|
||||
|
||||
if (QMessageBox::No == QMessageBox::critical(this, title, message, QMessageBox::Yes, QMessageBox::No))
|
||||
|
|
|
@ -24,27 +24,23 @@ welcome_dialog::welcome_dialog(std::shared_ptr<gui_settings> gui_settings, bool
|
|||
|
||||
ui->icon_label->load(QStringLiteral(":/rpcs3.svg"));
|
||||
|
||||
ui->label_desc->setText(tr(
|
||||
R"(
|
||||
<p style="white-space: nowrap;">
|
||||
RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.<br>
|
||||
It is written in C++ for Windows, Linux, FreeBSD and MacOS funded with <a %0 href="https://rpcs3.net/patreon">Patreon</a>.<br>
|
||||
Our developers and contributors are always working hard to ensure this project is the best that it can be.<br>
|
||||
There are still plenty of implementations to make and optimizations to do.
|
||||
</p>
|
||||
)"
|
||||
).arg(gui::utils::get_link_style()));
|
||||
ui->label_desc->setText(gui::utils::make_paragraph(tr(
|
||||
"RPCS3 is an open-source Sony PlayStation 3 emulator and debugger.\n"
|
||||
"It is written in C++ for Windows, Linux, FreeBSD and MacOS funded with %0.\n"
|
||||
"Our developers and contributors are always working hard to ensure this project is the best that it can be.\n"
|
||||
"There are still plenty of implementations to make and optimizations to do.")
|
||||
.arg(gui::utils::make_link(tr("Patreon"), "https://rpcs3.net/patreon"))));
|
||||
|
||||
ui->label_info->setText(tr(
|
||||
R"(
|
||||
<p style="white-space: nowrap;">
|
||||
To get started, you must first install the <span style="font-weight:600;">PlayStation 3 firmware</span>.<br>
|
||||
Please refer to the <a %0 href="https://rpcs3.net/quickstart">Quickstart</a> guide found on the official website for further information.<br>
|
||||
If you have any further questions, please refer to the <a %0 href="https://rpcs3.net/faq">FAQ</a>.<br>
|
||||
Otherwise, further discussion and support can be found on the <a %0 href="https://forums.rpcs3.net">Forums</a> or on our <a %0 href="https://discord.me/RPCS3">Discord</a> server.
|
||||
</p>
|
||||
)"
|
||||
).arg(gui::utils::get_link_style()));
|
||||
ui->label_info->setText(gui::utils::make_paragraph(tr(
|
||||
"To get started, you must first install the %0.\n"
|
||||
"Please refer to the %1 guide found on the official website for further information.\n"
|
||||
"If you have any further questions, please refer to the %2.\n"
|
||||
"Otherwise, further discussion and support can be found on the %3 or on our %4 server.")
|
||||
.arg(gui::utils::make_bold(tr("PlayStation 3 firmware")))
|
||||
.arg(gui::utils::make_link(tr("Quickstart"), "https://rpcs3.net/quickstart"))
|
||||
.arg(gui::utils::make_link(tr("FAQ"), "https://rpcs3.net/faq"))
|
||||
.arg(gui::utils::make_link(tr("Forums"), "https://forums.rpcs3.net"))
|
||||
.arg(gui::utils::make_link(tr("Discord"), "https://discord.me/RPCS3"))));
|
||||
|
||||
#ifdef __APPLE__
|
||||
ui->create_applications_menu_shortcut->setText(tr("&Create Launchpad shortcut"));
|
||||
|
|
Loading…
Add table
Reference in a new issue