From ccf6d380af8e343032eb77df506dd10f46be5b2a Mon Sep 17 00:00:00 2001 From: vitor-k Date: Sun, 8 Sep 2019 19:37:55 -0300 Subject: [PATCH 1/2] Change the coding style of GameListIconSize bounds check to use the enum instead of magic numbers --- src/citra_qt/configuration/config.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 79eba88bf6..c861e7a353 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -300,11 +300,13 @@ void Config::ReadValues() { qt_config->endGroup(); qt_config->beginGroup("GameList"); - int icon_size = ReadSetting("iconSize", 2).toInt(); - if (icon_size < 0 || icon_size > 2) { - icon_size = 2; + UISettings::GameListIconSize icon_size = UISettings::GameListIconSize{ + ReadSetting("iconSize", static_cast(UISettings::GameListIconSize::LargeIcon)).toInt()}; + if (icon_size < UISettings::GameListIconSize::NoIcon || + icon_size > UISettings::GameListIconSize::LargeIcon) { + icon_size = UISettings::GameListIconSize::LargeIcon; } - UISettings::values.game_list_icon_size = UISettings::GameListIconSize{icon_size}; + UISettings::values.game_list_icon_size = icon_size; int row_1 = ReadSetting("row1", 2).toInt(); if (row_1 < 0 || row_1 > 3) { From 4d2fee31b3a5fa7aeb9e27639172399689f68719 Mon Sep 17 00:00:00 2001 From: Vitor K Date: Tue, 10 Sep 2019 00:01:55 -0300 Subject: [PATCH 2/2] Prevent repetition on config.cpp Type is already indicated on right hand side. Co-Authored-By: Mat M. --- src/citra_qt/configuration/config.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index c861e7a353..4d228cf13a 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -300,7 +300,7 @@ void Config::ReadValues() { qt_config->endGroup(); qt_config->beginGroup("GameList"); - UISettings::GameListIconSize icon_size = UISettings::GameListIconSize{ + auto icon_size = UISettings::GameListIconSize{ ReadSetting("iconSize", static_cast(UISettings::GameListIconSize::LargeIcon)).toInt()}; if (icon_size < UISettings::GameListIconSize::NoIcon || icon_size > UISettings::GameListIconSize::LargeIcon) {