aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/applets/software_keyboard.cpp
diff options
context:
space:
mode:
authorZach Hilman <zachhilman@gmail.com>2018-11-12 11:08:09 -0500
committerZach Hilman <zachhilman@gmail.com>2018-11-18 10:53:47 -0500
commit8b433beff34c382e50334bb59c4f71394845558c (patch)
treef52f432b2ee5f4ef3917c1c0e2fa052930d68f3a /src/yuzu/applets/software_keyboard.cpp
parent7cfb29de23836aa1873bbb108e3d25a0e9dcfa6d (diff)
software_keyboard: Make GetText asynchronous
a
Diffstat (limited to 'src/yuzu/applets/software_keyboard.cpp')
-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 92992ef872..9fb179f5c0 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);
}