2018-11-10 02:13:15 +01:00
|
|
|
// Copyright 2018 yuzu Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
2018-11-11 22:39:25 +01:00
|
|
|
|
2018-11-10 02:13:15 +01:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QValidator>
|
|
|
|
#include "common/assert.h"
|
|
|
|
#include "core/frontend/applets/software_keyboard.h"
|
|
|
|
|
2018-11-11 22:39:25 +01:00
|
|
|
class GMainWindow;
|
2018-11-10 02:13:15 +01:00
|
|
|
class QDialogButtonBox;
|
|
|
|
class QLabel;
|
|
|
|
class QLineEdit;
|
|
|
|
class QVBoxLayout;
|
|
|
|
class QtSoftwareKeyboard;
|
|
|
|
|
|
|
|
class QtSoftwareKeyboardValidator final : public QValidator {
|
|
|
|
public:
|
2018-11-11 22:39:25 +01:00
|
|
|
explicit QtSoftwareKeyboardValidator(Core::Frontend::SoftwareKeyboardParameters parameters);
|
|
|
|
State validate(QString& input, int& pos) const override;
|
2018-11-10 02:13:15 +01:00
|
|
|
|
|
|
|
private:
|
2018-11-11 22:39:25 +01:00
|
|
|
Core::Frontend::SoftwareKeyboardParameters parameters;
|
2018-11-10 02:13:15 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
class QtSoftwareKeyboardDialog final : public QDialog {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
QtSoftwareKeyboardDialog(QWidget* parent,
|
2018-11-11 22:39:25 +01:00
|
|
|
Core::Frontend::SoftwareKeyboardParameters parameters);
|
|
|
|
~QtSoftwareKeyboardDialog() override;
|
|
|
|
|
2018-11-10 02:13:15 +01:00
|
|
|
void Submit();
|
|
|
|
void Reject();
|
|
|
|
|
2018-11-11 22:39:25 +01:00
|
|
|
std::u16string GetText();
|
|
|
|
bool GetStatus();
|
|
|
|
|
2018-11-10 02:13:15 +01:00
|
|
|
private:
|
|
|
|
bool ok = false;
|
|
|
|
std::u16string text;
|
|
|
|
|
|
|
|
QDialogButtonBox* buttons;
|
|
|
|
QLabel* header_label;
|
|
|
|
QLabel* sub_label;
|
|
|
|
QLabel* guide_label;
|
|
|
|
QLineEdit* line_edit;
|
|
|
|
QVBoxLayout* layout;
|
|
|
|
|
2018-11-11 22:39:25 +01:00
|
|
|
Core::Frontend::SoftwareKeyboardParameters parameters;
|
2018-11-10 02:13:15 +01:00
|
|
|
};
|
|
|
|
|
2018-11-11 22:39:25 +01:00
|
|
|
class QtSoftwareKeyboard final : public QObject, public Core::Frontend::SoftwareKeyboardApplet {
|
2018-11-10 02:13:15 +01:00
|
|
|
public:
|
2018-11-11 22:39:25 +01:00
|
|
|
explicit QtSoftwareKeyboard(GMainWindow& parent);
|
|
|
|
~QtSoftwareKeyboard() override;
|
2018-11-10 02:13:15 +01:00
|
|
|
|
2018-11-11 22:39:25 +01:00
|
|
|
bool GetText(Core::Frontend::SoftwareKeyboardParameters parameters,
|
|
|
|
std::u16string& text) const override;
|
|
|
|
void SendTextCheckDialog(std::u16string error_message) const override;
|
2018-11-10 02:13:15 +01:00
|
|
|
|
|
|
|
private:
|
2018-11-11 22:39:25 +01:00
|
|
|
GMainWindow& main_window;
|
2018-11-10 02:13:15 +01:00
|
|
|
};
|