diff options
| author | 2019-04-24 22:53:21 -0400 | |
|---|---|---|
| committer | 2019-04-24 22:53:21 -0400 | |
| commit | 53f746fa9a41647d69cdbd52de7e49de4acbfe6b (patch) | |
| tree | 7b62619ffedc3012d131c63c12451779d22e8fd9 /src/core/frontend | |
| parent | Merge pull request #2404 from lioncash/unicode (diff) | |
| parent | web_browser: Make OpenPage non-const (diff) | |
| download | yuzu-53f746fa9a41647d69cdbd52de7e49de4acbfe6b.tar.gz yuzu-53f746fa9a41647d69cdbd52de7e49de4acbfe6b.tar.xz yuzu-53f746fa9a41647d69cdbd52de7e49de4acbfe6b.zip | |
Merge pull request #2228 from DarkLordZach/applet-manager-p1
applets: Add AppletManager and implement PhotoViewer and Error applets
Diffstat (limited to 'src/core/frontend')
| -rw-r--r-- | src/core/frontend/applets/error.cpp | 34 | ||||
| -rw-r--r-- | src/core/frontend/applets/error.h | 37 | ||||
| -rw-r--r-- | src/core/frontend/applets/general_frontend.cpp | 27 | ||||
| -rw-r--r-- | src/core/frontend/applets/general_frontend.h | 28 |
4 files changed, 126 insertions, 0 deletions
diff --git a/src/core/frontend/applets/error.cpp b/src/core/frontend/applets/error.cpp new file mode 100644 index 000000000..4002a9211 --- /dev/null +++ b/src/core/frontend/applets/error.cpp | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "core/frontend/applets/error.h" | ||
| 6 | |||
| 7 | namespace Core::Frontend { | ||
| 8 | |||
| 9 | ErrorApplet::~ErrorApplet() = default; | ||
| 10 | |||
| 11 | void DefaultErrorApplet::ShowError(ResultCode error, std::function<void()> finished) const { | ||
| 12 | LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})", | ||
| 13 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); | ||
| 14 | } | ||
| 15 | |||
| 16 | void DefaultErrorApplet::ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | ||
| 17 | std::function<void()> finished) const { | ||
| 18 | LOG_CRITICAL( | ||
| 19 | Service_Fatal, | ||
| 20 | "Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}", | ||
| 21 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw, time.count()); | ||
| 22 | } | ||
| 23 | |||
| 24 | void DefaultErrorApplet::ShowCustomErrorText(ResultCode error, std::string main_text, | ||
| 25 | std::string detail_text, | ||
| 26 | std::function<void()> finished) const { | ||
| 27 | LOG_CRITICAL(Service_Fatal, | ||
| 28 | "Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})", | ||
| 29 | static_cast<u32>(error.module.Value()), error.description.Value(), error.raw); | ||
| 30 | LOG_CRITICAL(Service_Fatal, " Main Text: {}", main_text); | ||
| 31 | LOG_CRITICAL(Service_Fatal, " Detail Text: {}", detail_text); | ||
| 32 | } | ||
| 33 | |||
| 34 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/error.h b/src/core/frontend/applets/error.h new file mode 100644 index 000000000..699df940d --- /dev/null +++ b/src/core/frontend/applets/error.h | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <chrono> | ||
| 8 | #include <functional> | ||
| 9 | |||
| 10 | #include "core/hle/result.h" | ||
| 11 | |||
| 12 | namespace Core::Frontend { | ||
| 13 | |||
| 14 | class ErrorApplet { | ||
| 15 | public: | ||
| 16 | virtual ~ErrorApplet(); | ||
| 17 | |||
| 18 | virtual void ShowError(ResultCode error, std::function<void()> finished) const = 0; | ||
| 19 | |||
| 20 | virtual void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | ||
| 21 | std::function<void()> finished) const = 0; | ||
| 22 | |||
| 23 | virtual void ShowCustomErrorText(ResultCode error, std::string dialog_text, | ||
| 24 | std::string fullscreen_text, | ||
| 25 | std::function<void()> finished) const = 0; | ||
| 26 | }; | ||
| 27 | |||
| 28 | class DefaultErrorApplet final : public ErrorApplet { | ||
| 29 | public: | ||
| 30 | void ShowError(ResultCode error, std::function<void()> finished) const override; | ||
| 31 | void ShowErrorWithTimestamp(ResultCode error, std::chrono::seconds time, | ||
| 32 | std::function<void()> finished) const override; | ||
| 33 | void ShowCustomErrorText(ResultCode error, std::string main_text, std::string detail_text, | ||
| 34 | std::function<void()> finished) const override; | ||
| 35 | }; | ||
| 36 | |||
| 37 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/general_frontend.cpp b/src/core/frontend/applets/general_frontend.cpp new file mode 100644 index 000000000..b974f2289 --- /dev/null +++ b/src/core/frontend/applets/general_frontend.cpp | |||
| @@ -0,0 +1,27 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include "common/logging/log.h" | ||
| 6 | #include "core/frontend/applets/general_frontend.h" | ||
| 7 | |||
| 8 | namespace Core::Frontend { | ||
| 9 | |||
| 10 | PhotoViewerApplet::~PhotoViewerApplet() = default; | ||
| 11 | |||
| 12 | DefaultPhotoViewerApplet::~DefaultPhotoViewerApplet() {} | ||
| 13 | |||
| 14 | void DefaultPhotoViewerApplet::ShowPhotosForApplication(u64 title_id, | ||
| 15 | std::function<void()> finished) const { | ||
| 16 | LOG_INFO(Service_AM, | ||
| 17 | "Application requested frontend to display stored photos for title_id={:016X}", | ||
| 18 | title_id); | ||
| 19 | finished(); | ||
| 20 | } | ||
| 21 | |||
| 22 | void DefaultPhotoViewerApplet::ShowAllPhotos(std::function<void()> finished) const { | ||
| 23 | LOG_INFO(Service_AM, "Application requested frontend to display all stored photos."); | ||
| 24 | finished(); | ||
| 25 | } | ||
| 26 | |||
| 27 | } // namespace Core::Frontend | ||
diff --git a/src/core/frontend/applets/general_frontend.h b/src/core/frontend/applets/general_frontend.h new file mode 100644 index 000000000..d4506c999 --- /dev/null +++ b/src/core/frontend/applets/general_frontend.h | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | // Copyright 2019 yuzu emulator team | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #pragma once | ||
| 6 | |||
| 7 | #include <functional> | ||
| 8 | #include "common/common_types.h" | ||
| 9 | |||
| 10 | namespace Core::Frontend { | ||
| 11 | |||
| 12 | class PhotoViewerApplet { | ||
| 13 | public: | ||
| 14 | virtual ~PhotoViewerApplet(); | ||
| 15 | |||
| 16 | virtual void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const = 0; | ||
| 17 | virtual void ShowAllPhotos(std::function<void()> finished) const = 0; | ||
| 18 | }; | ||
| 19 | |||
| 20 | class DefaultPhotoViewerApplet final : public PhotoViewerApplet { | ||
| 21 | public: | ||
| 22 | ~DefaultPhotoViewerApplet() override; | ||
| 23 | |||
| 24 | void ShowPhotosForApplication(u64 title_id, std::function<void()> finished) const override; | ||
| 25 | void ShowAllPhotos(std::function<void()> finished) const override; | ||
| 26 | }; | ||
| 27 | |||
| 28 | } // namespace Core::Frontend | ||