mirror of
https://github.com/citra-mirror/citra.git
synced 2024-08-20 02:13:23 +02:00
Merge pull request #4896 from zhaowenlan1779/game-list-fix-3
citra_qt: Misc game list updates/fixes
This commit is contained in:
commit
d6f2bc8c04
@ -319,6 +319,7 @@ void Config::ReadValues() {
|
|||||||
UISettings::values.game_list_row_2 = UISettings::GameListText{row_2};
|
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_hide_no_icon = ReadSetting("hideNoIcon", false).toBool();
|
||||||
|
UISettings::values.game_list_single_line_mode = ReadSetting("singleLineMode", false).toBool();
|
||||||
qt_config->endGroup();
|
qt_config->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("Paths");
|
qt_config->beginGroup("Paths");
|
||||||
@ -589,6 +590,7 @@ void Config::SaveValues() {
|
|||||||
WriteSetting("row1", static_cast<int>(UISettings::values.game_list_row_1), 2);
|
WriteSetting("row1", static_cast<int>(UISettings::values.game_list_row_1), 2);
|
||||||
WriteSetting("row2", static_cast<int>(UISettings::values.game_list_row_2), 0);
|
WriteSetting("row2", static_cast<int>(UISettings::values.game_list_row_2), 0);
|
||||||
WriteSetting("hideNoIcon", UISettings::values.game_list_hide_no_icon, false);
|
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->endGroup();
|
||||||
|
|
||||||
qt_config->beginGroup("Paths");
|
qt_config->beginGroup("Paths");
|
||||||
|
@ -47,6 +47,7 @@ void ConfigureUi::SetConfiguration() {
|
|||||||
ui->row_2_text_combobox->setCurrentIndex(static_cast<int>(UISettings::values.game_list_row_2) +
|
ui->row_2_text_combobox->setCurrentIndex(static_cast<int>(UISettings::values.game_list_row_2) +
|
||||||
1);
|
1);
|
||||||
ui->toggle_hide_no_icon->setChecked(UISettings::values.game_list_hide_no_icon);
|
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() {
|
void ConfigureUi::ApplyConfiguration() {
|
||||||
@ -59,6 +60,7 @@ void ConfigureUi::ApplyConfiguration() {
|
|||||||
UISettings::values.game_list_row_2 =
|
UISettings::values.game_list_row_2 =
|
||||||
static_cast<UISettings::GameListText>(ui->row_2_text_combobox->currentIndex() - 1);
|
static_cast<UISettings::GameListText>(ui->row_2_text_combobox->currentIndex() - 1);
|
||||||
UISettings::values.game_list_hide_no_icon = ui->toggle_hide_no_icon->isChecked();
|
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) {
|
void ConfigureUi::OnLanguageChanged(int index) {
|
||||||
|
@ -185,6 +185,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="toggle_single_line_mode">
|
||||||
|
<property name="text">
|
||||||
|
<string>Single Line Mode</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
@ -285,7 +285,6 @@ GameList::GameList(GMainWindow* parent) : QWidget{parent} {
|
|||||||
tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel);
|
tree_view->setHorizontalScrollMode(QHeaderView::ScrollPerPixel);
|
||||||
tree_view->setSortingEnabled(true);
|
tree_view->setSortingEnabled(true);
|
||||||
tree_view->setEditTriggers(QHeaderView::NoEditTriggers);
|
tree_view->setEditTriggers(QHeaderView::NoEditTriggers);
|
||||||
tree_view->setUniformRowHeights(true);
|
|
||||||
tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
|
tree_view->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||||
tree_view->setStyleSheet("QTreeView{ border: none; }");
|
tree_view->setStyleSheet("QTreeView{ border: none; }");
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@ -91,13 +92,19 @@ static QString GetRegionFromSMDH(const Loader::SMDH& smdh) {
|
|||||||
return QObject::tr("Invalid region");
|
return QObject::tr("Invalid region");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::find(regions.begin(), regions.end(), GameRegion::RegionFree) != regions.end()) {
|
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 (region_free) {
|
||||||
return QObject::tr("Region free");
|
return QObject::tr("Region free");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString separator =
|
||||||
|
UISettings::values.game_list_single_line_mode ? QStringLiteral(", ") : QStringLiteral("\n");
|
||||||
QString result = QObject::tr(regions_map.at(regions.front()));
|
QString result = QObject::tr(regions_map.at(regions.front()));
|
||||||
for (auto region = ++regions.begin(); region != regions.end(); ++region) {
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
@ -191,7 +198,12 @@ public:
|
|||||||
QString row2;
|
QString row2;
|
||||||
auto row_2_id = UISettings::values.game_list_row_2;
|
auto row_2_id = UISettings::values.game_list_row_2;
|
||||||
if (row_2_id != UISettings::GameListText::NoText) {
|
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);
|
return QString(row1 + row2);
|
||||||
} else {
|
} else {
|
||||||
|
@ -85,6 +85,7 @@ struct Values {
|
|||||||
GameListText game_list_row_1;
|
GameListText game_list_row_1;
|
||||||
GameListText game_list_row_2;
|
GameListText game_list_row_2;
|
||||||
bool game_list_hide_no_icon;
|
bool game_list_hide_no_icon;
|
||||||
|
bool game_list_single_line_mode;
|
||||||
|
|
||||||
u16 screenshot_resolution_factor;
|
u16 screenshot_resolution_factor;
|
||||||
|
|
||||||
|
@ -49,10 +49,6 @@ std::array<u16, 0x40> SMDH::GetShortTitle(Loader::SMDH::TitleLanguage language)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::vector<SMDH::GameRegion> SMDH::GetRegions() const {
|
std::vector<SMDH::GameRegion> SMDH::GetRegions() const {
|
||||||
if (region_lockout == 0x7fffffff) {
|
|
||||||
return std::vector<GameRegion>{GameRegion::RegionFree};
|
|
||||||
}
|
|
||||||
|
|
||||||
constexpr u32 REGION_COUNT = 7;
|
constexpr u32 REGION_COUNT = 7;
|
||||||
std::vector<GameRegion> result;
|
std::vector<GameRegion> result;
|
||||||
for (u32 region = 0; region < REGION_COUNT; ++region) {
|
for (u32 region = 0; region < REGION_COUNT; ++region) {
|
||||||
|
@ -70,7 +70,6 @@ struct SMDH {
|
|||||||
China = 4,
|
China = 4,
|
||||||
Korea = 5,
|
Korea = 5,
|
||||||
Taiwan = 6,
|
Taiwan = 6,
|
||||||
RegionFree = 7,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user