Merge pull request #1741 from lioncash/kbd

software_keyboard: Minor changes
This commit is contained in:
bunnei 2018-11-23 21:09:18 -05:00 committed by GitHub
commit d57e00801d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 12 deletions

View file

@ -82,8 +82,8 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
: QString::fromStdU16String(parameters.submit_text), : QString::fromStdU16String(parameters.submit_text),
QDialogButtonBox::AcceptRole); QDialogButtonBox::AcceptRole);
connect(buttons, &QDialogButtonBox::accepted, this, &QtSoftwareKeyboardDialog::Submit); connect(buttons, &QDialogButtonBox::accepted, this, &QtSoftwareKeyboardDialog::accept);
connect(buttons, &QDialogButtonBox::rejected, this, &QtSoftwareKeyboardDialog::Reject); connect(buttons, &QDialogButtonBox::rejected, this, &QtSoftwareKeyboardDialog::reject);
layout->addWidget(header_label); layout->addWidget(header_label);
layout->addWidget(sub_label); layout->addWidget(sub_label);
layout->addWidget(guide_label); layout->addWidget(guide_label);
@ -96,16 +96,16 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog(
QtSoftwareKeyboardDialog::~QtSoftwareKeyboardDialog() = default; QtSoftwareKeyboardDialog::~QtSoftwareKeyboardDialog() = default;
void QtSoftwareKeyboardDialog::Submit() { void QtSoftwareKeyboardDialog::accept() {
ok = true; ok = true;
text = line_edit->text().toStdU16String(); text = line_edit->text().toStdU16String();
accept(); QDialog::accept();
} }
void QtSoftwareKeyboardDialog::Reject() { void QtSoftwareKeyboardDialog::reject() {
ok = false; ok = false;
text.clear(); text.clear();
accept(); QDialog::reject();
} }
std::u16string QtSoftwareKeyboardDialog::GetText() const { std::u16string QtSoftwareKeyboardDialog::GetText() const {
@ -129,13 +129,13 @@ QtSoftwareKeyboard::~QtSoftwareKeyboard() = default;
void QtSoftwareKeyboard::RequestText(std::function<void(std::optional<std::u16string>)> out, void QtSoftwareKeyboard::RequestText(std::function<void(std::optional<std::u16string>)> out,
Core::Frontend::SoftwareKeyboardParameters parameters) const { Core::Frontend::SoftwareKeyboardParameters parameters) const {
text_output = out; text_output = std::move(out);
emit MainWindowGetText(parameters); emit MainWindowGetText(parameters);
} }
void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message, void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message,
std::function<void()> finished_check) const { std::function<void()> finished_check) const {
this->finished_check = finished_check; this->finished_check = std::move(finished_check);
emit MainWindowTextCheckDialog(error_message); emit MainWindowTextCheckDialog(error_message);
} }

View file

@ -33,8 +33,8 @@ public:
Core::Frontend::SoftwareKeyboardParameters parameters); Core::Frontend::SoftwareKeyboardParameters parameters);
~QtSoftwareKeyboardDialog() override; ~QtSoftwareKeyboardDialog() override;
void Submit(); void accept() override;
void Reject(); void reject() override;
std::u16string GetText() const; std::u16string GetText() const;
bool GetStatus() const; bool GetStatus() const;
@ -70,11 +70,10 @@ signals:
void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const; void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const;
void MainWindowTextCheckDialog(std::u16string error_message) const; void MainWindowTextCheckDialog(std::u16string error_message) const;
public slots: private:
void MainWindowFinishedText(std::optional<std::u16string> text); void MainWindowFinishedText(std::optional<std::u16string> text);
void MainWindowFinishedCheckDialog(); void MainWindowFinishedCheckDialog();
private:
mutable std::function<void(std::optional<std::u16string>)> text_output; mutable std::function<void(std::optional<std::u16string>)> text_output;
mutable std::function<void()> finished_check; mutable std::function<void()> finished_check;
}; };