From 82fea8671746e0b6e33d31792e50571f4039398d Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Tue, 20 Aug 2019 19:57:33 +0800 Subject: [PATCH 1/4] citra_qt/game_list: Add an All Regions check Some titles (mostly homebrews) do not use the region free value 0x7FFF but instead set all of the region flags, resulting in all regions displayed in game list, which is not beautiful and not what we want. This fixes it by adding an all_regions check. --- src/citra_qt/game_list_p.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index 5891a4487..9a3fef612 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -4,6 +4,7 @@ #pragma once +#include #include #include #include @@ -95,6 +96,14 @@ static QString GetRegionFromSMDH(const Loader::SMDH& smdh) { return QObject::tr("Region free"); } + const bool all_regions = + std::all_of(regions_map.begin(), regions_map.end(), [®ions](const auto& it) { + return std::find(regions.begin(), regions.end(), it.first) != regions.end(); + }); + if (all_regions) { + return QObject::tr("All regions"); + } + QString result = QObject::tr(regions_map.at(regions.front())); for (auto region = ++regions.begin(); region != regions.end(); ++region) { result += QStringLiteral("\n") + QObject::tr(regions_map.at(*region)); From b078122167186e4cd816519d10b38298cfd1b100 Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Tue, 20 Aug 2019 20:01:14 +0800 Subject: [PATCH 2/4] citra_qt/game_list: Disable uniform row heights This option was intended for enabling optimizations when all rows are granted to have the same height. In our case this is not true, and therefore the behavior is actually undefined. Different versions of Qt handle this differently. Newer versions of Qt tend to hide contents that are too big in height, which goes against our wishes. Thus, it's probably the best to disable this option so that things don't go wrong if we ever decide to update Qt. --- src/citra_qt/game_list.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/citra_qt/game_list.cpp b/src/citra_qt/game_list.cpp index 6ca267dec..0f0325ca2 100644 --- a/src/citra_qt/game_list.cpp +++ b/src/citra_qt/game_list.cpp @@ -285,7 +285,6 @@ GameList::GameList(GMainWindow* parent) : QWidget{parent} { tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel); tree_view->setSortingEnabled(true); tree_view->setEditTriggers(QHeaderView::NoEditTriggers); - tree_view->setUniformRowHeights(true); tree_view->setContextMenuPolicy(Qt::CustomContextMenu); tree_view->setStyleSheet("QTreeView{ border: none; }"); From 4144f4480d8326a47c3b5d4e43761e62caf4760c Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Tue, 20 Aug 2019 20:03:15 +0800 Subject: [PATCH 3/4] citra_qt: Add single line mode for game list This single line mode is aimed at restoring the intended behavior with Small or None icons. Line breaks will be replaced with commas (Region row) or spaces (Name row). One can toggle this option in UI configuration. --- src/citra_qt/configuration/config.cpp | 2 ++ src/citra_qt/configuration/configure_ui.cpp | 2 ++ src/citra_qt/configuration/configure_ui.ui | 7 +++++++ src/citra_qt/game_list_p.h | 11 +++++++++-- src/citra_qt/uisettings.h | 1 + 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 79eba88bf..ddcb71e3d 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -319,6 +319,7 @@ void Config::ReadValues() { UISettings::values.game_list_row_2 = UISettings::GameListText{row_2}; UISettings::values.game_list_hide_no_icon = ReadSetting("hideNoIcon", false).toBool(); + UISettings::values.game_list_single_line_mode = ReadSetting("singleLineMode", false).toBool(); qt_config->endGroup(); qt_config->beginGroup("Paths"); @@ -589,6 +590,7 @@ void Config::SaveValues() { WriteSetting("row1", static_cast(UISettings::values.game_list_row_1), 2); WriteSetting("row2", static_cast(UISettings::values.game_list_row_2), 0); WriteSetting("hideNoIcon", UISettings::values.game_list_hide_no_icon, false); + WriteSetting("singleLineMode", UISettings::values.game_list_single_line_mode, false); qt_config->endGroup(); qt_config->beginGroup("Paths"); diff --git a/src/citra_qt/configuration/configure_ui.cpp b/src/citra_qt/configuration/configure_ui.cpp index 006b93e8c..88f0d0893 100644 --- a/src/citra_qt/configuration/configure_ui.cpp +++ b/src/citra_qt/configuration/configure_ui.cpp @@ -47,6 +47,7 @@ void ConfigureUi::SetConfiguration() { ui->row_2_text_combobox->setCurrentIndex(static_cast(UISettings::values.game_list_row_2) + 1); ui->toggle_hide_no_icon->setChecked(UISettings::values.game_list_hide_no_icon); + ui->toggle_single_line_mode->setChecked(UISettings::values.game_list_single_line_mode); } void ConfigureUi::ApplyConfiguration() { @@ -59,6 +60,7 @@ void ConfigureUi::ApplyConfiguration() { UISettings::values.game_list_row_2 = static_cast(ui->row_2_text_combobox->currentIndex() - 1); UISettings::values.game_list_hide_no_icon = ui->toggle_hide_no_icon->isChecked(); + UISettings::values.game_list_single_line_mode = ui->toggle_single_line_mode->isChecked(); } void ConfigureUi::OnLanguageChanged(int index) { diff --git a/src/citra_qt/configuration/configure_ui.ui b/src/citra_qt/configuration/configure_ui.ui index 5b7d054af..4af177f3e 100644 --- a/src/citra_qt/configuration/configure_ui.ui +++ b/src/citra_qt/configuration/configure_ui.ui @@ -185,6 +185,13 @@ + + + + Single Line Mode + + + diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index 9a3fef612..8a0a57fca 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -104,9 +104,11 @@ static QString GetRegionFromSMDH(const Loader::SMDH& smdh) { return QObject::tr("All regions"); } + const QString separator = + UISettings::values.game_list_single_line_mode ? QStringLiteral(", ") : QStringLiteral("\n"); QString result = QObject::tr(regions_map.at(regions.front())); for (auto region = ++regions.begin(); region != regions.end(); ++region) { - result += QStringLiteral("\n") + QObject::tr(regions_map.at(*region)); + result += separator + QObject::tr(regions_map.at(*region)); } return result; } @@ -200,7 +202,12 @@ public: QString row2; auto row_2_id = UISettings::values.game_list_row_2; if (row_2_id != UISettings::GameListText::NoText) { - row2 = (row1.isEmpty() ? "" : "\n ") + display_texts.at(row_2_id); + if (!row1.isEmpty()) { + row2 = UISettings::values.game_list_single_line_mode + ? QStringLiteral(" ") + : QStringLiteral("\n "); + } + row2 += display_texts.at(row_2_id); } return QString(row1 + row2); } else { diff --git a/src/citra_qt/uisettings.h b/src/citra_qt/uisettings.h index 80cab3689..573b4d975 100644 --- a/src/citra_qt/uisettings.h +++ b/src/citra_qt/uisettings.h @@ -85,6 +85,7 @@ struct Values { GameListText game_list_row_1; GameListText game_list_row_2; bool game_list_hide_no_icon; + bool game_list_single_line_mode; u16 screenshot_resolution_factor; From 531bf857f5a587e1850b0e689075c4e228dd659d Mon Sep 17 00:00:00 2001 From: zhupengfei Date: Tue, 20 Aug 2019 21:03:41 +0800 Subject: [PATCH 4/4] Remove old region free logic --- src/citra_qt/game_list_p.h | 10 +++------- src/core/loader/smdh.cpp | 4 ---- src/core/loader/smdh.h | 1 - 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/citra_qt/game_list_p.h b/src/citra_qt/game_list_p.h index 8a0a57fca..c03c073b3 100644 --- a/src/citra_qt/game_list_p.h +++ b/src/citra_qt/game_list_p.h @@ -92,16 +92,12 @@ static QString GetRegionFromSMDH(const Loader::SMDH& smdh) { return QObject::tr("Invalid region"); } - if (std::find(regions.begin(), regions.end(), GameRegion::RegionFree) != regions.end()) { - return QObject::tr("Region free"); - } - - const bool all_regions = + const bool region_free = std::all_of(regions_map.begin(), regions_map.end(), [®ions](const auto& it) { return std::find(regions.begin(), regions.end(), it.first) != regions.end(); }); - if (all_regions) { - return QObject::tr("All regions"); + if (region_free) { + return QObject::tr("Region free"); } const QString separator = diff --git a/src/core/loader/smdh.cpp b/src/core/loader/smdh.cpp index 417f8d074..1b9503d1d 100644 --- a/src/core/loader/smdh.cpp +++ b/src/core/loader/smdh.cpp @@ -49,10 +49,6 @@ std::array SMDH::GetShortTitle(Loader::SMDH::TitleLanguage language) } std::vector SMDH::GetRegions() const { - if (region_lockout == 0x7fffffff) { - return std::vector{GameRegion::RegionFree}; - } - constexpr u32 REGION_COUNT = 7; std::vector result; for (u32 region = 0; region < REGION_COUNT; ++region) { diff --git a/src/core/loader/smdh.h b/src/core/loader/smdh.h index adeea05a9..2156dec9c 100644 --- a/src/core/loader/smdh.h +++ b/src/core/loader/smdh.h @@ -70,7 +70,6 @@ struct SMDH { China = 4, Korea = 5, Taiwan = 6, - RegionFree = 7, }; /**