diff options
| author | 2022-12-05 18:56:47 -0500 | |
|---|---|---|
| committer | 2022-12-05 19:06:04 -0500 | |
| commit | d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3 (patch) | |
| tree | 2d4961867fba4f10b6bc2a6695a660ef79cdd9d3 /src | |
| parent | applets/mii_edit: Use aliases for callbacks (diff) | |
| download | yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.gz yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.tar.xz yuzu-d8da9a2afdff6b3aa2f8c2ac80083353fcaab8b3.zip | |
applets/error: Use aliases for callbacks
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/frontend/applets/error.cpp | 6 | ||||
| -rw-r--r-- | src/core/frontend/applets/error.h | 14 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_error.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/applets/qt_error.h | 8 |
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 { | |||
| 8 | 8 | ||
| 9 | ErrorApplet::~ErrorApplet() = default; | 9 | ErrorApplet::~ErrorApplet() = default; |
| 10 | 10 | ||
| 11 | void DefaultErrorApplet::ShowError(Result error, std::function<void()> finished) const { | 11 | void DefaultErrorApplet::ShowError(Result error, FinishedCallback finished) const { |
| 12 | LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", | 12 | LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", |
| 13 | error.module.Value(), error.description.Value(), error.raw); | 13 | error.module.Value(), error.description.Value(), error.raw); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, | 16 | void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, |
| 17 | std::function<void()> finished) const { | 17 | FinishedCallback finished) const { |
| 18 | LOG_CRITICAL( | 18 | LOG_CRITICAL( |
| 19 | Service_Fatal, | 19 | Service_Fatal, |
| 20 | "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", | 20 | "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", |
| @@ -23,7 +23,7 @@ void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::secon | |||
| 23 | 23 | ||
| 24 | void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text, | 24 | void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text, |
| 25 | std::string detail_text, | 25 | std::string detail_text, |
| 26 | std::function<void()> finished) const { | 26 | FinishedCallback finished) const { |
| 27 | LOG_CRITICAL(Service_Fatal, | 27 | LOG_CRITICAL(Service_Fatal, |
| 28 | "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", | 28 | "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", |
| 29 | error.module.Value(), error.description.Value(), error.raw); | 29 | 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 { | |||
| 12 | 12 | ||
| 13 | class ErrorApplet { | 13 | class ErrorApplet { |
| 14 | public: | 14 | public: |
| 15 | using FinishedCallback = std::function<void()>; | ||
| 16 | |||
| 15 | virtual ~ErrorApplet(); | 17 | virtual ~ErrorApplet(); |
| 16 | 18 | ||
| 17 | virtual void ShowError(Result error, std::function<void()> finished) const = 0; | 19 | virtual void ShowError(Result error, FinishedCallback finished) const = 0; |
| 18 | 20 | ||
| 19 | virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, | 21 | virtual void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, |
| 20 | std::function<void()> finished) const = 0; | 22 | FinishedCallback finished) const = 0; |
| 21 | 23 | ||
| 22 | virtual void ShowCustomErrorText(Result error, std::string dialog_text, | 24 | virtual void ShowCustomErrorText(Result error, std::string dialog_text, |
| 23 | std::string fullscreen_text, | 25 | std::string fullscreen_text, |
| 24 | std::function<void()> finished) const = 0; | 26 | FinishedCallback finished) const = 0; |
| 25 | }; | 27 | }; |
| 26 | 28 | ||
| 27 | class DefaultErrorApplet final : public ErrorApplet { | 29 | class DefaultErrorApplet final : public ErrorApplet { |
| 28 | public: | 30 | public: |
| 29 | void ShowError(Result error, std::function<void()> finished) const override; | 31 | void ShowError(Result error, FinishedCallback finished) const override; |
| 30 | void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, | 32 | void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, |
| 31 | std::function<void()> finished) const override; | 33 | FinishedCallback finished) const override; |
| 32 | void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, | 34 | void ShowCustomErrorText(Result error, std::string main_text, std::string detail_text, |
| 33 | std::function<void()> finished) const override; | 35 | FinishedCallback finished) const override; |
| 34 | }; | 36 | }; |
| 35 | 37 | ||
| 36 | } // namespace Core::Frontend | 38 | } // 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) { | |||
| 14 | 14 | ||
| 15 | QtErrorDisplay::~QtErrorDisplay() = default; | 15 | QtErrorDisplay::~QtErrorDisplay() = default; |
| 16 | 16 | ||
| 17 | void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) const { | 17 | void QtErrorDisplay::ShowError(Result error, FinishedCallback finished) const { |
| 18 | callback = std::move(finished); | 18 | callback = std::move(finished); |
| 19 | emit MainWindowDisplayError( | 19 | emit MainWindowDisplayError( |
| 20 | tr("Error Code: %1-%2 (0x%3)") | 20 | tr("Error Code: %1-%2 (0x%3)") |
| @@ -25,7 +25,7 @@ void QtErrorDisplay::ShowError(Result error, std::function<void()> finished) con | |||
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, | 27 | void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time, |
| 28 | std::function<void()> finished) const { | 28 | FinishedCallback finished) const { |
| 29 | callback = std::move(finished); | 29 | callback = std::move(finished); |
| 30 | 30 | ||
| 31 | const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); | 31 | const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count()); |
| @@ -42,7 +42,7 @@ void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds t | |||
| 42 | 42 | ||
| 43 | void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text, | 43 | void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text, |
| 44 | std::string fullscreen_text, | 44 | std::string fullscreen_text, |
| 45 | std::function<void()> finished) const { | 45 | FinishedCallback finished) const { |
| 46 | callback = std::move(finished); | 46 | callback = std::move(finished); |
| 47 | emit MainWindowDisplayError( | 47 | emit MainWindowDisplayError( |
| 48 | tr("Error Code: %1-%2 (0x%3)") | 48 | 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: | |||
| 16 | explicit QtErrorDisplay(GMainWindow& parent); | 16 | explicit QtErrorDisplay(GMainWindow& parent); |
| 17 | ~QtErrorDisplay() override; | 17 | ~QtErrorDisplay() override; |
| 18 | 18 | ||
| 19 | void ShowError(Result error, std::function<void()> finished) const override; | 19 | void ShowError(Result error, FinishedCallback finished) const override; |
| 20 | void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, | 20 | void ShowErrorWithTimestamp(Result error, std::chrono::seconds time, |
| 21 | std::function<void()> finished) const override; | 21 | FinishedCallback finished) const override; |
| 22 | void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, | 22 | void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text, |
| 23 | std::function<void()> finished) const override; | 23 | FinishedCallback finished) const override; |
| 24 | 24 | ||
| 25 | signals: | 25 | signals: |
| 26 | void MainWindowDisplayError(QString error_code, QString error_text) const; | 26 | void MainWindowDisplayError(QString error_code, QString error_text) const; |
| @@ -28,5 +28,5 @@ signals: | |||
| 28 | private: | 28 | private: |
| 29 | void MainWindowFinishedError(); | 29 | void MainWindowFinishedError(); |
| 30 | 30 | ||
| 31 | mutable std::function<void()> callback; | 31 | mutable FinishedCallback callback; |
| 32 | }; | 32 | }; |