summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Lioncash2019-05-29 00:23:46 -0400
committerGravatar Lioncash2019-05-29 00:29:09 -0400
commit139301c5a12b769d5a13dec55589ed7fb5dc7bdf (patch)
tree7988b954c2cb870185c29a9b247bb8058b87d217 /src
parentMerge pull request #2516 from lioncash/label (diff)
downloadyuzu-139301c5a12b769d5a13dec55589ed7fb5dc7bdf.tar.gz
yuzu-139301c5a12b769d5a13dec55589ed7fb5dc7bdf.tar.xz
yuzu-139301c5a12b769d5a13dec55589ed7fb5dc7bdf.zip
profile_select: Return int instead of u32 for GetIndex()
Qt uses a signed value to represent indices. We should follow this convention where applicable to avoid unnecessary sign-conversion warnings, as well as making it easier to interoperate with other aspects of Qt. While we're at it, we can also make a sign-conversion explicit.
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/applets/profile_select.cpp2
-rw-r--r--src/yuzu/applets/profile_select.h4
-rw-r--r--src/yuzu/main.cpp11
3 files changed, 9 insertions, 8 deletions
diff --git a/src/yuzu/applets/profile_select.cpp b/src/yuzu/applets/profile_select.cpp
index 7fbc9deeb..6696cb532 100644
--- a/src/yuzu/applets/profile_select.cpp
+++ b/src/yuzu/applets/profile_select.cpp
@@ -136,7 +136,7 @@ bool QtProfileSelectionDialog::GetStatus() const {
136 return ok; 136 return ok;
137} 137}
138 138
139u32 QtProfileSelectionDialog::GetIndex() const { 139int QtProfileSelectionDialog::GetIndex() const {
140 return user_index; 140 return user_index;
141} 141}
142 142
diff --git a/src/yuzu/applets/profile_select.h b/src/yuzu/applets/profile_select.h
index 1c2922e54..ff02df93b 100644
--- a/src/yuzu/applets/profile_select.h
+++ b/src/yuzu/applets/profile_select.h
@@ -30,11 +30,11 @@ public:
30 void reject() override; 30 void reject() override;
31 31
32 bool GetStatus() const; 32 bool GetStatus() const;
33 u32 GetIndex() const; 33 int GetIndex() const;
34 34
35private: 35private:
36 bool ok = false; 36 bool ok = false;
37 u32 user_index = 0; 37 int user_index = 0;
38 38
39 void SelectUser(const QModelIndex& index); 39 void SelectUser(const QModelIndex& index);
40 40
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index cef2cc1ae..1e24b9028 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -246,7 +246,7 @@ void GMainWindow::ProfileSelectorSelectProfile() {
246 } 246 }
247 247
248 Service::Account::ProfileManager manager; 248 Service::Account::ProfileManager manager;
249 const auto uuid = manager.GetUser(dialog.GetIndex()); 249 const auto uuid = manager.GetUser(static_cast<std::size_t>(dialog.GetIndex()));
250 if (!uuid.has_value()) { 250 if (!uuid.has_value()) {
251 emit ProfileSelectorFinishedSelection(std::nullopt); 251 emit ProfileSelectorFinishedSelection(std::nullopt);
252 return; 252 return;
@@ -904,7 +904,7 @@ void GMainWindow::SelectAndSetCurrentUser() {
904 dialog.exec(); 904 dialog.exec();
905 905
906 if (dialog.GetStatus()) { 906 if (dialog.GetStatus()) {
907 Settings::values.current_user = static_cast<s32>(dialog.GetIndex()); 907 Settings::values.current_user = dialog.GetIndex();
908 } 908 }
909} 909}
910 910
@@ -1055,7 +1055,7 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1055 const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir); 1055 const std::string nand_dir = FileUtil::GetUserPath(FileUtil::UserPath::NANDDir);
1056 ASSERT(program_id != 0); 1056 ASSERT(program_id != 0);
1057 1057
1058 const auto select_profile = [this]() -> s32 { 1058 const auto select_profile = [this] {
1059 QtProfileSelectionDialog dialog(this); 1059 QtProfileSelectionDialog dialog(this);
1060 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | 1060 dialog.setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint |
1061 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint); 1061 Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint);
@@ -1070,11 +1070,12 @@ void GMainWindow::OnGameListOpenFolder(u64 program_id, GameListOpenTarget target
1070 }; 1070 };
1071 1071
1072 const auto index = select_profile(); 1072 const auto index = select_profile();
1073 if (index == -1) 1073 if (index == -1) {
1074 return; 1074 return;
1075 }
1075 1076
1076 Service::Account::ProfileManager manager; 1077 Service::Account::ProfileManager manager;
1077 const auto user_id = manager.GetUser(index); 1078 const auto user_id = manager.GetUser(static_cast<std::size_t>(index));
1078 ASSERT(user_id); 1079 ASSERT(user_id);
1079 path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser, 1080 path = nand_dir + FileSys::SaveDataFactory::GetFullPath(FileSys::SaveDataSpaceId::NandUser,
1080 FileSys::SaveDataType::SaveData, 1081 FileSys::SaveDataType::SaveData,