am: Deglobalize software keyboard applet

This commit is contained in:
Zach Hilman
2018-11-11 16:39:25 -05:00
parent a81645400f
commit e696ed1f4d
17 changed files with 182 additions and 102 deletions

View File

@ -3,11 +3,13 @@
// 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;
@ -16,11 +18,11 @@ class QtSoftwareKeyboard;
class QtSoftwareKeyboardValidator final : public QValidator {
public:
explicit QtSoftwareKeyboardValidator(Frontend::SoftwareKeyboardApplet::Parameters parameters);
State validate(QString&, int&) const override;
explicit QtSoftwareKeyboardValidator(Core::Frontend::SoftwareKeyboardParameters parameters);
State validate(QString& input, int& pos) const override;
private:
Frontend::SoftwareKeyboardApplet::Parameters parameters;
Core::Frontend::SoftwareKeyboardParameters parameters;
};
class QtSoftwareKeyboardDialog final : public QDialog {
@ -28,10 +30,15 @@ class QtSoftwareKeyboardDialog final : public QDialog {
public:
QtSoftwareKeyboardDialog(QWidget* parent,
Frontend::SoftwareKeyboardApplet::Parameters parameters);
Core::Frontend::SoftwareKeyboardParameters parameters);
~QtSoftwareKeyboardDialog() override;
void Submit();
void Reject();
std::u16string GetText();
bool GetStatus();
private:
bool ok = false;
std::u16string text;
@ -43,20 +50,18 @@ private:
QLineEdit* line_edit;
QVBoxLayout* layout;
Frontend::SoftwareKeyboardApplet::Parameters parameters;
friend class QtSoftwareKeyboard;
Core::Frontend::SoftwareKeyboardParameters parameters;
};
class QtSoftwareKeyboard final : public QObject, public Frontend::SoftwareKeyboardApplet {
class QtSoftwareKeyboard final : public QObject, public Core::Frontend::SoftwareKeyboardApplet {
public:
explicit QtSoftwareKeyboard(QWidget& parent);
bool GetText(Parameters parameters, std::u16string& text) override;
explicit QtSoftwareKeyboard(GMainWindow& parent);
~QtSoftwareKeyboard() override;
~QtSoftwareKeyboard() {
UNREACHABLE();
}
bool GetText(Core::Frontend::SoftwareKeyboardParameters parameters,
std::u16string& text) const override;
void SendTextCheckDialog(std::u16string error_message) const override;
private:
QWidget& parent;
GMainWindow& main_window;
};