error: Make the error code as the title text of the OverlayDialog
Co-authored-by: Its-Rei <kupfel@gmail.com>
This commit is contained in:
parent
4143675b2d
commit
b45930a0ed
|
@ -19,11 +19,11 @@ QtErrorDisplay::~QtErrorDisplay() = default;
|
|||
void QtErrorDisplay::ShowError(ResultCode error, std::function<void()> finished) const {
|
||||
callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
tr("An error has occurred.\nPlease try again or contact the developer of the "
|
||||
"software.\n\nError Code: %1-%2 (0x%3)")
|
||||
tr("Error Code: %1-%2 (0x%3)")
|
||||
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
||||
.arg(error.description, 4, 10, QChar::fromLatin1('0'))
|
||||
.arg(error.raw, 8, 16, QChar::fromLatin1('0')));
|
||||
.arg(error.raw, 8, 16, QChar::fromLatin1('0')),
|
||||
tr("An error has occurred.\nPlease try again or contact the developer of the software."));
|
||||
}
|
||||
|
||||
void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time,
|
||||
|
@ -32,13 +32,14 @@ void QtErrorDisplay::ShowErrorWithTimestamp(ResultCode error, std::chrono::secon
|
|||
|
||||
const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count());
|
||||
emit MainWindowDisplayError(
|
||||
tr("An error occurred on %1 at %2.\nPlease try again or contact the "
|
||||
"developer of the software.\n\nError Code: %3-%4 (0x%5)")
|
||||
.arg(date_time.toString(QStringLiteral("dddd, MMMM d, yyyy")))
|
||||
.arg(date_time.toString(QStringLiteral("h:mm:ss A")))
|
||||
tr("Error Code: %1-%2 (0x%3)")
|
||||
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
||||
.arg(error.description, 4, 10, QChar::fromLatin1('0'))
|
||||
.arg(error.raw, 8, 16, QChar::fromLatin1('0')));
|
||||
.arg(error.raw, 8, 16, QChar::fromLatin1('0')),
|
||||
tr("An error occurred on %1 at %2.\nPlease try again or contact the developer of the "
|
||||
"software.")
|
||||
.arg(date_time.toString(QStringLiteral("dddd, MMMM d, yyyy")))
|
||||
.arg(date_time.toString(QStringLiteral("h:mm:ss A"))));
|
||||
}
|
||||
|
||||
void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_text,
|
||||
|
@ -46,10 +47,11 @@ void QtErrorDisplay::ShowCustomErrorText(ResultCode error, std::string dialog_te
|
|||
std::function<void()> finished) const {
|
||||
callback = std::move(finished);
|
||||
emit MainWindowDisplayError(
|
||||
tr("An error has occurred.\nError Code: %1-%2 (0x%3)\n\n%4\n\n%5")
|
||||
tr("Error Code: %1-%2 (0x%3)")
|
||||
.arg(static_cast<u32>(error.module.Value()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
||||
.arg(error.description, 4, 10, QChar::fromLatin1('0'))
|
||||
.arg(error.raw, 8, 16, QChar::fromLatin1('0'))
|
||||
.arg(error.raw, 8, 16, QChar::fromLatin1('0')),
|
||||
tr("An error has occurred.\n\n%1\n\n%2")
|
||||
.arg(QString::fromStdString(dialog_text))
|
||||
.arg(QString::fromStdString(fullscreen_text)));
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ public:
|
|||
std::function<void()> finished) const override;
|
||||
|
||||
signals:
|
||||
void MainWindowDisplayError(QString error) const;
|
||||
void MainWindowDisplayError(QString error_code, QString error_text) const;
|
||||
|
||||
private:
|
||||
void MainWindowFinishedError();
|
||||
|
|
|
@ -2266,9 +2266,9 @@ void GMainWindow::OnExecuteProgram(std::size_t program_index) {
|
|||
BootGame(last_filename_booted, program_index);
|
||||
}
|
||||
|
||||
void GMainWindow::ErrorDisplayDisplayError(QString body) {
|
||||
OverlayDialog dialog(render_window, Core::System::GetInstance(), body, QString{}, tr("OK"),
|
||||
Qt::AlignLeft | Qt::AlignVCenter);
|
||||
void GMainWindow::ErrorDisplayDisplayError(QString error_code, QString error_text) {
|
||||
OverlayDialog dialog(render_window, Core::System::GetInstance(), error_code, error_text,
|
||||
QString{}, tr("OK"), Qt::AlignLeft | Qt::AlignVCenter);
|
||||
dialog.exec();
|
||||
|
||||
emit ErrorDisplayFinished();
|
||||
|
|
|
@ -143,7 +143,7 @@ public slots:
|
|||
void OnExecuteProgram(std::size_t program_index);
|
||||
void ControllerSelectorReconfigureControllers(
|
||||
const Core::Frontend::ControllerParameters& parameters);
|
||||
void ErrorDisplayDisplayError(QString body);
|
||||
void ErrorDisplayDisplayError(QString error_code, QString error_text);
|
||||
void ProfileSelectorSelectProfile();
|
||||
void WebBrowserOpenWebPage(std::string_view main_url, std::string_view additional_args,
|
||||
bool is_local);
|
||||
|
|
Reference in New Issue