diff options
| author | 2019-05-29 00:52:47 -0400 | |
|---|---|---|
| committer | 2019-05-29 00:56:45 -0400 | |
| commit | cfc9d92b38bae6d9815ae06bbe5e2d800887f897 (patch) | |
| tree | 0e29c639d312387b9ec6e32a22fa73d084e3b4f8 | |
| parent | profile_select: Remove unnecessary GetStatus() member function (diff) | |
| download | yuzu-cfc9d92b38bae6d9815ae06bbe5e2d800887f897.tar.gz yuzu-cfc9d92b38bae6d9815ae06bbe5e2d800887f897.tar.xz yuzu-cfc9d92b38bae6d9815ae06bbe5e2d800887f897.zip | |
yuzu/software_keyboard: Remove unnecessary GetStatus() member function
Like with the profile selection dialog, we can just use the result of
QDialog's exec() function to determine whether or not a dialog was
accepted.
| -rw-r--r-- | src/yuzu/applets/software_keyboard.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/applets/software_keyboard.h | 2 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 3 |
3 files changed, 1 insertions, 10 deletions
diff --git a/src/yuzu/applets/software_keyboard.cpp b/src/yuzu/applets/software_keyboard.cpp index 5223ec977..af36f07c6 100644 --- a/src/yuzu/applets/software_keyboard.cpp +++ b/src/yuzu/applets/software_keyboard.cpp | |||
| @@ -104,13 +104,11 @@ QtSoftwareKeyboardDialog::QtSoftwareKeyboardDialog( | |||
| 104 | QtSoftwareKeyboardDialog::~QtSoftwareKeyboardDialog() = default; | 104 | QtSoftwareKeyboardDialog::~QtSoftwareKeyboardDialog() = default; |
| 105 | 105 | ||
| 106 | void QtSoftwareKeyboardDialog::accept() { | 106 | void QtSoftwareKeyboardDialog::accept() { |
| 107 | ok = true; | ||
| 108 | text = line_edit->text().toStdU16String(); | 107 | text = line_edit->text().toStdU16String(); |
| 109 | QDialog::accept(); | 108 | QDialog::accept(); |
| 110 | } | 109 | } |
| 111 | 110 | ||
| 112 | void QtSoftwareKeyboardDialog::reject() { | 111 | void QtSoftwareKeyboardDialog::reject() { |
| 113 | ok = false; | ||
| 114 | text.clear(); | 112 | text.clear(); |
| 115 | QDialog::reject(); | 113 | QDialog::reject(); |
| 116 | } | 114 | } |
| @@ -119,10 +117,6 @@ std::u16string QtSoftwareKeyboardDialog::GetText() const { | |||
| 119 | return text; | 117 | return text; |
| 120 | } | 118 | } |
| 121 | 119 | ||
| 122 | bool QtSoftwareKeyboardDialog::GetStatus() const { | ||
| 123 | return ok; | ||
| 124 | } | ||
| 125 | |||
| 126 | QtSoftwareKeyboard::QtSoftwareKeyboard(GMainWindow& main_window) { | 120 | QtSoftwareKeyboard::QtSoftwareKeyboard(GMainWindow& main_window) { |
| 127 | connect(this, &QtSoftwareKeyboard::MainWindowGetText, &main_window, | 121 | connect(this, &QtSoftwareKeyboard::MainWindowGetText, &main_window, |
| 128 | &GMainWindow::SoftwareKeyboardGetText, Qt::QueuedConnection); | 122 | &GMainWindow::SoftwareKeyboardGetText, Qt::QueuedConnection); |
diff --git a/src/yuzu/applets/software_keyboard.h b/src/yuzu/applets/software_keyboard.h index 78c5a042b..44bcece75 100644 --- a/src/yuzu/applets/software_keyboard.h +++ b/src/yuzu/applets/software_keyboard.h | |||
| @@ -36,10 +36,8 @@ public: | |||
| 36 | void reject() override; | 36 | void reject() override; |
| 37 | 37 | ||
| 38 | std::u16string GetText() const; | 38 | std::u16string GetText() const; |
| 39 | bool GetStatus() const; | ||
| 40 | 39 | ||
| 41 | private: | 40 | private: |
| 42 | bool ok = false; | ||
| 43 | std::u16string text; | 41 | std::u16string text; |
| 44 | 42 | ||
| 45 | QDialogButtonBox* buttons; | 43 | QDialogButtonBox* buttons; |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index cb07b64b8..92de0097e 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -259,9 +259,8 @@ void GMainWindow::SoftwareKeyboardGetText( | |||
| 259 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | | 259 | dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | |
| 260 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); | 260 | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); |
| 261 | dialog.setWindowModality(Qt::WindowModal); | 261 | dialog.setWindowModality(Qt::WindowModal); |
| 262 | dialog.exec(); | ||
| 263 | 262 | ||
| 264 | if (!dialog.GetStatus()) { | 263 | if (dialog.exec() == QDialog::Rejected) { |
| 265 | emit SoftwareKeyboardFinishedText(std::nullopt); | 264 | emit SoftwareKeyboardFinishedText(std::nullopt); |
| 266 | return; | 265 | return; |
| 267 | } | 266 | } |