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 aa3bd5e34..bc9d33e2b 100644 --- a/src/yuzu/game_list.cpp +++ b/src/yuzu/game_list.cpp | |||
| @@ -328,18 +328,14 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide | |||
| 328 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); | 328 | tree_view->setContextMenuPolicy(Qt::CustomContextMenu); |
| 329 | tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); | 329 | tree_view->setStyleSheet(QStringLiteral("QTreeView{ border: none; }")); |
| 330 | 330 | ||
| 331 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); | 331 | item_model->insertColumns(0, COLUMN_COUNT); |
| 332 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | 332 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); |
| 333 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | 333 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); |
| 334 | 334 | ||
| 335 | if (UISettings::values.show_add_ons) { | 335 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); |
| 336 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | 336 | tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); |
| 337 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | 337 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); |
| 338 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | 338 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); |
| 339 | } else { | ||
| 340 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 341 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 342 | } | ||
| 343 | item_model->setSortRole(GameListItemPath::SortRole); | 339 | item_model->setSortRole(GameListItemPath::SortRole); |
| 344 | 340 | ||
| 345 | connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); | 341 | connect(main_window, &GMainWindow::UpdateThemedIcons, this, &GameList::OnUpdateThemedIcons); |
| @@ -347,7 +343,11 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, FileSys::ManualContentProvide | |||
| 347 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); | 343 | connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); |
| 348 | connect(tree_view, &QTreeView::expanded, this, &GameList::OnItemExpanded); | 344 | connect(tree_view, &QTreeView::expanded, this, &GameList::OnItemExpanded); |
| 349 | connect(tree_view, &QTreeView::collapsed, this, &GameList::OnItemExpanded); | 345 | connect(tree_view, &QTreeView::collapsed, this, &GameList::OnItemExpanded); |
| 350 | 346 | connect(tree_view->header(), &QHeaderView::sectionResized, this, | |
| 347 | &GameList::SaveInterfaceLayout); | ||
| 348 | connect(tree_view->header(), &QHeaderView::sectionMoved, this, &GameList::SaveInterfaceLayout); | ||
| 349 | connect(tree_view->header(), &QHeaderView::sortIndicatorChanged, this, | ||
| 350 | &GameList::SaveInterfaceLayout); | ||
| 351 | // We must register all custom types with the Qt Automoc system so that we are able to use | 351 | // We must register all custom types with the Qt Automoc system so that we are able to use |
| 352 | // it with signals/slots. In this case, QList falls under the umbrells of custom types. | 352 | // it with signals/slots. In this case, QList falls under the umbrells of custom types. |
| 353 | qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); | 353 | qRegisterMetaType<QList<QStandardItem*>>("QList<QStandardItem*>"); |
| @@ -708,22 +708,7 @@ void GameList::PopulateAsync(QVector<UISettings::GameDir>& game_dirs) { | |||
| 708 | tree_view->setEnabled(false); | 708 | tree_view->setEnabled(false); |
| 709 | 709 | ||
| 710 | // Update the columns in case UISettings has changed | 710 | // Update the columns in case UISettings has changed |
| 711 | item_model->removeColumns(0, item_model->columnCount()); | 711 | tree_view->setColumnHidden(COLUMN_ADD_ONS, !UISettings::values.show_add_ons); |
| 712 | item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1); | ||
| 713 | item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); | ||
| 714 | item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); | ||
| 715 | |||
| 716 | if (UISettings::values.show_add_ons) { | ||
| 717 | item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); | ||
| 718 | item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); | ||
| 719 | item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); | ||
| 720 | } else { | ||
| 721 | item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type")); | ||
| 722 | item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size")); | ||
| 723 | item_model->removeColumns(COLUMN_COUNT - 1, 1); | ||
| 724 | } | ||
| 725 | |||
| 726 | LoadInterfaceLayout(); | ||
| 727 | 712 | ||
| 728 | // Delete any rows that might already exist if we're repopulating | 713 | // Delete any rows that might already exist if we're repopulating |
| 729 | item_model->removeRows(0, item_model->rowCount()); | 714 | item_model->removeRows(0, item_model->rowCount()); |
| @@ -800,7 +785,7 @@ void GameList::AddFavorite(u64 program_id) { | |||
| 800 | if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() == | 785 | if (folder->child(j)->data(GameListItemPath::ProgramIdRole).toULongLong() == |
| 801 | program_id) { | 786 | program_id) { |
| 802 | QList<QStandardItem*> list; | 787 | QList<QStandardItem*> list; |
| 803 | for (int k = 0; k < item_model->columnCount(); k++) { | 788 | for (int k = 0; k < COLUMN_COUNT; k++) { |
| 804 | list.append(folder->child(j, k)->clone()); | 789 | list.append(folder->child(j, k)->clone()); |
| 805 | } | 790 | } |
| 806 | list[0]->setData(folder->child(j)->data(GameListItem::SortRole), | 791 | 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 | } |