mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	applets/error: Use aliases for callbacks
This commit is contained in:
		@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user