diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/configuration/configure_gamelist.cpp | 51 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_gamelist.h | 4 |
2 files changed, 32 insertions, 23 deletions
diff --git a/src/yuzu/configuration/configure_gamelist.cpp b/src/yuzu/configuration/configure_gamelist.cpp index 1ae3423cf..1238356a8 100644 --- a/src/yuzu/configuration/configure_gamelist.cpp +++ b/src/yuzu/configuration/configure_gamelist.cpp | |||
| @@ -12,6 +12,33 @@ ConfigureGameList::ConfigureGameList(QWidget* parent) | |||
| 12 | : QWidget(parent), ui(new Ui::ConfigureGameList) { | 12 | : QWidget(parent), ui(new Ui::ConfigureGameList) { |
| 13 | ui->setupUi(this); | 13 | ui->setupUi(this); |
| 14 | 14 | ||
| 15 | InitializeIconSizeComboBox(); | ||
| 16 | InitializeRowComboBoxes(); | ||
| 17 | |||
| 18 | this->setConfiguration(); | ||
| 19 | } | ||
| 20 | |||
| 21 | ConfigureGameList::~ConfigureGameList() = default; | ||
| 22 | |||
| 23 | void ConfigureGameList::applyConfiguration() { | ||
| 24 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); | ||
| 25 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | ||
| 26 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); | ||
| 27 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); | ||
| 28 | Settings::Apply(); | ||
| 29 | } | ||
| 30 | |||
| 31 | void ConfigureGameList::setConfiguration() { | ||
| 32 | ui->show_unknown->setChecked(UISettings::values.show_unknown); | ||
| 33 | ui->icon_size_combobox->setCurrentIndex( | ||
| 34 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | ||
| 35 | ui->row_1_text_combobox->setCurrentIndex( | ||
| 36 | ui->row_1_text_combobox->findData(UISettings::values.row_1_text_id)); | ||
| 37 | ui->row_2_text_combobox->setCurrentIndex( | ||
| 38 | ui->row_2_text_combobox->findData(UISettings::values.row_2_text_id)); | ||
| 39 | } | ||
| 40 | |||
| 41 | void ConfigureGameList::InitializeIconSizeComboBox() { | ||
| 15 | static const std::vector<std::pair<u32, std::string>> default_icon_sizes{ | 42 | static const std::vector<std::pair<u32, std::string>> default_icon_sizes{ |
| 16 | std::make_pair(0, "None"), std::make_pair(32, "Small"), | 43 | std::make_pair(0, "None"), std::make_pair(32, "Small"), |
| 17 | std::make_pair(64, "Standard"), std::make_pair(128, "Large"), | 44 | std::make_pair(64, "Standard"), std::make_pair(128, "Large"), |
| @@ -24,7 +51,9 @@ ConfigureGameList::ConfigureGameList(QWidget* parent) | |||
| 24 | std::to_string(size.first) + ")"), | 51 | std::to_string(size.first) + ")"), |
| 25 | size.first); | 52 | size.first); |
| 26 | } | 53 | } |
| 54 | } | ||
| 27 | 55 | ||
| 56 | void ConfigureGameList::InitializeRowComboBoxes() { | ||
| 28 | static const std::vector<std::string> row_text_names{ | 57 | static const std::vector<std::string> row_text_names{ |
| 29 | "Filename", | 58 | "Filename", |
| 30 | "Filetype", | 59 | "Filetype", |
| @@ -38,26 +67,4 @@ ConfigureGameList::ConfigureGameList(QWidget* parent) | |||
| 38 | ui->row_2_text_combobox->addItem(QString::fromStdString(row_text_names[i]), | 67 | ui->row_2_text_combobox->addItem(QString::fromStdString(row_text_names[i]), |
| 39 | QVariant::fromValue(i)); | 68 | QVariant::fromValue(i)); |
| 40 | } | 69 | } |
| 41 | |||
| 42 | this->setConfiguration(); | ||
| 43 | } | ||
| 44 | |||
| 45 | ConfigureGameList::~ConfigureGameList() {} | ||
| 46 | |||
| 47 | void ConfigureGameList::setConfiguration() { | ||
| 48 | ui->show_unknown->setChecked(UISettings::values.show_unknown); | ||
| 49 | ui->icon_size_combobox->setCurrentIndex( | ||
| 50 | ui->icon_size_combobox->findData(UISettings::values.icon_size)); | ||
| 51 | ui->row_1_text_combobox->setCurrentIndex( | ||
| 52 | ui->row_1_text_combobox->findData(UISettings::values.row_1_text_id)); | ||
| 53 | ui->row_2_text_combobox->setCurrentIndex( | ||
| 54 | ui->row_2_text_combobox->findData(UISettings::values.row_2_text_id)); | ||
| 55 | } | ||
| 56 | |||
| 57 | void ConfigureGameList::applyConfiguration() { | ||
| 58 | UISettings::values.show_unknown = ui->show_unknown->isChecked(); | ||
| 59 | UISettings::values.icon_size = ui->icon_size_combobox->currentData().toUInt(); | ||
| 60 | UISettings::values.row_1_text_id = ui->row_1_text_combobox->currentData().toUInt(); | ||
| 61 | UISettings::values.row_2_text_id = ui->row_2_text_combobox->currentData().toUInt(); | ||
| 62 | Settings::Apply(); | ||
| 63 | } | 70 | } |
diff --git a/src/yuzu/configuration/configure_gamelist.h b/src/yuzu/configuration/configure_gamelist.h index 94fba6373..71fd67e99 100644 --- a/src/yuzu/configuration/configure_gamelist.h +++ b/src/yuzu/configuration/configure_gamelist.h | |||
| @@ -23,6 +23,8 @@ public: | |||
| 23 | private: | 23 | private: |
| 24 | void setConfiguration(); | 24 | void setConfiguration(); |
| 25 | 25 | ||
| 26 | private: | 26 | void InitializeIconSizeComboBox(); |
| 27 | void InitializeRowComboBoxes(); | ||
| 28 | |||
| 27 | std::unique_ptr<Ui::ConfigureGameList> ui; | 29 | std::unique_ptr<Ui::ConfigureGameList> ui; |
| 28 | }; | 30 | }; |