diff options
| author | 2019-05-03 19:21:57 +0200 | |
|---|---|---|
| committer | 2019-09-04 16:47:32 +0200 | |
| commit | 7a8f4840205799d837ac32401b4143c716a8bc3d (patch) | |
| tree | 573cc9029e3b7e23605f89d94da4471a3e1b7413 /src | |
| parent | yuzu: Add support for multiple game directories (diff) | |
| download | yuzu-7a8f4840205799d837ac32401b4143c716a8bc3d.tar.gz yuzu-7a8f4840205799d837ac32401b4143c716a8bc3d.tar.xz yuzu-7a8f4840205799d837ac32401b4143c716a8bc3d.zip | |
Address trivial review comments
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/config.cpp | 4 | ||||
| -rw-r--r-- | src/yuzu/game_list.cpp | 71 | ||||
| -rw-r--r-- | src/yuzu/game_list.h | 2 | ||||
| -rw-r--r-- | src/yuzu/game_list_p.h | 21 | ||||
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 6 | ||||
| -rw-r--r-- | src/yuzu/main.h | 2 |
7 files changed, 59 insertions, 53 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp index f2f116a87..b2683faf8 100644 --- a/src/yuzu/configuration/config.cpp +++ b/src/yuzu/configuration/config.cpp | |||
| @@ -521,7 +521,7 @@ void Config::ReadPathValues() { | |||
| 521 | ReadSetting(QStringLiteral("gameListRootDir"), QStringLiteral(".")).toString(); | 521 | ReadSetting(QStringLiteral("gameListRootDir"), QStringLiteral(".")).toString(); |
| 522 | UISettings::values.game_dir_deprecated_deepscan = | 522 | UISettings::values.game_dir_deprecated_deepscan = |
| 523 | ReadSetting(QStringLiteral("gameListDeepScan"), false).toBool(); | 523 | ReadSetting(QStringLiteral("gameListDeepScan"), false).toBool(); |
| 524 | int gamedirs_size = qt_config->beginReadArray(QStringLiteral("gamedirs")); | 524 | const int gamedirs_size = qt_config->beginReadArray(QStringLiteral("gamedirs")); |
| 525 | for (int i = 0; i < gamedirs_size; ++i) { | 525 | for (int i = 0; i < gamedirs_size; ++i) { |
| 526 | qt_config->setArrayIndex(i); | 526 | qt_config->setArrayIndex(i); |
| 527 | UISettings::GameDir game_dir; | 527 | UISettings::GameDir game_dir; |
| @@ -927,7 +927,7 @@ void Config::SavePathValues() { | |||
| 927 | qt_config->beginWriteArray(QStringLiteral("gamedirs")); | 927 | qt_config->beginWriteArray(QStringLiteral("gamedirs")); |
| 928 | for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { | 928 | for (int i = 0; i < UISettings::values.game_dirs.size(); ++i) { |
| 929 | qt_config->setArrayIndex(i); | 929 | qt_config->setArrayIndex(i); |
| 930 | const auto& game_dir = UISettings::values.game_dirs.at(i); | 930 | const auto& game_dir = UISettings::values.game_dirs[i]; |
| 931 | WriteSetting(QStringLiteral("path"), game_dir.path); | 931 | WriteSetting(QStringLiteral("path"), game_dir.path); |
| 932 | WriteSetting(QStringLiteral("deep_scan"), game_dir.deep_scan, false); | 932 | WriteSetting(QStringLiteral("deep_scan"), game_dir.deep_scan, false); |
| 933 | WriteSetting(QStringLiteral("expanded"), game_dir.expanded, true); | 933 | WriteSetting(QStringLiteral("expanded"), game_dir.expanded, true); |
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 65947c59b..e5627abd4 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -87,12 +87,12 @@ QString GameList::getLastFilterResultItem() { | |||
| 87 | QStandardItem* folder; | 87 | QStandardItem* folder; |
| 88 | QStandardItem* child; | 88 | QStandardItem* child; |
| 89 | QString file_path; | 89 | QString file_path; |
| 90 | int folder_count = item_model->rowCount(); | 90 | const int folder_count = item_model->rowCount(); |
| 91 | for (int i = 0; i < folder_count; ++i) { | 91 | for (int i = 0; i < folder_count; ++i) { |
| 92 | folder = item_model->item(i, 0); | 92 | folder = item_model->item(i, 0); |
| 93 | QModelIndex folder_index = folder->index(); | 93 | const QModelIndex folder_index = folder->index(); |
| 94 | int childrenCount = folder->rowCount(); | 94 | const int children_count = folder->rowCount(); |
| 95 | for (int j = 0; j < childrenCount; ++j) { | 95 | for (int j = 0; j < children_count; ++j) { |
| 96 | if (!tree_view->isRowHidden(j, folder_index)) { | 96 | if (!tree_view->isRowHidden(j, folder_index)) { |
| 97 | child = folder->child(j, 0); | 97 | child = folder->child(j, 0); |
| 98 | file_path = child->data(GameListItemPath::FullPathRole).toString(); | 98 | file_path = child->data(GameListItemPath::FullPathRole).toString(); |
| @@ -160,7 +160,7 @@ static bool ContainsAllWords(const QString& haystack, const QString& userinput) | |||
| 160 | 160 | ||
| 161 | // Syncs the expanded state of Game Directories with settings to persist across sessions | 161 | // Syncs the expanded state of Game Directories with settings to persist across sessions |
| 162 | void GameList::onItemExpanded(const QModelIndex& item) { | 162 | void GameList::onItemExpanded(const QModelIndex& item) { |
| 163 | GameListItemType type = item.data(GameListItem::TypeRole).value<GameListItemType>(); | 163 | const auto type = item.data(GameListItem::TypeRole).value<GameListItemType>(); |
| 164 | if (type == GameListItemType::CustomDir || type == GameListItemType::InstalledDir || | 164 | if (type == GameListItemType::CustomDir || type == GameListItemType::InstalledDir || |
| 165 | type == GameListItemType::SystemDir) | 165 | type == GameListItemType::SystemDir) |
| 166 | item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded = | 166 | item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded = |
| @@ -169,11 +169,11 @@ void GameList::onItemExpanded(const QModelIndex& item) { | |||
| 169 | 169 | ||
| 170 | // Event in order to filter the gamelist after editing the searchfield | 170 | // Event in order to filter the gamelist after editing the searchfield |
| 171 | void GameList::onTextChanged(const QString& new_text) { | 171 | void GameList::onTextChanged(const QString& new_text) { |
| 172 | int folder_count = tree_view->model()->rowCount(); | 172 | const int folder_count = tree_view->model()->rowCount(); |
| 173 | QString edit_filter_text = new_text.toLower(); | 173 | QString edit_filter_text = new_text.toLower(); |
| 174 | QStandardItem* folder; | 174 | QStandardItem* folder; |
| 175 | QStandardItem* child; | 175 | QStandardItem* child; |
| 176 | int childrenTotal = 0; | 176 | int children_total = 0; |
| 177 | QModelIndex root_index = item_model->invisibleRootItem()->index(); | 177 | QModelIndex root_index = item_model->invisibleRootItem()->index(); |
| 178 | 178 | ||
| 179 | // If the searchfield is empty every item is visible | 179 | // If the searchfield is empty every item is visible |
| @@ -181,22 +181,22 @@ void GameList::onTextChanged(const QString& new_text) { | |||
| 181 | if (edit_filter_text.isEmpty()) { | 181 | if (edit_filter_text.isEmpty()) { |
| 182 | for (int i = 0; i < folder_count; ++i) { | 182 | for (int i = 0; i < folder_count; ++i) { |
| 183 | folder = item_model->item(i, 0); | 183 | folder = item_model->item(i, 0); |
| 184 | QModelIndex folder_index = folder->index(); | 184 | const QModelIndex folder_index = folder->index(); |
| 185 | int childrenCount = folder->rowCount(); | 185 | const int children_count = folder->rowCount(); |
| 186 | for (int j = 0; j < childrenCount; ++j) { | 186 | for (int j = 0; j < children_count; ++j) { |
| 187 | ++childrenTotal; | 187 | ++children_total; |
| 188 | tree_view->setRowHidden(j, folder_index, false); | 188 | tree_view->setRowHidden(j, folder_index, false); |
| 189 | } | 189 | } |
| 190 | } | 190 | } |
| 191 | search_field->setFilterResult(childrenTotal, childrenTotal); | 191 | search_field->setFilterResult(children_total, children_total); |
| 192 | } else { | 192 | } else { |
| 193 | int result_count = 0; | 193 | int result_count = 0; |
| 194 | for (int i = 0; i < folder_count; ++i) { | 194 | for (int i = 0; i < folder_count; ++i) { |
| 195 | folder = item_model->item(i, 0); | 195 | folder = item_model->item(i, 0); |
| 196 | QModelIndex folder_index = folder->index(); | 196 | const QModelIndex folder_index = folder->index(); |
| 197 | int childrenCount = folder->rowCount(); | 197 | const int children_count = folder->rowCount(); |
| 198 | for (int j = 0; j < childrenCount; ++j) { | 198 | for (int j = 0; j < children_count; ++j) { |
| 199 | ++childrenTotal; | 199 | ++children_total; |
| 200 | const QStandardItem* child = folder->child(j, 0); | 200 | const QStandardItem* child = folder->child(j, 0); |
| 201 | const QString file_path = | 201 | const QString file_path = |
| 202 | child->data(GameListItemPath::FullPathRole).toString().toLower(); | 202 | child->data(GameListItemPath::FullPathRole).toString().toLower(); |
| @@ -220,7 +220,7 @@ void GameList::onTextChanged(const QString& new_text) { | |||
| 220 | } else { | 220 | } else { |
| 221 | tree_view->setRowHidden(j, folder_index, true); | 221 | tree_view->setRowHidden(j, folder_index, true); |
| 222 | } | 222 | } |
| 223 | search_field->setFilterResult(result_count, childrenTotal); | 223 | search_field->setFilterResult(result_count, children_total); |
| 224 | } | 224 | } |
| 225 | } | 225 | } |
| 226 | } | 226 | } |
| @@ -230,7 +230,7 @@ void GameList::onUpdateThemedIcons() { | |||
| 230 | for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) { | 230 | for (int i = 0; i < item_model->invisibleRootItem()->rowCount(); i++) { |
| 231 | QStandardItem* child = item_model->invisibleRootItem()->child(i); | 231 | QStandardItem* child = item_model->invisibleRootItem()->child(i); |
| 232 | 232 | ||
| 233 | int icon_size = UISettings::values.icon_size; | 233 | const int icon_size = UISettings::values.icon_size; |
| 234 | switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) { | 234 | switch (child->data(GameListItem::TypeRole).value<GameListItemType>()) { |
| 235 | case GameListItemType::InstalledDir: | 235 | case GameListItemType::InstalledDir: |
| 236 | child->setData( | 236 | child->setData( |
| @@ -249,8 +249,9 @@ void GameList::onUpdateThemedIcons() { | |||
| 249 | case GameListItemType::CustomDir: { | 249 | case GameListItemType::CustomDir: { |
| 250 | const UISettings::GameDir* game_dir = | 250 | const UISettings::GameDir* game_dir = |
| 251 | child->data(GameListDir::GameDirRole).value<UISettings::GameDir*>(); | 251 | child->data(GameListDir::GameDirRole).value<UISettings::GameDir*>(); |
| 252 | QString icon_name = QFileInfo::exists(game_dir->path) ? QStringLiteral("folder") | 252 | const QString icon_name = QFileInfo::exists(game_dir->path) |
| 253 | : QStringLiteral("bad_folder"); | 253 | ? QStringLiteral("folder") |
| 254 | : QStringLiteral("bad_folder"); | ||
| 254 | child->setData( | 255 | child->setData( |
| 255 | QIcon::fromTheme(icon_name).pixmap(icon_size).scaled( | 256 | QIcon::fromTheme(icon_name).pixmap(icon_size).scaled( |
| 256 | icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 257 | icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), |
| @@ -357,14 +358,14 @@ void GameList::AddEntry(const QList<QStandardItem*>& entry_items, GameListDir* p | |||
| 357 | } | 358 | } |
| 358 | 359 | ||
| 359 | void GameList::ValidateEntry(const QModelIndex& item) { | 360 | void GameList::ValidateEntry(const QModelIndex& item) { |
| 360 | auto selected = item.sibling(item.row(), 0); | 361 | const auto selected = item.sibling(item.row(), 0); |
| 361 | 362 | ||
| 362 | switch (selected.data(GameListItem::TypeRole).value<GameListItemType>()) { | 363 | switch (selected.data(GameListItem::TypeRole).value<GameListItemType>()) { |
| 363 | case GameListItemType::Game: { | 364 | case GameListItemType::Game: { |
| 364 | QString file_path = selected.data(GameListItemPath::FullPathRole).toString(); | 365 | const QString file_path = selected.data(GameListItemPath::FullPathRole).toString(); |
| 365 | if (file_path.isEmpty()) | 366 | if (file_path.isEmpty()) |
| 366 | return; | 367 | return; |
| 367 | QFileInfo file_info(file_path); | 368 | const QFileInfo file_info(file_path); |
| 368 | if (!file_info.exists()) | 369 | if (!file_info.exists()) |
| 369 | return; | 370 | return; |
| 370 | 371 | ||
| @@ -391,7 +392,7 @@ void GameList::ValidateEntry(const QModelIndex& item) { | |||
| 391 | bool GameList::isEmpty() { | 392 | bool GameList::isEmpty() { |
| 392 | for (int i = 0; i < item_model->rowCount(); i++) { | 393 | for (int i = 0; i < item_model->rowCount(); i++) { |
| 393 | const QStandardItem* child = item_model->invisibleRootItem()->child(i); | 394 | const QStandardItem* child = item_model->invisibleRootItem()->child(i); |
| 394 | GameListItemType type = static_cast<GameListItemType>(child->type()); | 395 | const auto type = static_cast<GameListItemType>(child->type()); |
| 395 | if (!child->hasChildren() && | 396 | if (!child->hasChildren() && |
| 396 | (type == GameListItemType::InstalledDir || type == GameListItemType::SystemDir)) { | 397 | (type == GameListItemType::InstalledDir || type == GameListItemType::SystemDir)) { |
| 397 | item_model->invisibleRootItem()->removeRow(child->row()); | 398 | item_model->invisibleRootItem()->removeRow(child->row()); |
| @@ -422,16 +423,16 @@ void GameList::DonePopulating(QStringList watch_list) { | |||
| 422 | QCoreApplication::processEvents(); | 423 | QCoreApplication::processEvents(); |
| 423 | } | 424 | } |
| 424 | tree_view->setEnabled(true); | 425 | tree_view->setEnabled(true); |
| 425 | int folder_count = tree_view->model()->rowCount(); | 426 | const int folder_count = tree_view->model()->rowCount(); |
| 426 | int childrenTotal = 0; | 427 | int children_total = 0; |
| 427 | for (int i = 0; i < folder_count; ++i) { | 428 | for (int i = 0; i < folder_count; ++i) { |
| 428 | int childrenCount = item_model->item(i, 0)->rowCount(); | 429 | int children_count = item_model->item(i, 0)->rowCount(); |
| 429 | for (int j = 0; j < childrenCount; ++j) { | 430 | for (int j = 0; j < children_count; ++j) { |
| 430 | ++childrenTotal; | 431 | ++children_total; |
| 431 | } | 432 | } |
| 432 | } | 433 | } |
| 433 | search_field->setFilterResult(childrenTotal, childrenTotal); | 434 | search_field->setFilterResult(children_total, children_total); |
| 434 | if (childrenTotal > 0) { | 435 | if (children_total > 0) { |
| 435 | search_field->setFocus(); | 436 | search_field->setFocus(); |
| 436 | } | 437 | } |
| 437 | } | 438 | } |
| @@ -441,7 +442,7 @@ void GameList::PopupContextMenu(const QPoint& menu_location) { | |||
| 441 | if (!item.isValid()) | 442 | if (!item.isValid()) |
| 442 | return; | 443 | return; |
| 443 | 444 | ||
| 444 | auto selected = item.sibling(item.row(), 0); | 445 | const auto selected = item.sibling(item.row(), 0); |
| 445 | QMenu context_menu; | 446 | QMenu context_menu; |
| 446 | switch (selected.data(GameListItem::TypeRole).value<GameListItemType>()) { | 447 | switch (selected.data(GameListItem::TypeRole).value<GameListItemType>()) { |
| 447 | case GameListItemType::Game: | 448 | case GameListItemType::Game: |
| @@ -523,7 +524,7 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { | |||
| 523 | QAction* move_down = context_menu.addAction(tr(u8"\U000025bc Move Down ")); | 524 | QAction* move_down = context_menu.addAction(tr(u8"\U000025bc Move Down ")); |
| 524 | QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location")); | 525 | QAction* open_directory_location = context_menu.addAction(tr("Open Directory Location")); |
| 525 | 526 | ||
| 526 | int row = selected.row(); | 527 | const int row = selected.row(); |
| 527 | 528 | ||
| 528 | move_up->setEnabled(row > 0); | 529 | move_up->setEnabled(row > 0); |
| 529 | move_down->setEnabled(row < item_model->rowCount() - 2); | 530 | move_down->setEnabled(row < item_model->rowCount() - 2); |
| @@ -532,7 +533,7 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { | |||
| 532 | // find the indices of the items in settings and swap them | 533 | // find the indices of the items in settings and swap them |
| 533 | UISettings::values.game_dirs.swap( | 534 | UISettings::values.game_dirs.swap( |
| 534 | UISettings::values.game_dirs.indexOf(game_dir), | 535 | UISettings::values.game_dirs.indexOf(game_dir), |
| 535 | UISettings::values.game_dirs.indexOf(*selected.sibling(selected.row() - 1, 0) | 536 | UISettings::values.game_dirs.indexOf(*selected.sibling(row - 1, 0) |
| 536 | .data(GameListDir::GameDirRole) | 537 | .data(GameListDir::GameDirRole) |
| 537 | .value<UISettings::GameDir*>())); | 538 | .value<UISettings::GameDir*>())); |
| 538 | // move the treeview items | 539 | // move the treeview items |
| @@ -549,7 +550,7 @@ void GameList::AddPermDirPopup(QMenu& context_menu, QModelIndex selected) { | |||
| 549 | .data(GameListDir::GameDirRole) | 550 | .data(GameListDir::GameDirRole) |
| 550 | .value<UISettings::GameDir*>())); | 551 | .value<UISettings::GameDir*>())); |
| 551 | // move the treeview items | 552 | // move the treeview items |
| 552 | QList<QStandardItem*> item = item_model->takeRow(row); | 553 | const QList<QStandardItem*> item = item_model->takeRow(row); |
| 553 | item_model->invisibleRootItem()->insertRow(row + 1, item); | 554 | item_model->invisibleRootItem()->insertRow(row + 1, item); |
| 554 | tree_view->setExpanded(selected, game_dir.expanded); | 555 | tree_view->setExpanded(selected, game_dir.expanded); |
| 555 | }); | 556 | }); |
diff --git a/src/yuzu/game_list.h b/src/yuzu/game_list.h index a2b58aba5..cf5bd3a39 100644 --- a/src/yuzu/game_list.h +++ b/src/yuzu/game_list.h | |||
| @@ -80,7 +80,7 @@ signals: | |||
| 80 | void NavigateToGamedbEntryRequested(u64 program_id, | 80 | void NavigateToGamedbEntryRequested(u64 program_id, |
| 81 | const CompatibilityList& compatibility_list); | 81 | const CompatibilityList& compatibility_list); |
| 82 | void OpenPerGameGeneralRequested(const std::string& file); | 82 | void OpenPerGameGeneralRequested(const std::string& file); |
| 83 | void OpenDirectory(QString directory); | 83 | void OpenDirectory(const QString& directory); |
| 84 | void AddDirectory(); | 84 | void AddDirectory(); |
| 85 | void ShowList(bool show); | 85 | void ShowList(bool show); |
| 86 | 86 | ||
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h index f5abb759d..13623f526 100644 --- a/src/yuzu/game_list_p.h +++ b/src/yuzu/game_list_p.h | |||
| @@ -220,12 +220,14 @@ public: | |||
| 220 | UISettings::GameDir* game_dir = &directory; | 220 | UISettings::GameDir* game_dir = &directory; |
| 221 | setData(QVariant::fromValue(game_dir), GameDirRole); | 221 | setData(QVariant::fromValue(game_dir), GameDirRole); |
| 222 | 222 | ||
| 223 | int icon_size = UISettings::values.icon_size; | 223 | const int icon_size = UISettings::values.icon_size; |
| 224 | switch (dir_type) { | 224 | switch (dir_type) { |
| 225 | case GameListItemType::InstalledDir: | 225 | case GameListItemType::InstalledDir: |
| 226 | setData(QIcon::fromTheme("sd_card").pixmap(icon_size).scaled( | 226 | setData( |
| 227 | icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 227 | QIcon::fromTheme(QStringLiteral("sd_card")) |
| 228 | Qt::DecorationRole); | 228 | .pixmap(icon_size) |
| 229 | .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | ||
| 230 | Qt::DecorationRole); | ||
| 229 | setData("Installed Titles", Qt::DisplayRole); | 231 | setData("Installed Titles", Qt::DisplayRole); |
| 230 | break; | 232 | break; |
| 231 | case GameListItemType::SystemDir: | 233 | case GameListItemType::SystemDir: |
| @@ -235,7 +237,9 @@ public: | |||
| 235 | setData("System Titles", Qt::DisplayRole); | 237 | setData("System Titles", Qt::DisplayRole); |
| 236 | break; | 238 | break; |
| 237 | case GameListItemType::CustomDir: | 239 | case GameListItemType::CustomDir: |
| 238 | QString icon_name = QFileInfo::exists(game_dir->path) ? "folder" : "bad_folder"; | 240 | const QString icon_name = QFileInfo::exists(game_dir->path) |
| 241 | ? QStringLiteral("folder") | ||
| 242 | : QStringLiteral("bad_folder"); | ||
| 239 | setData(QIcon::fromTheme(icon_name).pixmap(icon_size).scaled( | 243 | setData(QIcon::fromTheme(icon_name).pixmap(icon_size).scaled( |
| 240 | icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 244 | icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), |
| 241 | Qt::DecorationRole); | 245 | Qt::DecorationRole); |
| @@ -257,9 +261,10 @@ public: | |||
| 257 | explicit GameListAddDir() { | 261 | explicit GameListAddDir() { |
| 258 | setData(type(), TypeRole); | 262 | setData(type(), TypeRole); |
| 259 | 263 | ||
| 260 | int icon_size = UISettings::values.icon_size; | 264 | const int icon_size = UISettings::values.icon_size; |
| 261 | setData(QIcon::fromTheme("plus").pixmap(icon_size).scaled( | 265 | setData(QIcon::fromTheme(QStringLiteral("plus")) |
| 262 | icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | 266 | .pixmap(icon_size) |
| 267 | .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), | ||
| 263 | Qt::DecorationRole); | 268 | Qt::DecorationRole); |
| 264 | setData("Add New Game Directory", Qt::DisplayRole); | 269 | setData("Add New Game Directory", Qt::DisplayRole); |
| 265 | } | 270 | } |
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 8c6621c98..e1e69bc1a 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -354,16 +354,16 @@ void GameListWorker::run() { | |||
| 354 | 354 | ||
| 355 | for (UISettings::GameDir& game_dir : game_dirs) { | 355 | for (UISettings::GameDir& game_dir : game_dirs) { |
| 356 | if (game_dir.path == "INSTALLED") { | 356 | if (game_dir.path == "INSTALLED") { |
| 357 | GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::InstalledDir); | 357 | auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::InstalledDir); |
| 358 | emit DirEntryReady({game_list_dir}); | 358 | emit DirEntryReady({game_list_dir}); |
| 359 | AddTitlesToGameList(game_list_dir); | 359 | AddTitlesToGameList(game_list_dir); |
| 360 | } else if (game_dir.path == "SYSTEM") { | 360 | } else if (game_dir.path == "SYSTEM") { |
| 361 | GameListDir* game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir); | 361 | auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir); |
| 362 | emit DirEntryReady({game_list_dir}); | 362 | emit DirEntryReady({game_list_dir}); |
| 363 | AddTitlesToGameList(game_list_dir); | 363 | AddTitlesToGameList(game_list_dir); |
| 364 | } else { | 364 | } else { |
| 365 | watch_list.append(game_dir.path); | 365 | watch_list.append(game_dir.path); |
| 366 | GameListDir* game_list_dir = new GameListDir(game_dir); | 366 | auto* const game_list_dir = new GameListDir(game_dir); |
| 367 | emit DirEntryReady({game_list_dir}); | 367 | emit DirEntryReady({game_list_dir}); |
| 368 | provider->ClearAllEntries(); | 368 | provider->ClearAllEntries(); |
| 369 | ScanFileSystem(ScanTarget::FillManualContentProvider, game_dir.path.toStdString(), 2, | 369 | ScanFileSystem(ScanTarget::FillManualContentProvider, game_dir.path.toStdString(), 2, |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b2de9545b..3146e054c 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -1309,11 +1309,11 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id, | |||
| 1309 | QDesktopServices::openUrl(QUrl(QStringLiteral("https://yuzu-emu.org/game/") + directory)); | 1309 | QDesktopServices::openUrl(QUrl(QStringLiteral("https://yuzu-emu.org/game/") + directory)); |
| 1310 | } | 1310 | } |
| 1311 | 1311 | ||
| 1312 | void GMainWindow::OnGameListOpenDirectory(QString directory) { | 1312 | void GMainWindow::OnGameListOpenDirectory(const QString& directory) { |
| 1313 | QString path; | 1313 | QString path; |
| 1314 | if (directory == QStringLiteral("INSTALLED")) { | 1314 | if (directory == QStringLiteral("INSTALLED")) { |
| 1315 | // TODO: Find a better solution when installing files to the SD card gets implemented | 1315 | // TODO: Find a better solution when installing files to the SD card gets implemented |
| 1316 | path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() + | 1316 | path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + |
| 1317 | std::string("user/Contents/registered")); | 1317 | std::string("user/Contents/registered")); |
| 1318 | } else if (directory == QStringLiteral("SYSTEM")) { | 1318 | } else if (directory == QStringLiteral("SYSTEM")) { |
| 1319 | path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() + | 1319 | path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir).c_str() + |
| @@ -1329,7 +1329,7 @@ void GMainWindow::OnGameListOpenDirectory(QString directory) { | |||
| 1329 | } | 1329 | } |
| 1330 | 1330 | ||
| 1331 | void GMainWindow::OnGameListAddDirectory() { | 1331 | void GMainWindow::OnGameListAddDirectory() { |
| 1332 | QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); | 1332 | const QString dir_path = QFileDialog::getExistingDirectory(this, tr("Select Directory")); |
| 1333 | if (dir_path.isEmpty()) | 1333 | if (dir_path.isEmpty()) |
| 1334 | return; | 1334 | return; |
| 1335 | UISettings::GameDir game_dir{dir_path, false, true}; | 1335 | UISettings::GameDir game_dir{dir_path, false, true}; |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index b7398b6c7..7d16188cb 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -187,7 +187,7 @@ private slots: | |||
| 187 | void OnGameListCopyTID(u64 program_id); | 187 | void OnGameListCopyTID(u64 program_id); |
| 188 | void OnGameListNavigateToGamedbEntry(u64 program_id, | 188 | void OnGameListNavigateToGamedbEntry(u64 program_id, |
| 189 | const CompatibilityList& compatibility_list); | 189 | const CompatibilityList& compatibility_list); |
| 190 | void OnGameListOpenDirectory(QString path); | 190 | void OnGameListOpenDirectory(const QString& directory); |
| 191 | void OnGameListAddDirectory(); | 191 | void OnGameListAddDirectory(); |
| 192 | void OnGameListShowList(bool show); | 192 | void OnGameListShowList(bool show); |
| 193 | void OnGameListOpenPerGameProperties(const std::string& file); | 193 | void OnGameListOpenPerGameProperties(const std::string& file); |