From fe2609cb77692bf66783e364db920cbfe1bff078 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Nov 2018 11:29:19 -0500 Subject: yuzu/applets/software_keyboard: Make slots private functions These aren't required to be public. --- src/yuzu/applets/software_keyboard.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h index 73f56714f..db3fbae1d 100644 --- a/src/yuzu/applets/software_keyboard.h +++ b/src/yuzu/applets/software_keyboard.h @@ -70,11 +70,10 @@ signals: void MainWindowGetText(Core::Frontend::SoftwareKeyboardParameters parameters) const; void MainWindowTextCheckDialog(std::u16string error_message) const; -public slots: +private: void MainWindowFinishedText(std::optional text); void MainWindowFinishedCheckDialog(); -private: mutable std::function)> text_output; mutable std::function finished_check; }; -- cgit v1.2.3 From 3fa2b218acefe9ba91378115d3856cd4c6b665e0 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Nov 2018 11:30:51 -0500 Subject: yuzu/applets/software_keyboard: std::move std::function instances where applicable std::function instances can potentially allocate. std::moveing them prevents an avoidable allocation in that case. --- src/yuzu/applets/software_keyboard.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp index efefb1f99..338d91426 100644 --- a/src/yuzu/applets/software_keyboard.cpp +++ b/src/yuzu/applets/software_keyboard.cpp @@ -129,13 +129,13 @@ QtSoftwareKeyboard::~QtSoftwareKeyboard() = default; void QtSoftwareKeyboard::RequestText(std::function)> out, Core::Frontend::SoftwareKeyboardParameters parameters) const { - text_output = out; + text_output = std::move(out); emit MainWindowGetText(parameters); } void QtSoftwareKeyboard::SendTextCheckDialog(std::u16string error_message, std::function finished_check) const { - this->finished_check = finished_check; + this->finished_check = std::move(finished_check); emit MainWindowTextCheckDialog(error_message); } -- cgit v1.2.3 From 4dcdd3a837808fbdc1da4d041295fe678fcfdf81 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Tue, 20 Nov 2018 11:36:47 -0500 Subject: yuzu/applets/software_keyboard: Override accept() and reject() instead of providing own differently named member functions Uses Qt's built-in interface instead of rolling our own separate one on top of it. This also fixes a bug in reject() where we were calling accept() instead of reject(). --- src/yuzu/applets/software_keyboard.cpp | 12 ++++++------ src/yuzu/applets/software_keyboard.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp index 338d91426..8a26fdff1 100644 --- a/src/yuzu/applets/software_keyboard.cpp +++ b/src/yuzu/applets/software_keyboard.cpp @@ -82,8 +82,8 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog( : QString::fromStdU16String(parameters.submit_text), QDialogButtonBox::AcceptRole); - connect(buttons, &QDialogButtonBox::accepted, this, &QtSoftwareKeyboardDialog::Submit); - connect(buttons, &QDialogButtonBox::rejected, this, &QtSoftwareKeyboardDialog::Reject); + connect(buttons, &QDialogButtonBox::accepted, this, &QtSoftwareKeyboardDialog::accept); + connect(buttons, &QDialogButtonBox::rejected, this, &QtSoftwareKeyboardDialog::reject); layout->addWidget(header_label); layout->addWidget(sub_label); layout->addWidget(guide_label); @@ -96,16 +96,16 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog( QtSoftwareKeyboardDialog::~QtSoftwareKeyboardDialog() = default; -void QtSoftwareKeyboardDialog::Submit() { +void QtSoftwareKeyboardDialog::accept() { ok = true; text = line_edit->text().toStdU16String(); - accept(); + QDialog::accept(); } -void QtSoftwareKeyboardDialog::Reject() { +void QtSoftwareKeyboardDialog::reject() { ok = false; text.clear(); - accept(); + QDialog::reject(); } std::u16string QtSoftwareKeyboardDialog::GetText() const { diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h index db3fbae1d..c63720ba4 100644 --- a/src/yuzu/applets/software_keyboard.h +++ b/src/yuzu/applets/software_keyboard.h @@ -33,8 +33,8 @@ public: Core::Frontend::SoftwareKeyboardParameters parameters); ~QtSoftwareKeyboardDialog() override; - void Submit(); - void Reject(); + void accept() override; + void reject() override; std::u16string GetText() const; bool GetStatus() const; -- cgit v1.2.3