yuzu-emu
/
yuzu
Archived
1
0
Fork 0

game_list: Make add-ons column optional

As the add-ons column takes the most processing time out of any (as it needs to search registration for updates/dlc, patch control NCAs, search for mods, etc.), an option was added to disable it. This does not affect the application of add-ons. In large game collections, this decreases game list refresh time by as much as 70%.
This commit is contained in:
Zach Hilman 2018-11-01 20:27:12 -04:00
parent 8f183a47dd
commit 2d2ef05d8c
6 changed files with 169 additions and 122 deletions

View File

@ -162,6 +162,7 @@ void Config::ReadValues() {
qt_config->beginGroup("UIGameList"); qt_config->beginGroup("UIGameList");
UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool(); UISettings::values.show_unknown = qt_config->value("show_unknown", true).toBool();
UISettings::values.show_add_ons = qt_config->value("show_add_ons", true).toBool();
UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt(); UISettings::values.icon_size = qt_config->value("icon_size", 64).toUInt();
UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt(); UISettings::values.row_1_text_id = qt_config->value("row_1_text_id", 3).toUInt();
UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt(); UISettings::values.row_2_text_id = qt_config->value("row_2_text_id", 2).toUInt();
@ -298,6 +299,7 @@ void Config::SaveValues() {
qt_config->beginGroup("UIGameList"); qt_config->beginGroup("UIGameList");
qt_config->setValue("show_unknown", UISettings::values.show_unknown); qt_config->setValue("show_unknown", UISettings::values.show_unknown);
qt_config->setValue("show_add_ons", UISettings::values.show_add_ons);
qt_config->setValue("icon_size", UISettings::values.icon_size); qt_config->setValue("icon_size", UISettings::values.icon_size);
qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id); qt_config->setValue("row_1_text_id", UISettings::values.row_1_text_id);
qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id); qt_config->setValue("row_2_text_id", UISettings::values.row_2_text_id);

View File

@ -42,6 +42,7 @@ ConfigureGameList::~ConfigureGameList() = default;
void ConfigureGameList::applyConfiguration() { void ConfigureGameList::applyConfiguration() {
UISettings::values.show_unknown = ui->show_unknown->isChecked(); UISettings::values.show_unknown = ui->show_unknown->isChecked();
UISettings::values.show_add_ons = ui->show_add_ons->isChecked();
UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt();
UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt();
UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt();
@ -50,6 +51,7 @@ void ConfigureGameList::applyConfiguration() {
void ConfigureGameList::setConfiguration() { void ConfigureGameList::setConfiguration() {
ui->show_unknown->setChecked(UISettings::values.show_unknown); ui->show_unknown->setChecked(UISettings::values.show_unknown);
ui->show_add_ons->setChecked(UISettings::values.show_add_ons);
ui->icon_size_combobox->setCurrentIndex( ui->icon_size_combobox->setCurrentIndex(
ui->icon_size_combobox->findData(UISettings::values.icon_size)); ui->icon_size_combobox->findData(UISettings::values.icon_size));
ui->row_1_text_combobox->setCurrentIndex( ui->row_1_text_combobox->setCurrentIndex(

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>ConfigureGameList</class> <class>ConfigureGameList</class>
<widget class="QWidget" name="ConfigureGeneral"> <widget class="QWidget" name="ConfigureGameList">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
@ -31,6 +31,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="show_add_ons">
<property name="text">
<string>Show Add-Ons Column</string>
</property>
</widget>
</item>
</layout> </layout>
</item> </item>
</layout> </layout>

View File

@ -215,12 +215,18 @@ GameList::GameList(FileSys::VirtualFilesystem vfs, GMainWindow* parent)
tree_view->setUniformRowHeights(true); tree_view->setUniformRowHeights(true);
tree_view->setContextMenuPolicy(Qt::CustomContextMenu); tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
item_model->insertColumns(0, COLUMN_COUNT); item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1);
item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name")); item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility")); item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
if (UISettings::values.show_add_ons) {
item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons")); item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons"));
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type")); item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size")); item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
} else {
item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type"));
item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size"));
}
connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry); connect(tree_view, &QTreeView::activated, this, &GameList::ValidateEntry);
connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu); connect(tree_view, &QTreeView::customContextMenuRequested, this, &GameList::PopupContextMenu);
@ -394,6 +400,25 @@ void GameList::PopulateAsync(const QString& dir_path, bool deep_scan) {
} }
tree_view->setEnabled(false); tree_view->setEnabled(false);
// Update the columns in case UISettings has changed
item_model->removeColumns(0, item_model->columnCount());
item_model->insertColumns(0, UISettings::values.show_add_ons ? COLUMN_COUNT : COLUMN_COUNT - 1);
item_model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"));
item_model->setHeaderData(COLUMN_COMPATIBILITY, Qt::Horizontal, tr("Compatibility"));
if (UISettings::values.show_add_ons) {
item_model->setHeaderData(COLUMN_ADD_ONS, Qt::Horizontal, tr("Add-ons"));
item_model->setHeaderData(COLUMN_FILE_TYPE, Qt::Horizontal, tr("File type"));
item_model->setHeaderData(COLUMN_SIZE, Qt::Horizontal, tr("Size"));
} else {
item_model->setHeaderData(COLUMN_FILE_TYPE - 1, Qt::Horizontal, tr("File type"));
item_model->setHeaderData(COLUMN_SIZE - 1, Qt::Horizontal, tr("Size"));
item_model->removeColumns(COLUMN_COUNT - 1, 1);
}
LoadInterfaceLayout();
// Delete any rows that might already exist if we're repopulating // Delete any rows that might already exist if we're repopulating
item_model->removeRows(0, item_model->rowCount()); item_model->removeRows(0, item_model->rowCount());

