diff options
| -rw-r--r-- | src/yuzu/game_list.cpp | 39 | ||||
| -rw-r--r-- | src/yuzu/game_list_worker.cpp | 12 |
2 files changed, 17 insertions, 34 deletions
diff --git a/src/yuzu/game_list.cpp b/src/yuzu/game_list.cpp index 25bb066c9..c2e84ef79 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -326,18 +326,14 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide | |||
| 326 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); | 326 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); |
| 327 | tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); | 327 | tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); |
| 328 | 328 | ||
| 329 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); | 329 | item_model->insertColumns(0, COLUMN_COUNT); |
| 330 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | 330 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); |
| 331 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | 331 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); |
| 332 | 332 | ||
| 333 | if (UISettings::values.show_add_ons) { | 333 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); |
| 334 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | 334 | tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); |
| 335 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | 335 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); |
| 336 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | 336 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); |
| 337 | } else { | ||
| 338 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 339 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 340 | } | ||
| 341 | item_model->setSortRole(GameListItemPath::SortRole); | 337 | item_model->setSortRole(GameListItemPath::SortRole); |
| 342 | 338 | ||
| 343 | connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); | 339 | connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); |
| @@ -345,7 +341,11 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide | |||
| 345 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); | 341 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); |
| 346 | connect(tree_view, &QTreeView::expanded, this, &GameList::OnItemExpanded); | 342 | connect(tree_view, &QTreeView::expanded, this, &GameList::OnItemExpanded); |
| 347 | connect(tree_view, &QTreeView::collapsed, this, &GameList::OnItemExpanded); | 343 | connect(tree_view, &QTreeView::collapsed, this, &GameList::OnItemExpanded); |
| 348 | 344 | connect(tree_view->header(), &QHeaderView::sectionResized, this, | |
| 345 | &GameList::SaveInterfaceLayout); | ||
| 346 | connect(tree_view->header(), &QHeaderView::sectionMoved, this, &GameList::SaveInterfaceLayout); | ||
| 347 | connect(tree_view->header(), &QHeaderView::sortIndicatorChanged, this, | ||
| 348 | &GameList::SaveInterfaceLayout); | ||
| 349 | // We must register all custom types with the Qt Automoc system so that we are able to use | 349 | // We must register all custom types with the Qt Automoc system so that we are able to use |
| 350 | // it with signals/slots. In this case, QList falls under the umbrells of custom types. | 350 | // it with signals/slots. In this case, QList falls under the umbrells of custom types. |
| 351 | qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); | 351 | qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); |
| @@ -705,22 +705,7 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) { | |||
| 705 | tree_view->setEnabled(false); | 705 | tree_view->setEnabled(false); |
| 706 | 706 | ||
| 707 | // Update the columns in case UISettings has changed | 707 | // Update the columns in case UISettings has changed |
| 708 | item_model->removeColumns(0, item_model->columnCount()); | 708 | tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); |
| 709 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); | ||
| 710 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | ||
| 711 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | ||
| 712 | |||
| 713 | if (UISettings::values.show_add_ons) { | ||
| 714 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | ||
| 715 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 716 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 717 | } else { | ||
| 718 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 719 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 720 | item_model->removeColumns(COLUMN_COUNT - 1, 1); | ||
| 721 | } | ||
| 722 | |||
| 723 | LoadInterfaceLayout(); | ||
| 724 | 709 | ||
| 725 | // Delete any rows that might already exist if we're repopulating | 710 | // Delete any rows that might already exist if we're repopulating |
| 726 | item_model->removeRows(0, item_model->rowCount()); | 711 | item_model->removeRows(0, item_model->rowCount()); |
| @@ -797,7 +782,7 @@ void GameList::AddFavorite(u64 program_id) { | |||
| 797 | if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() == | 782 | if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() == |
| 798 | program_id) { | 783 | program_id) { |
| 799 | QList<QStandardItem*> list; | 784 | QList<QStandardItem*> list; |
| 800 | for (int k = 0; k < item_model->columnCount(); k++) { | 785 | for (int k = 0; k < COLUMN_COUNT; k++) { |
| 801 | list.append(folder->child(j, k)->clone()); | 786 | list.append(folder->child(j, k)->clone()); |
| 802 | } | 787 | } |
| 803 | list[0]->setData(folder->child(j)->data(GameListItem::SortRole), | 788 | list[0]->setData(folder->child(j)->data(GameListItem::SortRole), |
diff --git a/src/yuzu/game_list_worker.cpp b/src/yuzu/game_list_worker.cpp index 485045334..33cc90d5a 100644 --- a/src/yuzu/game_list_worker.cpp +++ b/src/yuzu/game_list_worker.cpp | |||
| @@ -215,13 +215,11 @@ QList<QStandardItem*> MakeGameListEntry(const std::string& path, const std::stri | |||
| 215 | new GameListItemSize(Common::FS::GetSize(path)), | 215 | new GameListItemSize(Common::FS::GetSize(path)), |
| 216 | }; | 216 | }; |
| 217 | 217 | ||
| 218 | if (UISettings::values.show_add_ons) { | 218 | const auto patch_versions = GetGameListCachedObject( |
| 219 | const auto patch_versions = GetGameListCachedObject( | 219 | fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] { |
| 220 | fmt::format("{:016X}", patch.GetTitleID()), "pv.txt", [&patch, &loader] { | 220 | return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable()); |
| 221 | return FormatPatchNameVersions(patch, loader, loader.IsRomFSUpdatable()); | 221 | }); |
| 222 | }); | 222 | list.insert(2, new GameListItem(patch_versions)); |
| 223 | list.insert(2, new GameListItem(patch_versions)); | ||
| 224 | } | ||
| 225 | 223 | ||
| 226 | return list; | 224 | return list; |
| 227 | } | 225 | } |