diff --git a/shadPS4/gui/game_list_frame.cpp b/shadPS4/gui/game_list_frame.cpp index fd9ca1db..ae6093ae 100644 --- a/shadPS4/gui/game_list_frame.cpp +++ b/shadPS4/gui/game_list_frame.cpp @@ -82,7 +82,7 @@ game_list_frame::game_list_frame(std::shared_ptr gui_settings,QWid } } game_list_frame::~game_list_frame(){ - + SaveSettings(); } void game_list_frame::FixNarrowColumns() const { @@ -191,4 +191,24 @@ void game_list_frame::SortGameList() const // Shorten the last section to remove horizontal scrollbar if possible m_game_list->resizeColumnToContents(gui::column_count - 1); +} +void game_list_frame::LoadSettings() +{ + for (int col = 0; col < m_columnActs.count(); ++col) + { + const bool vis = m_gui_settings->GetGamelistColVisibility(col); + m_columnActs[col]->setChecked(vis); + m_game_list->setColumnHidden(col, !vis); + } + FixNarrowColumns(); + + m_game_list->horizontalHeader()->restoreState(m_game_list->horizontalHeader()->saveState()); + +} +void game_list_frame::SaveSettings() +{ + for (int col = 0; col < m_columnActs.count(); ++col) + { + m_gui_settings->SetGamelistColVisibility(col, m_columnActs[col]->isChecked()); + } } \ No newline at end of file diff --git a/shadPS4/gui/game_list_frame.h b/shadPS4/gui/game_list_frame.h index 4f8e610d..7991d55d 100644 --- a/shadPS4/gui/game_list_frame.h +++ b/shadPS4/gui/game_list_frame.h @@ -16,6 +16,12 @@ public : /** Fix columns with width smaller than the minimal section size */ void FixNarrowColumns() const; + /** Loads from settings. Public so that main frame can easily reset these settings if needed. */ + void LoadSettings(); + + /** Saves settings. Public so that main frame can save this when a caching of column widths is needed for settings backup */ + void SaveSettings(); + /** Resizes the columns to their contents and adds a small spacing */ void ResizeColumnsToContents(int spacing = 20) const; diff --git a/shadPS4/gui/shadps4gui.cpp b/shadPS4/gui/shadps4gui.cpp index 9827e6b9..849aebdb 100644 --- a/shadPS4/gui/shadps4gui.cpp +++ b/shadPS4/gui/shadps4gui.cpp @@ -19,6 +19,7 @@ shadps4gui::shadps4gui(std::shared_ptr gui_settings, QWidget* pare //game_list->PopulateAsync(); game_list_frame* game_list2 = new game_list_frame(m_gui_settings); ui.horizontalLayout->addWidget(game_list2); + game_list2->LoadSettings(); show(); }