瀏覽代碼

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.
Lioncash 7 年之前
父節點
當前提交
802dd3cc95
共有 3 個文件被更改,包括 8 次插入18 次删除
  1. 0 6
      src/yuzu/applets/profile_select.cpp
  2. 2 4
      src/yuzu/applets/profile_select.h
  3. 6 8
      src/yuzu/main.cpp

+ 0 - 6
src/yuzu/applets/profile_select.cpp

@@ -122,20 +122,14 @@ QtProfileSelectionDialog::QtProfileSelectionDialog(QWidget* parent)
 QtProfileSelectionDialog::~QtProfileSelectionDialog() = default;
 QtProfileSelectionDialog::~QtProfileSelectionDialog() = default;
 
 
 void QtProfileSelectionDialog::accept() {
 void QtProfileSelectionDialog::accept() {
-    ok = true;
     QDialog::accept();
     QDialog::accept();
 }
 }
 
 
 void QtProfileSelectionDialog::reject() {
 void QtProfileSelectionDialog::reject() {
-    ok = false;
     user_index = 0;
     user_index = 0;
     QDialog::reject();
     QDialog::reject();
 }
 }
 
 
-bool QtProfileSelectionDialog::GetStatus() const {
-    return ok;
-}
-
 int QtProfileSelectionDialog::GetIndex() const {
 int QtProfileSelectionDialog::GetIndex() const {
     return user_index;
     return user_index;
 }
 }

+ 2 - 4
src/yuzu/applets/profile_select.h

@@ -29,15 +29,13 @@ public:
     void accept() override;
     void accept() override;
     void reject() override;
     void reject() override;
 
 
-    bool GetStatus() const;
     int GetIndex() const;
     int GetIndex() const;
 
 
 private:
 private:
-    bool ok = false;
-    int user_index = 0;
-
     void SelectUser(const QModelIndex& index);
     void SelectUser(const QModelIndex& index);
 
 
+    int user_index = 0;
+
     QVBoxLayout* layout;
     QVBoxLayout* layout;
     QTreeView* tree_view;
     QTreeView* tree_view;
     QStandardItemModel* item_model;
     QStandardItemModel* item_model;

+ 6 - 8
src/yuzu/main.cpp

@@ -238,9 +238,7 @@ void GMainWindow::ProfileSelectorSelectProfile() {
     dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
     dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
                           Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
                           Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
     dialog.setWindowModality(Qt::WindowModal);
     dialog.setWindowModality(Qt::WindowModal);
-    dialog.exec();
-
-    if (!dialog.GetStatus()) {
+    if (dialog.exec() == QDialog::Rejected) {
         emit ProfileSelectorFinishedSelection(std::nullopt);
         emit ProfileSelectorFinishedSelection(std::nullopt);
         return;
         return;
     }
     }
@@ -901,11 +899,12 @@ void GMainWindow::SelectAndSetCurrentUser() {
     dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
     dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
                           Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
                           Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
     dialog.setWindowModality(Qt::WindowModal);
     dialog.setWindowModality(Qt::WindowModal);
-    dialog.exec();
 
 
-    if (dialog.GetStatus()) {
-        Settings::values.current_user = dialog.GetIndex();
+    if (dialog.exec() == QDialog::Rejected) {
+        return;
     }
     }
+
+    Settings::values.current_user = dialog.GetIndex();
 }
 }
 
 
 void GMainWindow::BootGame(const QString& filename) {
 void GMainWindow::BootGame(const QString& filename) {
@@ -1060,9 +1059,8 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
             dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
             dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
                                   Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
                                   Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
             dialog.setWindowModality(Qt::WindowModal);
             dialog.setWindowModality(Qt::WindowModal);
-            dialog.exec();
 
 
-            if (!dialog.GetStatus()) {
+            if (dialog.exec() == QDialog::Rejected) {
                 return -1;
                 return -1;
             }
             }