summaryrefslogtreecommitdiffstats
path: root/src/yuzu/applets/software_keyboard.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/yuzu/applets/software_keyboard.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp
index 92992ef87..9fb179f5c 100644
--- a/src/yuzu/applets/software_keyboard.cpp
+++ b/src/yuzu/applets/software_keyboard.cpp
@@ -105,20 +105,27 @@ bool QtSoftwareKeyboardDialog::GetStatus() const {
return ok;
}
-QtSoftwareKeyboard::QtSoftwareKeyboard(GMainWindow& parent) : main_window(parent) {}
+QtSoftwareKeyboard::QtSoftwareKeyboard(GMainWindow& main_window) {
+ connect(this, &QtSoftwareKeyboard::MainWindowGetText, &main_window,
+ &GMainWindow::SoftwareKeyboardGetText, Qt::QueuedConnection);
+ connect(this, &QtSoftwareKeyboard::MainWindowTextCheckDialog, &main_window,
+ &GMainWindow::SoftwareKeyboardInvokeCheckDialog, Qt::BlockingQueuedConnection);
+ connect(&main_window, &GMainWindow::SoftwareKeyboardFinishedText, this,
+ &QtSoftwareKeyboard::MainWindowFinishedText, Qt::QueuedConnection);
+}
QtSoftwareKeyboard::~QtSoftwareKeyboard() = default;
-std::optional<std::u16string> QtSoftwareKeyboard::GetText(
- Core::Frontend::SoftwareKeyboardParameters parameters) const {
- std::optional<std::u16string> success;
- QMetaObject::invokeMethod(&main_window, "SoftwareKeyboardGetText", Qt::BlockingQueuedConnection,
- Q_RETURN_ARG(std::optional<std::u16string>, success),
- Q_ARG(Core::Frontend::SoftwareKeyboardParameters, parameters));
- return success;
+void QtSoftwareKeyboard::RequestText(std::function<void(std::optional<std::u16string>)> out,
+ Core::Frontend::SoftwareKeyboardParameters parameters) const {
+ text_output = out;
+ emit MainWindowGetText(parameters);
}
void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message) const {
- QMetaObject::invokeMethod(&main_window, "SoftwareKeyboardInvokeCheckDialog",
- Qt::BlockingQueuedConnection, Q_ARG(std::u16string, error_message));
+ emit MainWindowTextCheckDialog(error_message);
+}
+
+void QtSoftwareKeyboard::MainWindowFinishedText(std::optional<std::u16string> text) {
+ text_output(text);
}