2021-04-13 00:32:26 +02:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
2020-12-28 16:15:37 +01:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <QDialog>
|
|
|
|
#include <QValidator>
|
|
|
|
#include "core/frontend/applets/software_keyboard.h"
|
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
class GMainWindow;
|
|
|
|
class QDialogButtonBox;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QtSoftwareKeyboard;
|
2021-04-05 01:30:07 +02:00
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
class QtSoftwareKeyboardValidator final : public QValidator {
|
|
|
|
public:
|
|
|
|
explicit QtSoftwareKeyboardValidator(Core::Frontend::SoftwareKeyboardParameters parameters);
|
|
|
|
State validate(QString& input, int& pos) const override;
|
2021-04-05 01:30:07 +02:00
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
private:
|
|
|
|
Core::Frontend::SoftwareKeyboardParameters parameters;
|
|
|
|
};
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
class QtSoftwareKeyboardDialog final : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2021-04-13 00:32:26 +02:00
|
|
|
QtSoftwareKeyboardDialog(QWidget* parent,
|
|
|
|
Core::Frontend::SoftwareKeyboardParameters parameters);
|
2020-12-28 16:15:37 +01:00
|
|
|
~QtSoftwareKeyboardDialog() override;
|
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
void accept() override;
|
2020-12-28 16:15:37 +01:00
|
|
|
void reject() override;
|
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
std::u16string GetText() const;
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
private:
|
2021-04-13 00:32:26 +02:00
|
|
|
std::u16string text;
|
2020-12-28 16:15:37 +01:00
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
QDialogButtonBox* buttons;
|
|
|
|
QLabel* header_label;
|
|
|
|
QLabel* sub_label;
|
|
|
|
QLabel* guide_label;
|
|
|
|
QLabel* length_label;
|
|
|
|
QLineEdit* line_edit;
|
|
|
|
QVBoxLayout* layout;
|
2020-12-28 16:15:37 +01:00
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
Core::Frontend::SoftwareKeyboardParameters parameters;
|
2020-12-28 16:15:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class QtSoftwareKeyboard final : public QObject, public Core::Frontend::SoftwareKeyboardApplet {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
|
|
|
~QtSoftwareKeyboard() override;
|
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
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;
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
signals:
|
2021-04-13 00:32:26 +02:00
|
|
|
void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const;
|
|
|
|
void MainWindowTextCheckDialog(std::u16string error_message) const;
|
2020-12-28 16:15:37 +01:00
|
|
|
|
|
|
|
private:
|
2021-04-13 00:32:26 +02:00
|
|
|
void MainWindowFinishedText(std::optional<std::u16string> text);
|
|
|
|
void MainWindowFinishedCheckDialog();
|
2020-12-28 16:15:37 +01:00
|
|
|
|
2021-04-13 00:32:26 +02:00
|
|
|
mutable std::function<void(std::optional<std::u16string>)> text_output;
|
|
|
|
mutable std::function<void()> finished_check;
|
2020-12-28 16:15:37 +01:00
|
|
|
};
|