summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-05-29 00:34:42 -0400
committerGravatar Lioncash2019-05-29 00:56:41 -0400
commit802dd3cc95aee9e7ba3a5005e291beb65612b52b (patch)
treeba5e21e90404819ef075e4ac6860be77c098a952 /src
parentprofile_select: Return int instead of u32 for GetIndex() (diff)
downloadyuzu-802dd3cc95aee9e7ba3a5005e291beb65612b52b.tar.gz
yuzu-802dd3cc95aee9e7ba3a5005e291beb65612b52b.tar.xz
yuzu-802dd3cc95aee9e7ba3a5005e291beb65612b52b.zip
profile_select: Remove unnecessary GetStatus() member function
This behavior is already provided by the built-in exec() function. We just need to check the return value of it.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/applets/profile_select.cpp6
-rw-r--r--src/yuzu/applets/profile_select.h6
-rw-r--r--src/yuzu/main.cpp14
3 files changed, 8 insertions, 18 deletions
diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/profile_select.cpp
index 6696cb532..bb8913162 100644
--- a/src/yuzu/applets/profile_select.cpp
+++ b/src/yuzu/applets/profile_select.cpp
@@ -122,20 +122,14 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent)
122QtProfileSelectionDialog::~QtProfileSelectionDialog() = default; 122QtProfileSelectionDialog::~QtProfileSelectionDialog() = default;
123 123
124void QtProfileSelectionDialog::accept() { 124void QtProfileSelectionDialog::accept() {
125 ok = true;
126 QDialog::accept(); 125 QDialog::accept();
127} 126}
128 127
129void QtProfileSelectionDialog::reject() { 128void QtProfileSelectionDialog::reject() {
130 ok = false;
131 user_index = 0; 129 user_index = 0;
132 QDialog::reject(); 130 QDialog::reject();
133} 131}
134 132
135bool QtProfileSelectionDialog::GetStatus() const {
136 return ok;
137}
138
139int QtProfileSelectionDialog::GetIndex() const { 133int QtProfileSelectionDialog::GetIndex() const {
140 return user_index; 134 return user_index;
141} 135}
diff --git a/src/yuzu/applets/profile_select.h b/src/yuzu/applets/profile_select.h
index ff02df93b..1055d4809 100644
--- a/src/yuzu/applets/profile_select.h
+++ b/src/yuzu/applets/profile_select.h
@@ -29,15 +29,13 @@ public:
29 void accept() override; 29 void accept() override;
30 void reject() override; 30 void reject() override;
31 31
32 bool GetStatus() const;
33 int GetIndex() const; 32 int GetIndex() const;
34 33
35private: 34private:
36 bool ok = false;
37 int user_index = 0;
38
39 void SelectUser(const QModelIndex& index); 35 void SelectUser(const QModelIndex& index);
40 36
37 int user_index = 0;
38
41 QVBoxLayout* layout; 39 QVBoxLayout* layout;
42 QTreeView* tree_view; 40 QTreeView* tree_view;
43 QStandardItemModel* item_model; 41 QStandardItemModel* item_model;
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 1e24b9028..cb07b64b8 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -238,9 +238,7 @@ void GMainWindow::ProfileSelectorSelectProfile() {
238 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | 238 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
239 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); 239 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
240 dialog.setWindowModality(Qt::WindowModal); 240 dialog.setWindowModality(Qt::WindowModal);
241 dialog.exec(); 241 if (dialog.exec() == QDialog::Rejected) {
242
243 if (!dialog.GetStatus()) {
244 emit ProfileSelectorFinishedSelection(std::nullopt); 242 emit ProfileSelectorFinishedSelection(std::nullopt);
245 return; 243 return;
246 } 244 }
@@ -901,11 +899,12 @@ void GMainWindow::SelectAndSetCurrentUser() {
901 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | 899 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
902 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); 900 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
903 dialog.setWindowModality(Qt::WindowModal); 901 dialog.setWindowModality(Qt::WindowModal);
904 dialog.exec();
905 902
906 if (dialog.GetStatus()) { 903 if (dialog.exec() == QDialog::Rejected) {
907 Settings::values.current_user = dialog.GetIndex(); 904 return;
908 } 905 }
906
907 Settings::values.current_user = dialog.GetIndex();
909} 908}
910 909
911void GMainWindow::BootGame(const QString& filename) { 910void GMainWindow::BootGame(const QString& filename) {
@@ -1060,9 +1059,8 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1060 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | 1059 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
1061 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); 1060 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
1062 dialog.setWindowModality(Qt::WindowModal); 1061 dialog.setWindowModality(Qt::WindowModal);
1063 dialog.exec();
1064 1062
1065 if (!dialog.GetStatus()) { 1063 if (dialog.exec() == QDialog::Rejected) {
1066 return -1; 1064 return -1;
1067 } 1065 }
1068 1066