summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2022-12-06 00:56:47 +0100
committerLioncash <mathew1800@gmail.com>2022-12-06 01:06:04 +0100
commitd8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3 (patch)
tree2d4961867fba4f10b6bc2a6695a660ef79cdd9d3 /src
parentapplets/mii_edit: Use aliases for callbacks (diff)
downloadyuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar
yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.gz
yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.bz2
yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.lz
yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.xz
yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.zst
yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/frontend/applets/error.cpp6
-rw-r--r--src/core/frontend/applets/error.h14
-rw-r--r--src/yuzu/applets/qt_error.cpp6
-rw-r--r--src/yuzu/applets/qt_error.h8
4 files changed, 18 insertions, 16 deletions
diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp
index f8b961098..69c2b2b4d 100644
--- a/src/core/frontend/applets/error.cpp
+++ b/src/core/frontend/applets/error.cpp
@@ -8,13 +8,13 @@ namespace Core::Frontend {
ErrorApplet::~ErrorApplet() = default;
-void DefaultErrorApplet::ShowError(Result error, std::function<void()> finished) const {
+void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const {
LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})",
error.module.Value(), error.description.Value(), error.raw);
}
void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
- std::function<void()> finished) const {
+ FinishedCallback finished) const {
LOG_CRITICAL(
Service_Fatal,
"Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}",
@@ -23,7 +23,7 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::secon
void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text,
std::string detail_text,
- std::function<void()> finished) const {
+ FinishedCallback finished) const {
LOG_CRITICAL(Service_Fatal,
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",
error.module.Value(), error.description.Value(), error.raw);
diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h
index f378f8805..884f2f653 100644
--- a/src/core/frontend/applets/error.h
+++ b/src/core/frontend/applets/error.h
@@ -12,25 +12,27 @@ namespace Core::Frontend {
class ErrorApplet {
public:
+ using FinishedCallback = std::function<void()>;
+
virtual ~ErrorApplet();
- virtual void ShowError(Result error, std::function<void()> finished) const = 0;
+ virtual void ShowError(Result error, FinishedCallback finished) const = 0;
virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
- std::function<void()> finished) const = 0;
+ FinishedCallback finished) const = 0;
virtual void ShowCustomErrorText(Result error, std::string dialog_text,
std::string fullscreen_text,
- std::function<void()> finished) const = 0;
+ FinishedCallback finished) const = 0;
};
class DefaultErrorApplet final : public ErrorApplet {
public:
- void ShowError(Result error, std::function<void()> finished) const override;
+ void ShowError(Result error, FinishedCallback finished) const override;
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
- std::function<void()> finished) const override;
+ FinishedCallback finished) const override;
void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text,
- std::function<void()> finished) const override;
+ FinishedCallback finished) const override;
};
} // namespace Core::Frontend
diff --git a/src/yuzu/applets/qt_error.cpp b/src/yuzu/applets/qt_error.cpp
index 367d5352d..e0190a979 100644
--- a/src/yuzu/applets/qt_error.cpp
+++ b/src/yuzu/applets/qt_error.cpp
@@ -14,7 +14,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) {
QtErrorDisplay::~QtErrorDisplay() = default;
-void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) const {
+void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const {
callback = std::move(finished);
emit MainWindowDisplayError(
tr("Error Code: %1-%2 (0x%3)")
@@ -25,7 +25,7 @@ void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) con
}
void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
- std::function<void()> finished) const {
+ FinishedCallback finished) const {
callback = std::move(finished);
const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count());
@@ -42,7 +42,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds t
void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text,
std::string fullscreen_text,
- std::function<void()> finished) const {
+ FinishedCallback finished) const {
callback = std::move(finished);
emit MainWindowDisplayError(
tr("Error Code: %1-%2 (0x%3)")
diff --git a/src/yuzu/applets/qt_error.h b/src/yuzu/applets/qt_error.h
index eb4107c7e..e4e174721 100644
--- a/src/yuzu/applets/qt_error.h
+++ b/src/yuzu/applets/qt_error.h
@@ -16,11 +16,11 @@ public:
explicit QtErrorDisplay(GMainWindow& parent);
~QtErrorDisplay() override;
- void ShowError(Result error, std::function<void()> finished) const override;
+ void ShowError(Result error, FinishedCallback finished) const override;
void ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
- std::function<void()> finished) const override;
+ FinishedCallback finished) const override;
void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text,
- std::function<void()> finished) const override;
+ FinishedCallback finished) const override;
signals:
void MainWindowDisplayError(QString error_code, QString error_text) const;
@@ -28,5 +28,5 @@ signals:
private:
void MainWindowFinishedError();
- mutable std::function<void()> callback;
+ mutable FinishedCallback callback;
};