UISettings::GameListText
Append a value to the enum to function as length counter. Also remove magic numbers where possible, by using the enum instead.
This commit is contained in:
parent
1f1ac98f10
commit
719912786a
2 changed files with 11 additions and 10 deletions
|
@ -306,17 +306,19 @@ void Config::ReadValues() {
|
||||||
}
|
}
|
||||||
UISettings::values.game_list_icon_size = UISettings::GameListIconSize{icon_size};
|
UISettings::values.game_list_icon_size = UISettings::GameListIconSize{icon_size};
|
||||||
|
|
||||||
int row_1 = ReadSetting("row1", 2).toInt();
|
UISettings::GameListText row_1 = UISettings::GameListText{
|
||||||
if (row_1 < 0 || row_1 >= UISettings::GAME_LIST_TEXT_LENGTH) {
|
ReadSetting("row1", static_cast<int>(UISettings::GameListText::TitleName)).toInt()};
|
||||||
row_1 = 2;
|
if (row_1 <= UISettings::GameListText::NoText || row_1 >= UISettings::GameListText::ListEnd) {
|
||||||
|
row_1 = UISettings::GameListText::TitleName;
|
||||||
}
|
}
|
||||||
UISettings::values.game_list_row_1 = UISettings::GameListText{row_1};
|
UISettings::values.game_list_row_1 = row_1;
|
||||||
|
|
||||||
int row_2 = ReadSetting("row2", 0).toInt();
|
UISettings::GameListText row_2 = UISettings::GameListText{
|
||||||
if (row_2 < -1 || row_2 >= UISettings::GAME_LIST_TEXT_LENGTH) {
|
ReadSetting("row2", static_cast<int>(UISettings::GameListText::FileName)).toInt()};
|
||||||
row_2 = 0;
|
if (row_2 < UISettings::GameListText::NoText || row_2 >= UISettings::GameListText::ListEnd) {
|
||||||
|
row_2 = UISettings::GameListText::FileName;
|
||||||
}
|
}
|
||||||
UISettings::values.game_list_row_2 = UISettings::GameListText{row_2};
|
UISettings::values.game_list_row_2 = 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();
|
UISettings::values.game_list_single_line_mode = ReadSetting("singleLineMode", false).toBool();
|
||||||
|
|
|
@ -52,9 +52,8 @@ enum class GameListText {
|
||||||
TitleName, ///< Display the name of the title
|
TitleName, ///< Display the name of the title
|
||||||
TitleID, ///< Display the title ID
|
TitleID, ///< Display the title ID
|
||||||
LongTitleName, ///< Display the long name of the title
|
LongTitleName, ///< Display the long name of the title
|
||||||
|
ListEnd, ///< Keep this at the end of the enum.
|
||||||
};
|
};
|
||||||
// The length of the GameListText, excluding NoText
|
|
||||||
constexpr int GAME_LIST_TEXT_LENGTH = 5;
|
|
||||||
|
|
||||||
struct Values {
|
struct Values {
|
||||||
QByteArray geometry;
|
QByteArray geometry;
|
||||||
|
|
Loading…
Reference in a new issue