diff options
Diffstat (limited to '')
| -rw-r--r-- | src/yuzu/configuration/configure_gamelist.cpp | 65 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_gamelist.h | 3 |
2 files changed, 47 insertions, 21 deletions
diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp index 20090ed29..0be030434 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_gamelist.cpp | |||
| @@ -11,6 +11,23 @@ | |||
| 11 | #include "yuzu/configuration/configure_gamelist.h" | 11 | #include "yuzu/configuration/configure_gamelist.h" |
| 12 | #include "yuzu/ui_settings.h" | 12 | #include "yuzu/ui_settings.h" |
| 13 | 13 | ||
| 14 | namespace { | ||
| 15 | constexpr std::array<std::pair<u32, const char*>, 5> default_icon_sizes{{ | ||
| 16 | std::make_pair(0, QT_TR_NOOP("None")), | ||
| 17 | std::make_pair(32, QT_TR_NOOP("Small (32x32)")), | ||
| 18 | std::make_pair(64, QT_TR_NOOP("Standard (64x64)")), | ||
| 19 | std::make_pair(128, QT_TR_NOOP("Large (128x128)")), | ||
| 20 | std::make_pair(256, QT_TR_NOOP("Full Size (256x256)")), | ||
| 21 | }}; | ||
| 22 | |||
| 23 | constexpr std::array<const char*, 4> row_text_names{{ | ||
| 24 | QT_TR_NOOP("Filename"), | ||
| 25 | QT_TR_NOOP("Filetype"), | ||
| 26 | QT_TR_NOOP("Title ID"), | ||
| 27 | QT_TR_NOOP("Title Name"), | ||
| 28 | }}; | ||
| 29 | } // Anonymous namespace | ||
| 30 | |||
| 14 | ConfigureGameList::ConfigureGameList(QWidget* parent) | 31 | ConfigureGameList::ConfigureGameList(QWidget* parent) |
| 15 | : QWidget(parent), ui(new Ui::ConfigureGameList) { | 32 | : QWidget(parent), ui(new Ui::ConfigureGameList) { |
| 16 | ui->setupUi(this); | 33 | ui->setupUi(this); |
| @@ -41,33 +58,39 @@ void ConfigureGameList::setConfiguration() { | |||
| 41 | ui->row_2_text_combobox->findData(UISettings::values.row_2_text_id)); | 58 | ui->row_2_text_combobox->findData(UISettings::values.row_2_text_id)); |
| 42 | } | 59 | } |
| 43 | 60 | ||
| 44 | void ConfigureGameList::InitializeIconSizeComboBox() { | 61 | void ConfigureGameList::changeEvent(QEvent* event) { |
| 45 | static const std::array<std::pair<u32, std::string>, 5> default_icon_sizes{{ | 62 | if (event->type() == QEvent::LanguageChange) { |
| 46 | std::make_pair(0, "None"), std::make_pair(32, "Small"), | 63 | RetranslateUI(); |
| 47 | std::make_pair(64, "Standard"), std::make_pair(128, "Large"), | 64 | return; |
| 48 | std::make_pair(256, "Full Size"), | 65 | } |
| 49 | }}; | ||
| 50 | 66 | ||
| 67 | QWidget::changeEvent(event); | ||
| 68 | } | ||
| 69 | |||
| 70 | void ConfigureGameList::RetranslateUI() { | ||
| 71 | ui->retranslateUi(this); | ||
| 72 | |||
| 73 | for (int i = 0; i < ui->icon_size_combobox->count(); i++) { | ||
| 74 | ui->icon_size_combobox->setItemText(i, tr(default_icon_sizes[i].second)); | ||
| 75 | } | ||
| 76 | |||
| 77 | for (int i = 0; i < ui->row_1_text_combobox->count(); i++) { | ||
| 78 | const QString name = tr(row_text_names[i]); | ||
| 79 | |||
| 80 | ui->row_1_text_combobox->setItemText(i, name); | ||
| 81 | ui->row_2_text_combobox->setItemText(i, name); | ||
| 82 | } | ||
| 83 | } | ||
| 84 | |||
| 85 | void ConfigureGameList::InitializeIconSizeComboBox() { | ||
| 51 | for (const auto& size : default_icon_sizes) { | 86 | for (const auto& size : default_icon_sizes) { |
| 52 | ui->icon_size_combobox->addItem(QString::fromStdString(size.second + " (" + | 87 | ui->icon_size_combobox->addItem(size.second, size.first); |
| 53 | std::to_string(size.first) + "x" + | ||
| 54 | std::to_string(size.first) + ")"), | ||
| 55 | size.first); | ||
| 56 | } | 88 | } |
| 57 | } | 89 | } |
| 58 | 90 | ||
| 59 | void ConfigureGameList::InitializeRowComboBoxes() { | 91 | void ConfigureGameList::InitializeRowComboBoxes() { |
| 60 | static const std::array<std::string, 4> row_text_names{{ | ||
| 61 | "Filename", | ||
| 62 | "Filetype", | ||
| 63 | "Title ID", | ||
| 64 | "Title Name", | ||
| 65 | }}; | ||
| 66 | |||
| 67 | for (size_t i = 0; i < row_text_names.size(); ++i) { | 92 | for (size_t i = 0; i < row_text_names.size(); ++i) { |
| 68 | ui->row_1_text_combobox->addItem(QString::fromStdString(row_text_names[i]), | 93 | ui->row_1_text_combobox->addItem(row_text_names[i], QVariant::fromValue(i)); |
| 69 | QVariant::fromValue(i)); | 94 | ui->row_2_text_combobox->addItem(row_text_names[i], QVariant::fromValue(i)); |
| 70 | ui->row_2_text_combobox->addItem(QString::fromStdString(row_text_names[i]), | ||
| 71 | QVariant::fromValue(i)); | ||
| 72 | } | 95 | } |
| 73 | } | 96 | } |
diff --git a/src/yuzu/configuration/configure_gamelist.h b/src/yuzu/configuration/configure_gamelist.h index 71fd67e99..ff7406c60 100644 --- a/src/yuzu/configuration/configure_gamelist.h +++ b/src/yuzu/configuration/configure_gamelist.h | |||
| @@ -23,6 +23,9 @@ public: | |||
| 23 | private: | 23 | private: |
| 24 | void setConfiguration(); | 24 | void setConfiguration(); |
| 25 | 25 | ||
| 26 | void changeEvent(QEvent*) override; | ||
| 27 | void RetranslateUI(); | ||
| 28 | |||
| 26 | void InitializeIconSizeComboBox(); | 29 | void InitializeIconSizeComboBox(); |
| 27 | void InitializeRowComboBoxes(); | 30 | void InitializeRowComboBoxes(); |
| 28 | 31 | ||