Qt: refactor Get-/SetGamelistColVisibility

This commit is contained in:
Megamouse 2018-05-18 00:05:42 +02:00 committed by Ivan
parent 9c025be831
commit 2b8f96dcec
2 changed files with 10 additions and 6 deletions

View File

@ -174,9 +174,7 @@ void gui_settings::ShowInfoBox(const gui_save& entry, const QString& title, cons
void gui_settings::SetGamelistColVisibility(int col, bool val)
{
// hide sound format and parental level
bool show = col != 8 && col != 9;
SetValue(gui_save(gui::game_list, "Col" + QString::number(col) + "visible", show), val);
SetValue(GetGuiSaveForColumn(col), val);
}
void gui_settings::SetCustomColor(int col, const QColor& val)
@ -197,9 +195,7 @@ logs::level gui_settings::GetLogLevel()
bool gui_settings::GetGamelistColVisibility(int col)
{
// hide sound format, parental level, firmware version and path by default
bool show = col != gui::column_sound && col != gui::column_parental && col != gui::column_firmware && col != gui::column_path;
return GetValue(gui_save(gui::game_list, "Col" + QString::number(col) + "visible", show)).toBool();
return GetValue(GetGuiSaveForColumn(col)).toBool();
}
QColor gui_settings::GetCustomColor(int col)
@ -264,3 +260,10 @@ QSize gui_settings::SizeFromSlider(int pos)
{
return gui::gl_icon_size_min + (gui::gl_icon_size_max - gui::gl_icon_size_min) * (pos / (float)gui::gl_max_slider_pos);
}
gui_save gui_settings::GetGuiSaveForColumn(int col)
{
// hide sound format, parental level, firmware version and path by default
bool show = col != gui::column_sound && col != gui::column_parental && col != gui::column_firmware && col != gui::column_path;
return gui_save{ gui::game_list, "Col" + QString::number(col) + "visible", show };
}

View File

@ -233,6 +233,7 @@ public Q_SLOTS:
void SaveCurrentConfig(const QString& friendlyName);
static QSize SizeFromSlider(int pos);
static gui_save GetGuiSaveForColumn(int col);
private:
QString ComputeSettingsDir();