summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar fearlessTobi2019-05-05 03:07:09 +0200
committerGravatar FearlessTobi2019-09-04 16:47:32 +0200
commit5aaafa6a56101a18759264bbf1ef9293d424f899 (patch)
treea003ef0c8b3af5821b2f1c28ff24e99b444b9e40 /src
parentAddress more trivial review comments (diff)
downloadyuzu-5aaafa6a56101a18759264bbf1ef9293d424f899.tar.gz
yuzu-5aaafa6a56101a18759264bbf1ef9293d424f899.tar.xz
yuzu-5aaafa6a56101a18759264bbf1ef9293d424f899.zip
Separate UserNand and Sdmc directories
Diffstat (limited to 'src')
-rw-r--r--src/yuzu/configuration/config.cpp6
-rw-r--r--src/yuzu/game_list.cpp23
-rw-r--r--src/yuzu/game_list_p.h29
-rw-r--r--src/yuzu/game_list_worker.cpp25
-rw-r--r--src/yuzu/main.cpp8
5 files changed, 59 insertions, 32 deletions
diff --git a/src/yuzu/configuration/config.cpp b/src/yuzu/configuration/config.cpp
index b2683faf8..f594106bf 100644
--- a/src/yuzu/configuration/config.cpp
+++ b/src/yuzu/configuration/config.cpp
@@ -535,10 +535,12 @@ void Config::ReadPathValues() {
535 // also carries over old game list settings if present 535 // also carries over old game list settings if present
536 if (UISettings::values.game_dirs.isEmpty()) { 536 if (UISettings::values.game_dirs.isEmpty()) {
537 UISettings::GameDir game_dir; 537 UISettings::GameDir game_dir;
538 game_dir.path = QStringLiteral("INSTALLED"); 538 game_dir.path = QStringLiteral("SDMC");
539 game_dir.expanded = true; 539 game_dir.expanded = true;
540 UISettings::values.game_dirs.append(game_dir); 540 UISettings::values.game_dirs.append(game_dir);
541 game_dir.path = QStringLiteral("SYSTEM"); 541 game_dir.path = QStringLiteral("UserNAND");
542 UISettings::values.game_dirs.append(game_dir);
543 game_dir.path = QStringLiteral("SysNAND");
542 UISettings::values.game_dirs.append(game_dir); 544 UISettings::values.game_dirs.append(game_dir);
543 if (UISettings::values.game_dir_deprecated != QStringLiteral(".")) { 545 if (UISettings::values.game_dir_deprecated != QStringLiteral(".")) {
544 game_dir.path = UISettings::values.game_dir_deprecated; 546 game_dir.path = UISettings::values.game_dir_deprecated;
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp
index 51ced635b..cab982385 100644
--- a/src/yuzu/game_list.cpp
+++ b/src/yuzu/game_list.cpp
@@ -161,8 +161,8 @@ static bool ContainsAllWords(const QString& haystack, const QString& userinput)
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
162void GameList::onItemExpanded(const QModelIndex& item) { 162void GameList::onItemExpanded(const QModelIndex& item) {
163 const auto 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::SdmcDir ||
165 type == GameListItemType::SystemDir) 165 type == GameListItemType::UserNandDir || type == GameListItemType::SysNandDir)
166 item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded = 166 item.data(GameListDir::GameDirRole).value<UISettings::GameDir*>()->expanded =
167 tree_view->isExpanded(item); 167 tree_view->isExpanded(item);
168} 168}
@@ -232,14 +232,21 @@ void GameList::onUpdateThemedIcons() {
232 232
233 const 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::SdmcDir:
236 child->setData( 236 child->setData(
237 QIcon::fromTheme(QStringLiteral("sd_card")) 237 QIcon::fromTheme(QStringLiteral("sd_card"))
238 .pixmap(icon_size) 238 .pixmap(icon_size)
239 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 239 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
240 Qt::DecorationRole); 240 Qt::DecorationRole);
241 break; 241 break;
242 case GameListItemType::SystemDir: 242 case GameListItemType::UserNandDir:
243 child->setData(
244 QIcon::fromTheme(QStringLiteral("chip"))
245 .pixmap(icon_size)
246 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
247 Qt::DecorationRole);
248 break;
249 case GameListItemType::SysNandDir:
243 child->setData( 250 child->setData(
244 QIcon::fromTheme(QStringLiteral("chip")) 251 QIcon::fromTheme(QStringLiteral("chip"))
245 .pixmap(icon_size) 252 .pixmap(icon_size)
@@ -394,7 +401,8 @@ bool GameList::isEmpty() const {
394 const QStandardItem* child = item_model->invisibleRootItem()->child(i); 401 const QStandardItem* child = item_model->invisibleRootItem()->child(i);
395 const auto type = static_cast<GameListItemType>(child->type()); 402 const auto type = static_cast<GameListItemType>(child->type());
396 if (!child->hasChildren() && 403 if (!child->hasChildren() &&
397 (type == GameListItemType::InstalledDir || type == GameListItemType::SystemDir)) { 404 (type == GameListItemType::SdmcDir || type == GameListItemType::UserNandDir ||
405 type == GameListItemType::SysNandDir)) {
398 item_model->invisibleRootItem()->removeRow(child->row()); 406 item_model->invisibleRootItem()->removeRow(child->row());
399 i--; 407 i--;
400 }; 408 };
@@ -450,8 +458,9 @@ void GameList::PopupContextMenu(const QPoint& menu_location) {
450 AddPermDirPopup(context_menu, selected); 458 AddPermDirPopup(context_menu, selected);
451 AddCustomDirPopup(context_menu, selected); 459 AddCustomDirPopup(context_menu, selected);
452 break; 460 break;
453 case GameListItemType::InstalledDir: 461 case GameListItemType::SdmcDir:
454 case GameListItemType::SystemDir: 462 case GameListItemType::UserNandDir:
463 case GameListItemType::SysNandDir:
455 AddPermDirPopup(context_menu, selected); 464 AddPermDirPopup(context_menu, selected);
456 break; 465 break;
457 } 466 }
diff --git a/src/yuzu/game_list_p.h b/src/yuzu/game_list_p.h
index 047061e6c..87eb71c17 100644
--- a/src/yuzu/game_list_p.h
+++ b/src/yuzu/game_list_p.h
@@ -26,9 +26,10 @@
26enum class GameListItemType { 26enum class GameListItemType {
27 Game = QStandardItem::UserType + 1, 27 Game = QStandardItem::UserType + 1,
28 CustomDir = QStandardItem::UserType + 2, 28 CustomDir = QStandardItem::UserType + 2,
29 InstalledDir = QStandardItem::UserType + 3, 29 SdmcDir = QStandardItem::UserType + 3,
30 SystemDir = QStandardItem::UserType + 4, 30 UserNandDir = QStandardItem::UserType + 4,
31 AddDir = QStandardItem::UserType + 5 31 SysNandDir = QStandardItem::UserType + 5,
32 AddDir = QStandardItem::UserType + 6
32}; 33};
33 34
34Q_DECLARE_METATYPE(GameListItemType); 35Q_DECLARE_METATYPE(GameListItemType);
@@ -222,18 +223,28 @@ public:
222 223
223 const int icon_size = UISettings::values.icon_size; 224 const int icon_size = UISettings::values.icon_size;
224 switch (dir_type) { 225 switch (dir_type) {
225 case GameListItemType::InstalledDir: 226 case GameListItemType::SdmcDir:
226 setData( 227 setData(
227 QIcon::fromTheme(QStringLiteral("sd_card")) 228 QIcon::fromTheme(QStringLiteral("sd_card"))
228 .pixmap(icon_size) 229 .pixmap(icon_size)
229 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 230 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
230 Qt::DecorationRole); 231 Qt::DecorationRole);
231 setData(QObject::tr("Installed Titles"), Qt::DisplayRole); 232 setData(QObject::tr("Installed SD Titles"), Qt::DisplayRole);
232 break; 233 break;
233 case GameListItemType::SystemDir: 234 case GameListItemType::UserNandDir:
234 setData(QIcon::fromTheme("chip").pixmap(icon_size).scaled( 235 setData(
235 icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation), 236 QIcon::fromTheme(QStringLiteral("chip"))
236 Qt::DecorationRole); 237 .pixmap(icon_size)
238 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
239 Qt::DecorationRole);
240 setData(QObject::tr("Installed NAND Titles"), Qt::DisplayRole);
241 break;
242 case GameListItemType::SysNandDir:
243 setData(
244 QIcon::fromTheme(QStringLiteral("chip"))
245 .pixmap(icon_size)
246 .scaled(icon_size, icon_size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation),
247 Qt::DecorationRole);
237 setData(QObject::tr("System Titles"), Qt::DisplayRole); 248 setData(QObject::tr("System Titles"), Qt::DisplayRole);
238 break; 249 break;
239 case GameListItemType::CustomDir: 250 case GameListItemType::CustomDir:
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp
index e1e69bc1a..c715bcef4 100644
--- a/src/yuzu/game_list_worker.cpp
+++ b/src/yuzu/game_list_worker.cpp
@@ -240,15 +240,14 @@ void GameListWorker::AddTitlesToGameList(GameListDir* parent_dir) {
240 std::vector<std::pair<ContentProviderUnionSlot, ContentProviderEntry>> installed_games; 240 std::vector<std::pair<ContentProviderUnionSlot, ContentProviderEntry>> installed_games;
241 installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application, 241 installed_games = cache.ListEntriesFilterOrigin(std::nullopt, TitleType::Application,
242 ContentRecordType::Program); 242 ContentRecordType::Program);
243 if (parent_dir->type() == static_cast<int>(GameListItemType::InstalledDir)) { 243
244 if (parent_dir->type() == static_cast<int>(GameListItemType::SdmcDir)) {
244 installed_games = cache.ListEntriesFilterOrigin( 245 installed_games = cache.ListEntriesFilterOrigin(
245 ContentProviderUnionSlot::UserNAND, TitleType::Application, ContentRecordType::Program);
246 auto installed_sdmc_games = cache.ListEntriesFilterOrigin(
247 ContentProviderUnionSlot::SDMC, TitleType::Application, ContentRecordType::Program); 246 ContentProviderUnionSlot::SDMC, TitleType::Application, ContentRecordType::Program);
248 247 } else if (parent_dir->type() == static_cast<int>(GameListItemType::UserNandDir)) {
249 installed_games.insert(installed_games.end(), installed_sdmc_games.begin(), 248 installed_games = cache.ListEntriesFilterOrigin(
250 installed_sdmc_games.end()); 249 ContentProviderUnionSlot::UserNAND, TitleType::Application, ContentRecordType::Program);
251 } else if (parent_dir->type() == static_cast<int>(GameListItemType::SystemDir)) { 250 } else if (parent_dir->type() == static_cast<int>(GameListItemType::SysNandDir)) {
252 installed_games = cache.ListEntriesFilterOrigin( 251 installed_games = cache.ListEntriesFilterOrigin(
253 ContentProviderUnionSlot::SysNAND, TitleType::Application, ContentRecordType::Program); 252 ContentProviderUnionSlot::SysNAND, TitleType::Application, ContentRecordType::Program);
254 } 253 }
@@ -353,12 +352,16 @@ void GameListWorker::run() {
353 stop_processing = false; 352 stop_processing = false;
354 353
355 for (UISettings::GameDir& game_dir : game_dirs) { 354 for (UISettings::GameDir& game_dir : game_dirs) {
356 if (game_dir.path == "INSTALLED") { 355 if (game_dir.path == QStringLiteral("SDMC")) {
357 auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::InstalledDir); 356 auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SdmcDir);
357 emit DirEntryReady({game_list_dir});
358 AddTitlesToGameList(game_list_dir);
359 } else if (game_dir.path == QStringLiteral("UserNAND")) {
360 auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::UserNandDir);
358 emit DirEntryReady({game_list_dir}); 361 emit DirEntryReady({game_list_dir});
359 AddTitlesToGameList(game_list_dir); 362 AddTitlesToGameList(game_list_dir);
360 } else if (game_dir.path == "SYSTEM") { 363 } else if (game_dir.path == QStringLiteral("SysNAND")) {
361 auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SystemDir); 364 auto* const game_list_dir = new GameListDir(game_dir, GameListItemType::SysNandDir);
362 emit DirEntryReady({game_list_dir}); 365 emit DirEntryReady({game_list_dir});
363 AddTitlesToGameList(game_list_dir); 366 AddTitlesToGameList(game_list_dir);
364 } else { 367 } else {
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp
index 72c3eb069..6d249cb3e 100644
--- a/src/yuzu/main.cpp
+++ b/src/yuzu/main.cpp
@@ -1311,11 +1311,13 @@ void GMainWindow::OnGameListNavigateToGamedbEntry(u64 program_id,
1311 1311
1312void GMainWindow::OnGameListOpenDirectory(const QString& directory) { 1312void GMainWindow::OnGameListOpenDirectory(const QString& directory) {
1313 QString path; 1313 QString path;
1314 if (directory == QStringLiteral("INSTALLED")) { 1314 if (directory == QStringLiteral("SDMC")) {
1315 // TODO: Find a better solution when installing files to the SD card gets implemented 1315 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::SDMCDir) +
1316 "Nintendo/Contents/registered");
1317 } else if (directory == QStringLiteral("UserNAND")) {
1316 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + 1318 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
1317 "user/Contents/registered"); 1319 "user/Contents/registered");
1318 } else if (directory == QStringLiteral("SYSTEM")) { 1320 } else if (directory == QStringLiteral("SysNAND")) {
1319 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) + 1321 path = QString::fromStdString(FileUtil::GetUserPath(FileUtil::UserPath::NANDDir) +
1320 "system/Contents/registered"); 1322 "system/Contents/registered");
1321 } else { 1323 } else {