mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-25 22:57:22 +00:00
Merge pull request #9390 from lioncash/keyboard
applets: Extract callback types into aliases
This commit is contained in:
commit
d8534ea140
22 changed files with 89 additions and 100 deletions
|
@ -16,7 +16,7 @@ DefaultControllerApplet::DefaultControllerApplet(HID::HIDCore& hid_core_) : hid_
|
||||||
|
|
||||||
DefaultControllerApplet::~DefaultControllerApplet() = default;
|
DefaultControllerApplet::~DefaultControllerApplet() = default;
|
||||||
|
|
||||||
void DefaultControllerApplet::ReconfigureControllers(std::function<void()> callback,
|
void DefaultControllerApplet::ReconfigureControllers(ReconfigureCallback callback,
|
||||||
const ControllerParameters& parameters) const {
|
const ControllerParameters& parameters) const {
|
||||||
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
|
LOG_INFO(Service_HID, "called, deducing the best configuration based on the given parameters!");
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,11 @@ struct ControllerParameters {
|
||||||
|
|
||||||
class ControllerApplet {
|
class ControllerApplet {
|
||||||
public:
|
public:
|
||||||
|
using ReconfigureCallback = std::function<void()>;
|
||||||
|
|
||||||
virtual ~ControllerApplet();
|
virtual ~ControllerApplet();
|
||||||
|
|
||||||
virtual void ReconfigureControllers(std::function<void()> callback,
|
virtual void ReconfigureControllers(ReconfigureCallback callback,
|
||||||
const ControllerParameters& parameters) const = 0;
|
const ControllerParameters& parameters) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -47,7 +49,7 @@ public:
|
||||||
explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
|
explicit DefaultControllerApplet(HID::HIDCore& hid_core_);
|
||||||
~DefaultControllerApplet() override;
|
~DefaultControllerApplet() override;
|
||||||
|
|
||||||
void ReconfigureControllers(std::function<void()> callback,
|
void ReconfigureControllers(ReconfigureCallback callback,
|
||||||
const ControllerParameters& parameters) const override;
|
const ControllerParameters& parameters) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -8,13 +8,13 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
ErrorApplet::~ErrorApplet() = default;
|
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})",
|
LOG_CRITICAL(Service_Fatal, "Application requested error display: {:04}-{:04} (raw={:08X})",
|
||||||
error.module.Value(), error.description.Value(), error.raw);
|
error.module.Value(), error.description.Value(), error.raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
|
void DefaultErrorApplet::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
|
||||||
std::function<void()> finished) const {
|
FinishedCallback finished) const {
|
||||||
LOG_CRITICAL(
|
LOG_CRITICAL(
|
||||||
Service_Fatal,
|
Service_Fatal,
|
||||||
"Application requested error display: {:04X}-{:04X} (raw={:08X}) with timestamp={:016X}",
|
"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,
|
void DefaultErrorApplet::ShowCustomErrorText(Result error, std::string main_text,
|
||||||
std::string detail_text,
|
std::string detail_text,
|
||||||
std::function<void()> finished) const {
|
FinishedCallback finished) const {
|
||||||
LOG_CRITICAL(Service_Fatal,
|
LOG_CRITICAL(Service_Fatal,
|
||||||
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",
|
"Application requested custom error with error_code={:04X}-{:04X} (raw={:08X})",
|
||||||
error.module.Value(), error.description.Value(), error.raw);
|
error.module.Value(), error.description.Value(), error.raw);
|
||||||
|
|
|
@ -12,25 +12,27 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
class ErrorApplet {
|
class ErrorApplet {
|
||||||
public:
|
public:
|
||||||
|
using FinishedCallback = std::function<void()>;
|
||||||
|
|
||||||
virtual ~ErrorApplet();
|
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,
|
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,
|
virtual void ShowCustomErrorText(Result error, std::string dialog_text,
|
||||||
std::string fullscreen_text,
|
std::string fullscreen_text,
|
||||||
std::function<void()> finished) const = 0;
|
FinishedCallback finished) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultErrorApplet final : public ErrorApplet {
|
class DefaultErrorApplet final : public ErrorApplet {
|
||||||
public:
|
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,
|
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,
|
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
|
} // namespace Core::Frontend
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
MiiEditApplet::~MiiEditApplet() = default;
|
MiiEditApplet::~MiiEditApplet() = default;
|
||||||
|
|
||||||
void DefaultMiiEditApplet::ShowMiiEdit(const std::function<void()>& callback) const {
|
void DefaultMiiEditApplet::ShowMiiEdit(const MiiEditCallback& callback) const {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called");
|
LOG_WARNING(Service_AM, "(STUBBED) called");
|
||||||
|
|
||||||
callback();
|
callback();
|
||||||
|
|
|
@ -9,14 +9,16 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
class MiiEditApplet {
|
class MiiEditApplet {
|
||||||
public:
|
public:
|
||||||
|
using MiiEditCallback = std::function<void()>;
|
||||||
|
|
||||||
virtual ~MiiEditApplet();
|
virtual ~MiiEditApplet();
|
||||||
|
|
||||||
virtual void ShowMiiEdit(const std::function<void()>& callback) const = 0;
|
virtual void ShowMiiEdit(const MiiEditCallback& callback) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultMiiEditApplet final : public MiiEditApplet {
|
class DefaultMiiEditApplet final : public MiiEditApplet {
|
||||||
public:
|
public:
|
||||||
void ShowMiiEdit(const std::function<void()>& callback) const override;
|
void ShowMiiEdit(const MiiEditCallback& callback) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
|
@ -9,8 +9,7 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
ProfileSelectApplet::~ProfileSelectApplet() = default;
|
ProfileSelectApplet::~ProfileSelectApplet() = default;
|
||||||
|
|
||||||
void DefaultProfileSelectApplet::SelectProfile(
|
void DefaultProfileSelectApplet::SelectProfile(SelectProfileCallback callback) const {
|
||||||
std::function<void(std::optional<Common::UUID>)> callback) const {
|
|
||||||
Service::Account::ProfileManager manager;
|
Service::Account::ProfileManager manager;
|
||||||
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
|
callback(manager.GetUser(Settings::values.current_user.GetValue()).value_or(Common::UUID{}));
|
||||||
LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");
|
LOG_INFO(Service_ACC, "called, selecting current user instead of prompting...");
|
||||||
|
|
|
@ -11,14 +11,16 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
class ProfileSelectApplet {
|
class ProfileSelectApplet {
|
||||||
public:
|
public:
|
||||||
|
using SelectProfileCallback = std::function<void(std::optional<Common::UUID>)>;
|
||||||
|
|
||||||
virtual ~ProfileSelectApplet();
|
virtual ~ProfileSelectApplet();
|
||||||
|
|
||||||
virtual void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const = 0;
|
virtual void SelectProfile(SelectProfileCallback callback) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultProfileSelectApplet final : public ProfileSelectApplet {
|
class DefaultProfileSelectApplet final : public ProfileSelectApplet {
|
||||||
public:
|
public:
|
||||||
void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback) const override;
|
void SelectProfile(SelectProfileCallback callback) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
|
@ -15,10 +15,7 @@ DefaultSoftwareKeyboardApplet::~DefaultSoftwareKeyboardApplet() = default;
|
||||||
|
|
||||||
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
|
void DefaultSoftwareKeyboardApplet::InitializeKeyboard(
|
||||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
|
||||||
submit_normal_callback_,
|
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) {
|
|
||||||
if (is_inline) {
|
if (is_inline) {
|
||||||
LOG_WARNING(
|
LOG_WARNING(
|
||||||
Service_AM,
|
Service_AM,
|
||||||
|
|
|
@ -54,14 +54,17 @@ struct InlineTextParameters {
|
||||||
|
|
||||||
class SoftwareKeyboardApplet {
|
class SoftwareKeyboardApplet {
|
||||||
public:
|
public:
|
||||||
|
using SubmitInlineCallback =
|
||||||
|
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>;
|
||||||
|
using SubmitNormalCallback =
|
||||||
|
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>;
|
||||||
|
|
||||||
virtual ~SoftwareKeyboardApplet();
|
virtual ~SoftwareKeyboardApplet();
|
||||||
|
|
||||||
virtual void InitializeKeyboard(
|
virtual void InitializeKeyboard(bool is_inline,
|
||||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_,
|
||||||
submit_normal_callback_,
|
SubmitInlineCallback submit_inline_callback_) = 0;
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) = 0;
|
|
||||||
|
|
||||||
virtual void ShowNormalKeyboard() const = 0;
|
virtual void ShowNormalKeyboard() const = 0;
|
||||||
|
|
||||||
|
@ -81,12 +84,9 @@ class DefaultSoftwareKeyboardApplet final : public SoftwareKeyboardApplet {
|
||||||
public:
|
public:
|
||||||
~DefaultSoftwareKeyboardApplet() override;
|
~DefaultSoftwareKeyboardApplet() override;
|
||||||
|
|
||||||
void InitializeKeyboard(
|
void InitializeKeyboard(bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
||||||
bool is_inline, KeyboardInitializeParameters initialize_parameters,
|
SubmitNormalCallback submit_normal_callback_,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitInlineCallback submit_inline_callback_) override;
|
||||||
submit_normal_callback_,
|
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) override;
|
|
||||||
|
|
||||||
void ShowNormalKeyboard() const override;
|
void ShowNormalKeyboard() const override;
|
||||||
|
|
||||||
|
@ -105,12 +105,10 @@ private:
|
||||||
void SubmitNormalText(std::u16string text) const;
|
void SubmitNormalText(std::u16string text) const;
|
||||||
void SubmitInlineText(std::u16string_view text) const;
|
void SubmitInlineText(std::u16string_view text) const;
|
||||||
|
|
||||||
KeyboardInitializeParameters parameters;
|
KeyboardInitializeParameters parameters{};
|
||||||
|
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
mutable SubmitNormalCallback submit_normal_callback;
|
||||||
submit_normal_callback;
|
mutable SubmitInlineCallback submit_inline_callback;
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
|
@ -10,18 +10,17 @@ WebBrowserApplet::~WebBrowserApplet() = default;
|
||||||
|
|
||||||
DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
|
DefaultWebBrowserApplet::~DefaultWebBrowserApplet() = default;
|
||||||
|
|
||||||
void DefaultWebBrowserApplet::OpenLocalWebPage(
|
void DefaultWebBrowserApplet::OpenLocalWebPage(const std::string& local_url,
|
||||||
const std::string& local_url, std::function<void()> extract_romfs_callback,
|
ExtractROMFSCallback extract_romfs_callback,
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
|
OpenWebPageCallback callback) const {
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}",
|
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open local web page at {}",
|
||||||
local_url);
|
local_url);
|
||||||
|
|
||||||
callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/");
|
callback(Service::AM::Applets::WebExitReason::WindowClosed, "http://localhost/");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DefaultWebBrowserApplet::OpenExternalWebPage(
|
void DefaultWebBrowserApplet::OpenExternalWebPage(const std::string& external_url,
|
||||||
const std::string& external_url,
|
OpenWebPageCallback callback) const {
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const {
|
|
||||||
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}",
|
LOG_WARNING(Service_AM, "(STUBBED) called, backend requested to open external web page at {}",
|
||||||
external_url);
|
external_url);
|
||||||
|
|
||||||
|
|
|
@ -11,29 +11,29 @@ namespace Core::Frontend {
|
||||||
|
|
||||||
class WebBrowserApplet {
|
class WebBrowserApplet {
|
||||||
public:
|
public:
|
||||||
|
using ExtractROMFSCallback = std::function<void()>;
|
||||||
|
using OpenWebPageCallback =
|
||||||
|
std::function<void(Service::AM::Applets::WebExitReason, std::string)>;
|
||||||
|
|
||||||
virtual ~WebBrowserApplet();
|
virtual ~WebBrowserApplet();
|
||||||
|
|
||||||
virtual void OpenLocalWebPage(
|
virtual void OpenLocalWebPage(const std::string& local_url,
|
||||||
const std::string& local_url, std::function<void()> extract_romfs_callback,
|
ExtractROMFSCallback extract_romfs_callback,
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
|
OpenWebPageCallback callback) const = 0;
|
||||||
|
|
||||||
virtual void OpenExternalWebPage(
|
virtual void OpenExternalWebPage(const std::string& external_url,
|
||||||
const std::string& external_url,
|
OpenWebPageCallback callback) const = 0;
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback) const = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class DefaultWebBrowserApplet final : public WebBrowserApplet {
|
class DefaultWebBrowserApplet final : public WebBrowserApplet {
|
||||||
public:
|
public:
|
||||||
~DefaultWebBrowserApplet() override;
|
~DefaultWebBrowserApplet() override;
|
||||||
|
|
||||||
void OpenLocalWebPage(const std::string& local_url,
|
void OpenLocalWebPage(const std::string& local_url, ExtractROMFSCallback extract_romfs_callback,
|
||||||
std::function<void()> extract_romfs_callback,
|
OpenWebPageCallback callback) const override;
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
|
|
||||||
callback) const override;
|
|
||||||
|
|
||||||
void OpenExternalWebPage(const std::string& external_url,
|
void OpenExternalWebPage(const std::string& external_url,
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
|
OpenWebPageCallback callback) const override;
|
||||||
callback) const override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Core::Frontend
|
} // namespace Core::Frontend
|
||||||
|
|
|
@ -685,7 +685,7 @@ QtControllerSelector::QtControllerSelector(GMainWindow& parent) {
|
||||||
QtControllerSelector::~QtControllerSelector() = default;
|
QtControllerSelector::~QtControllerSelector() = default;
|
||||||
|
|
||||||
void QtControllerSelector::ReconfigureControllers(
|
void QtControllerSelector::ReconfigureControllers(
|
||||||
std::function<void()> callback_, const Core::Frontend::ControllerParameters& parameters) const {
|
ReconfigureCallback callback_, const Core::Frontend::ControllerParameters& parameters) const {
|
||||||
callback = std::move(callback_);
|
callback = std::move(callback_);
|
||||||
emit MainWindowReconfigureControllers(parameters);
|
emit MainWindowReconfigureControllers(parameters);
|
||||||
}
|
}
|
||||||
|
|
|
@ -157,7 +157,7 @@ public:
|
||||||
~QtControllerSelector() override;
|
~QtControllerSelector() override;
|
||||||
|
|
||||||
void ReconfigureControllers(
|
void ReconfigureControllers(
|
||||||
std::function<void()> callback_,
|
ReconfigureCallback callback_,
|
||||||
const Core::Frontend::ControllerParameters& parameters) const override;
|
const Core::Frontend::ControllerParameters& parameters) const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -167,5 +167,5 @@ signals:
|
||||||
private:
|
private:
|
||||||
void MainWindowReconfigureFinished();
|
void MainWindowReconfigureFinished();
|
||||||
|
|
||||||
mutable std::function<void()> callback;
|
mutable ReconfigureCallback callback;
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,7 +14,7 @@ QtErrorDisplay::QtErrorDisplay(GMainWindow& parent) {
|
||||||
|
|
||||||
QtErrorDisplay::~QtErrorDisplay() = default;
|
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);
|
callback = std::move(finished);
|
||||||
emit MainWindowDisplayError(
|
emit MainWindowDisplayError(
|
||||||
tr("Error Code: %1-%2 (0x%3)")
|
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,
|
void QtErrorDisplay::ShowErrorWithTimestamp(Result error, std::chrono::seconds time,
|
||||||
std::function<void()> finished) const {
|
FinishedCallback finished) const {
|
||||||
callback = std::move(finished);
|
callback = std::move(finished);
|
||||||
|
|
||||||
const QDateTime date_time = QDateTime::fromSecsSinceEpoch(time.count());
|
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,
|
void QtErrorDisplay::ShowCustomErrorText(Result error, std::string dialog_text,
|
||||||
std::string fullscreen_text,
|
std::string fullscreen_text,
|
||||||
std::function<void()> finished) const {
|
FinishedCallback finished) const {
|
||||||
callback = std::move(finished);
|
callback = std::move(finished);
|
||||||
emit MainWindowDisplayError(
|
emit MainWindowDisplayError(
|
||||||
tr("Error Code: %1-%2 (0x%3)")
|
tr("Error Code: %1-%2 (0x%3)")
|
||||||
|
|
|
@ -16,11 +16,11 @@ public:
|
||||||
explicit QtErrorDisplay(GMainWindow& parent);
|
explicit QtErrorDisplay(GMainWindow& parent);
|
||||||
~QtErrorDisplay() override;
|
~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,
|
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,
|
void ShowCustomErrorText(Result error, std::string dialog_text, std::string fullscreen_text,
|
||||||
std::function<void()> finished) const override;
|
FinishedCallback finished) const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MainWindowDisplayError(QString error_code, QString error_text) const;
|
void MainWindowDisplayError(QString error_code, QString error_text) const;
|
||||||
|
@ -28,5 +28,5 @@ signals:
|
||||||
private:
|
private:
|
||||||
void MainWindowFinishedError();
|
void MainWindowFinishedError();
|
||||||
|
|
||||||
mutable std::function<void()> callback;
|
mutable FinishedCallback callback;
|
||||||
};
|
};
|
||||||
|
|
|
@ -163,8 +163,7 @@ QtProfileSelector::QtProfileSelector(GMainWindow& parent) {
|
||||||
|
|
||||||
QtProfileSelector::~QtProfileSelector() = default;
|
QtProfileSelector::~QtProfileSelector() = default;
|
||||||
|
|
||||||
void QtProfileSelector::SelectProfile(
|
void QtProfileSelector::SelectProfile(SelectProfileCallback callback_) const {
|
||||||
std::function<void(std::optional<Common::UUID>)> callback_) const {
|
|
||||||
callback = std::move(callback_);
|
callback = std::move(callback_);
|
||||||
emit MainWindowSelectProfile();
|
emit MainWindowSelectProfile();
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ public:
|
||||||
explicit QtProfileSelector(GMainWindow& parent);
|
explicit QtProfileSelector(GMainWindow& parent);
|
||||||
~QtProfileSelector() override;
|
~QtProfileSelector() override;
|
||||||
|
|
||||||
void SelectProfile(std::function<void(std::optional<Common::UUID>)> callback_) const override;
|
void SelectProfile(SelectProfileCallback callback_) const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MainWindowSelectProfile() const;
|
void MainWindowSelectProfile() const;
|
||||||
|
@ -73,5 +73,5 @@ signals:
|
||||||
private:
|
private:
|
||||||
void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);
|
void MainWindowFinishedSelection(std::optional<Common::UUID> uuid);
|
||||||
|
|
||||||
mutable std::function<void(std::optional<Common::UUID>)> callback;
|
mutable SelectProfileCallback callback;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1566,10 +1566,7 @@ QtSoftwareKeyboard::~QtSoftwareKeyboard() = default;
|
||||||
|
|
||||||
void QtSoftwareKeyboard::InitializeKeyboard(
|
void QtSoftwareKeyboard::InitializeKeyboard(
|
||||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_, SubmitInlineCallback submit_inline_callback_) {
|
||||||
submit_normal_callback_,
|
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) {
|
|
||||||
if (is_inline) {
|
if (is_inline) {
|
||||||
submit_inline_callback = std::move(submit_inline_callback_);
|
submit_inline_callback = std::move(submit_inline_callback_);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -233,12 +233,10 @@ public:
|
||||||
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
||||||
~QtSoftwareKeyboard() override;
|
~QtSoftwareKeyboard() override;
|
||||||
|
|
||||||
void InitializeKeyboard(
|
void InitializeKeyboard(bool is_inline,
|
||||||
bool is_inline, Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
Core::Frontend::KeyboardInitializeParameters initialize_parameters,
|
||||||
std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
SubmitNormalCallback submit_normal_callback_,
|
||||||
submit_normal_callback_,
|
SubmitInlineCallback submit_inline_callback_) override;
|
||||||
std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback_) override;
|
|
||||||
|
|
||||||
void ShowNormalKeyboard() const override;
|
void ShowNormalKeyboard() const override;
|
||||||
|
|
||||||
|
@ -279,8 +277,6 @@ private:
|
||||||
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
void SubmitInlineText(Service::AM::Applets::SwkbdReplyType reply_type,
|
||||||
std::u16string submitted_text, s32 cursor_position) const;
|
std::u16string submitted_text, s32 cursor_position) const;
|
||||||
|
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdResult, std::u16string, bool)>
|
mutable SubmitNormalCallback submit_normal_callback;
|
||||||
submit_normal_callback;
|
mutable SubmitInlineCallback submit_inline_callback;
|
||||||
mutable std::function<void(Service::AM::Applets::SwkbdReplyType, std::u16string, s32)>
|
|
||||||
submit_inline_callback;
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -401,9 +401,9 @@ QtWebBrowser::QtWebBrowser(GMainWindow& main_window) {
|
||||||
|
|
||||||
QtWebBrowser::~QtWebBrowser() = default;
|
QtWebBrowser::~QtWebBrowser() = default;
|
||||||
|
|
||||||
void QtWebBrowser::OpenLocalWebPage(
|
void QtWebBrowser::OpenLocalWebPage(const std::string& local_url,
|
||||||
const std::string& local_url, std::function<void()> extract_romfs_callback_,
|
ExtractROMFSCallback extract_romfs_callback_,
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const {
|
OpenWebPageCallback callback_) const {
|
||||||
extract_romfs_callback = std::move(extract_romfs_callback_);
|
extract_romfs_callback = std::move(extract_romfs_callback_);
|
||||||
callback = std::move(callback_);
|
callback = std::move(callback_);
|
||||||
|
|
||||||
|
@ -416,9 +416,8 @@ void QtWebBrowser::OpenLocalWebPage(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtWebBrowser::OpenExternalWebPage(
|
void QtWebBrowser::OpenExternalWebPage(const std::string& external_url,
|
||||||
const std::string& external_url,
|
OpenWebPageCallback callback_) const {
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback_) const {
|
|
||||||
callback = std::move(callback_);
|
callback = std::move(callback_);
|
||||||
|
|
||||||
const auto index = external_url.find('?');
|
const auto index = external_url.find('?');
|
||||||
|
|
|
@ -197,13 +197,11 @@ public:
|
||||||
~QtWebBrowser() override;
|
~QtWebBrowser() override;
|
||||||
|
|
||||||
void OpenLocalWebPage(const std::string& local_url,
|
void OpenLocalWebPage(const std::string& local_url,
|
||||||
std::function<void()> extract_romfs_callback_,
|
ExtractROMFSCallback extract_romfs_callback_,
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
|
OpenWebPageCallback callback_) const override;
|
||||||
callback_) const override;
|
|
||||||
|
|
||||||
void OpenExternalWebPage(const std::string& external_url,
|
void OpenExternalWebPage(const std::string& external_url,
|
||||||
std::function<void(Service::AM::Applets::WebExitReason, std::string)>
|
OpenWebPageCallback callback_) const override;
|
||||||
callback_) const override;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args,
|
void MainWindowOpenWebPage(const std::string& main_url, const std::string& additional_args,
|
||||||
|
@ -215,7 +213,6 @@ private:
|
||||||
void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason,
|
void MainWindowWebBrowserClosed(Service::AM::Applets::WebExitReason exit_reason,
|
||||||
std::string last_url);
|
std::string last_url);
|
||||||
|
|
||||||
mutable std::function<void()> extract_romfs_callback;
|
mutable ExtractROMFSCallback extract_romfs_callback;
|
||||||
|
mutable OpenWebPageCallback callback;
|
||||||
mutable std::function<void(Service::AM::Applets::WebExitReason, std::string)> callback;
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue