aboutsummaryrefslogtreecommitdiff
path: root/src/yuzu/applets/software_keyboard.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-11-20 08:24:11 -0800
committerGitHub <noreply@github.com>2018-11-20 08:24:11 -0800
commitb6d2c64f4dcb01f1ffc99f9a057910ec65c6a401 (patch)
treeb75fde22327ac851821d58078614e62cc1c29916 /src/yuzu/applets/software_keyboard.h
parente9265ac598d65a41e5d62103e48b7786e7cd64d6 (diff)
parenta9fa890f14afc84307884aa802b6255c906054d9 (diff)
Merge pull request #1667 from DarkLordZach/swkbd
am: Implement HLE software keyboard applet
Diffstat (limited to 'src/yuzu/applets/software_keyboard.h')
-rw-r--r--src/yuzu/applets/software_keyboard.h80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h
new file mode 100644
index 0000000000..73f56714f9
--- /dev/null
+++ b/src/yuzu/applets/software_keyboard.h
@@ -0,0 +1,80 @@
+// Copyright 2018 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <QDialog>
+#include <QValidator>
+#include "common/assert.h"
+#include "core/frontend/applets/software_keyboard.h"
+
+class GMainWindow;
+class QDialogButtonBox;
+class QLabel;
+class QLineEdit;
+class QVBoxLayout;
+class QtSoftwareKeyboard;
+
+class QtSoftwareKeyboardValidator final : public QValidator {
+public:
+ explicit QtSoftwareKeyboardValidator(Core::Frontend::SoftwareKeyboardParameters parameters);
+ State validate(QString& input, int& pos) const override;
+
+private:
+ Core::Frontend::SoftwareKeyboardParameters parameters;
+};
+
+class QtSoftwareKeyboardDialog final : public QDialog {
+ Q_OBJECT
+
+public:
+ QtSoftwareKeyboardDialog(QWidget* parent,
+ Core::Frontend::SoftwareKeyboardParameters parameters);
+ ~QtSoftwareKeyboardDialog() override;
+
+ void Submit();
+ void Reject();
+
+ std::u16string GetText() const;
+ bool GetStatus() const;
+
+private:
+ bool ok = false;
+ std::u16string text;
+
+ QDialogButtonBox* buttons;
+ QLabel* header_label;
+ QLabel* sub_label;
+ QLabel* guide_label;
+ QLabel* length_label;
+ QLineEdit* line_edit;
+ QVBoxLayout* layout;
+
+ Core::Frontend::SoftwareKeyboardParameters parameters;
+};
+
+class QtSoftwareKeyboard final : public QObject, public Core::Frontend::SoftwareKeyboardApplet {
+ Q_OBJECT
+
+public:
+ explicit QtSoftwareKeyboard(GMainWindow& parent);
+ ~QtSoftwareKeyboard() override;
+
+ void RequestText(std::function<void(std::optional<std::u16string>)> out,
+ Core::Frontend::SoftwareKeyboardParameters parameters) const override;
+ void SendTextCheckDialog(std::u16string error_message,
+ std::function<void()> finished_check) const override;
+
+signals:
+ void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const;
+ void MainWindowTextCheckDialog(std::u16string error_message) const;
+
+public slots:
+ void MainWindowFinishedText(std::optional<std::u16string> text);
+ void MainWindowFinishedCheckDialog();
+
+private:
+ mutable std::function<void(std::optional<std::u16string>)> text_output;
+ mutable std::function<void()> finished_check;
+};