View File

@ -123,17 +123,22 @@ void GameListWorker::AddInstalledTitlesToGameList() {
if (it != compatibility_list.end()) if (it != compatibility_list.end())
compatibility = it->second.first; compatibility = it->second.first;
emit EntryReady({ QList<QStandardItem*> list{
new GameListItemPath( new GameListItemPath(
FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name), FormatGameName(file->GetFullPath()), icon, QString::fromStdString(name),
QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
program_id), program_id),
new GameListItemCompat(compatibility), new GameListItemCompat(compatibility),
new GameListItem(FormatPatchNameVersions(patch, *loader)),
new GameListItem( new GameListItem(
QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
new GameListItemSize(file->GetSize()), new GameListItemSize(file->GetSize()),
}); };
if (UISettings::values.show_add_ons) {
list.insert(2, new GameListItem(FormatPatchNameVersions(patch, *loader)));
}
emit EntryReady(list);
} }
const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application, const auto control_data = cache->ListEntriesFilter(FileSys::TitleType::Application,
@ -216,18 +221,23 @@ void GameListWorker::AddFstEntriesToGameList(const std::string& dir_path, unsign
if (it != compatibility_list.end()) if (it != compatibility_list.end())
compatibility = it->second.first; compatibility = it->second.first;
emit EntryReady({ QList<QStandardItem*> list{
new GameListItemPath( new GameListItemPath(
FormatGameName(physical_name), icon, QString::fromStdString(name), FormatGameName(physical_name), icon, QString::fromStdString(name),
QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())), QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType())),
program_id), program_id),
new GameListItemCompat(compatibility), new GameListItemCompat(compatibility),
new GameListItem(
FormatPatchNameVersions(patch, *loader, loader->IsRomFSUpdatable())),
new GameListItem( new GameListItem(
QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))), QString::fromStdString(Loader::GetFileTypeString(loader->GetFileType()))),
new GameListItemSize(FileUtil::GetSize(physical_name)), new GameListItemSize(FileUtil::GetSize(physical_name)),
}); };
if (UISettings::values.show_add_ons) {
list.insert(2, new GameListItem(FormatPatchNameVersions(
patch, *loader, loader->IsRomFSUpdatable())));
}
emit EntryReady(std::move(list));
} else if (is_dir && recursion > 0) { } else if (is_dir && recursion > 0) {
watch_list.append(QString::fromStdString(physical_name)); watch_list.append(QString::fromStdString(physical_name));
AddFstEntriesToGameList(physical_name, recursion - 1); AddFstEntriesToGameList(physical_name, recursion - 1);

View File

@ -59,6 +59,7 @@ struct Values {
// Game List // Game List
bool show_unknown; bool show_unknown;
bool show_add_ons;
uint32_t icon_size; uint32_t icon_size;
uint8_t row_1_text_id; uint8_t row_1_text_id;
uint8_t row_2_text_id; uint8_t row_2_text_id;