mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 12:12:50 +01:00
Qt: support fatal error as htmk
This commit is contained in:
parent
ca0ca2e5a8
commit
a6b44ea1bb
@ -96,7 +96,7 @@ thread_local bool g_tls_access_violation_recovered = false;
|
||||
extern thread_local std::string(*g_tls_log_prefix)();
|
||||
|
||||
// Report error and call std::abort(), defined in main.cpp
|
||||
[[noreturn]] void report_fatal_error(std::string_view);
|
||||
[[noreturn]] void report_fatal_error(std::string_view, bool = false);
|
||||
|
||||
std::string dump_useful_thread_info()
|
||||
{
|
||||
|
@ -93,7 +93,7 @@ thread_local std::string_view g_tls_serialize_name;
|
||||
extern thread_local std::string(*g_tls_log_prefix)();
|
||||
|
||||
// Report error and call std::abort(), defined in main.cpp
|
||||
[[noreturn]] void report_fatal_error(std::string_view);
|
||||
[[noreturn]] void report_fatal_error(std::string_view, bool = false);
|
||||
|
||||
void initialize_timebased_time(u64 timebased_init, bool reset = false);
|
||||
|
||||
|
@ -91,7 +91,7 @@ extern char **environ;
|
||||
LOG_CHANNEL(sys_log, "SYS");
|
||||
LOG_CHANNEL(q_debug, "QDEBUG");
|
||||
|
||||
[[noreturn]] extern void report_fatal_error(std::string_view _text)
|
||||
[[noreturn]] extern void report_fatal_error(std::string_view _text, bool is_html = false)
|
||||
{
|
||||
#ifdef __linux__
|
||||
extern void jit_announce(uptr, usz, std::string_view);
|
||||
@ -151,9 +151,9 @@ LOG_CHANNEL(q_debug, "QDEBUG");
|
||||
std::cerr << fmt::format("RPCS3: %s\n", text);
|
||||
}
|
||||
|
||||
static auto show_report = [](std::string_view text)
|
||||
static auto show_report = [is_html](std::string_view text)
|
||||
{
|
||||
fatal_error_dialog dlg(text);
|
||||
fatal_error_dialog dlg(text, is_html);
|
||||
dlg.exec();
|
||||
};
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
#include <Utilities/StrUtil.h>
|
||||
#include <Utilities/StrFmt.h>
|
||||
|
||||
[[noreturn]] void report_fatal_error(std::string_view);
|
||||
[[noreturn]] void report_fatal_error(std::string_view, bool);
|
||||
|
||||
// Validates that system modules are properly installed
|
||||
// Only relevant for WIN32
|
||||
@ -53,16 +53,18 @@ class WIN32_module_verifier
|
||||
if (s.find(system_root) != 0)
|
||||
{
|
||||
const auto error_message = fmt::format(
|
||||
"The module '%s' was incorrectly installed.\n"
|
||||
"This module is part of the '%s' package.\n"
|
||||
"You can install this package from this URL:\n"
|
||||
"<a href='%s'>%s</a>",
|
||||
"<p>"
|
||||
"The module '%s' was incorrectly installed.<br>"
|
||||
"This module is part of the '%s' package.<br>"
|
||||
"You can install this package from this URL:<br>"
|
||||
"<a href='%s'>%s</a>"
|
||||
"</p>",
|
||||
wchar_to_utf8(module.name),
|
||||
module.package_name,
|
||||
module.dl_link,
|
||||
module.dl_link
|
||||
);
|
||||
report_fatal_error(error_message);
|
||||
report_fatal_error(error_message, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,19 +4,10 @@
|
||||
#include <QTextDocument>
|
||||
#include <QIcon>
|
||||
|
||||
static QString process_dialog_text(std::string_view text)
|
||||
fatal_error_dialog::fatal_error_dialog(std::string_view text, bool is_html) : QMessageBox()
|
||||
{
|
||||
auto html = Qt::convertFromPlainText(QString::fromUtf8(text.data(), text.size()));
|
||||
const QString msg = QString::fromUtf8(text.data(), text.size());
|
||||
|
||||
// Let's preserve some html elements destroyed by convertFromPlainText
|
||||
const QRegExp link_re{ R"(<a\shref='([a-z0-9?=&#:\/\.\-]+)'>([a-z0-9?=&#:\/\.\-]+)<\/a>)", Qt::CaseSensitive, QRegExp::RegExp2};
|
||||
html = html.replace(link_re, "<a href=\\1>\\2</a>");
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
fatal_error_dialog::fatal_error_dialog(std::string_view text) : QMessageBox()
|
||||
{
|
||||
#ifndef __APPLE__
|
||||
setWindowIcon(QIcon(":/rpcs3.ico"));
|
||||
#endif
|
||||
@ -24,14 +15,17 @@ fatal_error_dialog::fatal_error_dialog(std::string_view text) : QMessageBox()
|
||||
setIcon(QMessageBox::Icon::Critical);
|
||||
setTextFormat(Qt::TextFormat::RichText);
|
||||
setText(QString(R"(
|
||||
<p style="white-space: nowrap;">
|
||||
<style>
|
||||
p {white-space: nowrap;}
|
||||
</style>
|
||||
<p>
|
||||
%1<br>
|
||||
%2<br>
|
||||
<a href='https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support'>https://github.com/RPCS3/rpcs3/wiki/How-to-ask-for-Support</a><br>
|
||||
%3<br>
|
||||
</p>
|
||||
)")
|
||||
.arg(process_dialog_text(text))
|
||||
.arg(is_html ? msg : Qt::convertFromPlainText(msg))
|
||||
.arg(tr("HOW TO REPORT ERRORS:"))
|
||||
.arg(tr("Please, don't send incorrect reports. Thanks for understanding.")));
|
||||
layout()->setSizeConstraint(QLayout::SetFixedSize);
|
||||
|
@ -9,5 +9,5 @@ class fatal_error_dialog : public QMessageBox
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit fatal_error_dialog(std::string_view text);
|
||||
explicit fatal_error_dialog(std::string_view text, bool is_html);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user