mirror of
https://github.com/yuzu-mirror/yuzu.git
synced 2024-11-03 14:39:58 +00:00
GUI/gamelist: add "None" as an option for second row and remove dynamically duplicate row options (#3309)
* GUI/gamelist: add "None" as an option for second row and remove duplicated row options * fix clang-format warnings
This commit is contained in:
parent
51c8aea979
commit
9ac33c2620
3 changed files with 53 additions and 14 deletions
|
@ -21,10 +21,8 @@ constexpr std::array default_icon_sizes{
|
||||||
};
|
};
|
||||||
|
|
||||||
constexpr std::array row_text_names{
|
constexpr std::array row_text_names{
|
||||||
QT_TR_NOOP("Filename"),
|
QT_TR_NOOP("Filename"), QT_TR_NOOP("Filetype"), QT_TR_NOOP("Title ID"),
|
||||||
QT_TR_NOOP("Filetype"),
|
QT_TR_NOOP("Title Name"), QT_TR_NOOP("None"),
|
||||||
QT_TR_NOOP("Title ID"),
|
|
||||||
QT_TR_NOOP("Title Name"),
|
|
||||||
};
|
};
|
||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
|
@ -46,6 +44,12 @@ ConfigureGameList::ConfigureGameList(QWidget* parent)
|
||||||
&ConfigureGameList::RequestGameListUpdate);
|
&ConfigureGameList::RequestGameListUpdate);
|
||||||
connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::currentIndexChanged), this,
|
||||||
&ConfigureGameList::RequestGameListUpdate);
|
&ConfigureGameList::RequestGameListUpdate);
|
||||||
|
|
||||||
|
// Update text ComboBoxes after user interaction.
|
||||||
|
connect(ui->row_1_text_combobox, QOverload<int>::of(&QComboBox::activated),
|
||||||
|
[=]() { ConfigureGameList::UpdateSecondRowComboBox(); });
|
||||||
|
connect(ui->row_2_text_combobox, QOverload<int>::of(&QComboBox::activated),
|
||||||
|
[=]() { ConfigureGameList::UpdateFirstRowComboBox(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigureGameList::~ConfigureGameList() = default;
|
ConfigureGameList::~ConfigureGameList() = default;
|
||||||
|
@ -68,10 +72,6 @@ void ConfigureGameList::SetConfiguration() {
|
||||||
ui->show_add_ons->setChecked(UISettings::values.show_add_ons);
|
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->findData(UISettings::values.row_1_text_id));
|
|
||||||
ui->row_2_text_combobox->setCurrentIndex(
|
|
||||||
ui->row_2_text_combobox->findData(UISettings::values.row_2_text_id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGameList::changeEvent(QEvent* event) {
|
void ConfigureGameList::changeEvent(QEvent* event) {
|
||||||
|
@ -104,10 +104,43 @@ void ConfigureGameList::InitializeIconSizeComboBox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureGameList::InitializeRowComboBoxes() {
|
void ConfigureGameList::InitializeRowComboBoxes() {
|
||||||
|
UpdateFirstRowComboBox(true);
|
||||||
|
UpdateSecondRowComboBox(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureGameList::UpdateFirstRowComboBox(bool init) {
|
||||||
|
const int currentIndex =
|
||||||
|
init ? UISettings::values.row_1_text_id
|
||||||
|
: ui->row_1_text_combobox->findData(ui->row_1_text_combobox->currentData());
|
||||||
|
|
||||||
|
ui->row_1_text_combobox->clear();
|
||||||
|
|
||||||
|
for (std::size_t i = 0; i < row_text_names.size(); i++) {
|
||||||
|
const QString row_text_name = QString::fromUtf8(row_text_names[i]);
|
||||||
|
ui->row_1_text_combobox->addItem(row_text_name, QVariant::fromValue(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->row_1_text_combobox->setCurrentIndex(ui->row_1_text_combobox->findData(currentIndex));
|
||||||
|
|
||||||
|
ui->row_1_text_combobox->removeItem(4); // None
|
||||||
|
ui->row_1_text_combobox->removeItem(
|
||||||
|
ui->row_1_text_combobox->findData(ui->row_2_text_combobox->currentData()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void ConfigureGameList::UpdateSecondRowComboBox(bool init) {
|
||||||
|
const int currentIndex =
|
||||||
|
init ? UISettings::values.row_2_text_id
|
||||||
|
: ui->row_2_text_combobox->findData(ui->row_2_text_combobox->currentData());
|
||||||
|
|
||||||
|
ui->row_2_text_combobox->clear();
|
||||||
|
|
||||||
for (std::size_t i = 0; i < row_text_names.size(); ++i) {
|
for (std::size_t i = 0; i < row_text_names.size(); ++i) {
|
||||||
const QString row_text_name = QString::fromUtf8(row_text_names[i]);
|
const QString row_text_name = QString::fromUtf8(row_text_names[i]);
|
||||||
|
|
||||||
ui->row_1_text_combobox->addItem(row_text_name, QVariant::fromValue(i));
|
|
||||||
ui->row_2_text_combobox->addItem(row_text_name, QVariant::fromValue(i));
|
ui->row_2_text_combobox->addItem(row_text_name, QVariant::fromValue(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ui->row_2_text_combobox->setCurrentIndex(ui->row_2_text_combobox->findData(currentIndex));
|
||||||
|
|
||||||
|
ui->row_2_text_combobox->removeItem(
|
||||||
|
ui->row_2_text_combobox->findData(ui->row_1_text_combobox->currentData()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,8 @@ private:
|
||||||
void InitializeIconSizeComboBox();
|
void InitializeIconSizeComboBox();
|
||||||
void InitializeRowComboBoxes();
|
void InitializeRowComboBoxes();
|
||||||
|
|
||||||
|
void UpdateFirstRowComboBox(bool init = false);
|
||||||
|
void UpdateSecondRowComboBox(bool init = false);
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureGameList> ui;
|
std::unique_ptr<Ui::ConfigureGameList> ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -108,11 +108,14 @@ public:
|
||||||
}};
|
}};
|
||||||
|
|
||||||
const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
|
const auto& row1 = row_data.at(UISettings::values.row_1_text_id);
|
||||||
const auto& row2 = row_data.at(UISettings::values.row_2_text_id);
|
const int row2_id = UISettings::values.row_2_text_id;
|
||||||
|
|
||||||
if (row1.isEmpty() || row1 == row2)
|
if (row2_id == 4) // None
|
||||||
return row2;
|
return row1;
|
||||||
if (row2.isEmpty())
|
|
||||||
|
const auto& row2 = row_data.at(row2_id);
|
||||||
|
|
||||||
|
if (row1 == row2)
|
||||||
return row1;
|
return row1;
|
||||||
|
|
||||||
return QString(row1 + QStringLiteral("\n ") + row2);
|
return QString(row1 + QStringLiteral("\n ") + row2);
|
||||||
|
|
Loading…
Reference in a new issue