mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-04-10 22:48:56 +02:00
Some genius decided to put the entire MainWindow class into main.h and main.cpp, which is not only horrific practice but also completely destroys clangd beyond repair. Please, just don't do this. (this will probably merge conflict to hell and back) Also, fixes a bunch of issues with Ryujinx save data link: - Paths with spaces would cause mklink to fail - Add support for portable directories - Symlink detection was incorrect sometimes(????) - Some other stuff I'm forgetting Furthermore, when selecting "From Eden" and attempting to save in Ryujinx, Ryujinx would destroy the link for... some reason? So to get around this we just copy the Eden data to Ryujinx then treat it like a "From Ryujinx" op Signed-off-by: crueter <crueter@eden-emu.dev> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/2929 Reviewed-by: Lizzie <lizzie@eden-emu.dev> Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
71 lines
3 KiB
C++
71 lines
3 KiB
C++
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
#include <QDateTime>
|
|
#include "yuzu/applets/qt_error.h"
|
|
#include "yuzu/main_window.h"
|
|
|
|
QtErrorDisplay::QtErrorDisplay(MainWindow& parent) {
|
|
connect(this, &QtErrorDisplay::MainWindowDisplayError, &parent,
|
|
&MainWindow::ErrorDisplayDisplayError, Qt::QueuedConnection);
|
|
connect(this, &QtErrorDisplay::MainWindowRequestExit, &parent,
|
|
&MainWindow::ErrorDisplayRequestExit, Qt::QueuedConnection);
|
|
connect(&parent, &MainWindow::ErrorDisplayFinished, this,
|
|
&QtErrorDisplay::MainWindowFinishedError, Qt::DirectConnection);
|
|
}
|
|
|
|
QtErrorDisplay::~QtErrorDisplay() = default;
|
|
|
|
void QtErrorDisplay::Close() const {
|
|
callback = {};
|
|
emit MainWindowRequestExit();
|
|
}
|
|
|
|
void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const {
|
|
callback = std::move(finished);
|
|
emit MainWindowDisplayError(
|
|
tr("Error Code: %1-%2 (0x%3)")
|
|
.arg(static_cast<u32>(error.GetModule()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
|
.arg(error.GetDescription(), 4, 10, 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(Result error, std::chrono::seconds time,
|
|
FinishedCallback finished) const {
|
|
callback = std::move(finished);
|
|
|
|
const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count());
|
|
emit MainWindowDisplayError(
|
|
tr("Error Code: %1-%2 (0x%3)")
|
|
.arg(static_cast<u32>(error.GetModule()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
|
.arg(error.GetDescription(), 4, 10, 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(Result error, std::string dialog_text,
|
|
std::string fullscreen_text,
|
|
FinishedCallback finished) const {
|
|
callback = std::move(finished);
|
|
emit MainWindowDisplayError(
|
|
tr("Error Code: %1-%2 (0x%3)")
|
|
.arg(static_cast<u32>(error.GetModule()) + 2000, 4, 10, QChar::fromLatin1('0'))
|
|
.arg(error.GetDescription(), 4, 10, 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)));
|
|
}
|
|
|
|
void QtErrorDisplay::MainWindowFinishedError() {
|
|
if (callback) {
|
|
callback();
|
|
}
|
|
}
|