From aaa75a7ce1a4d91312950992cb9b5f531cc327d3 Mon Sep 17 00:00:00 2001 From: Jonah Date: Fri, 29 Mar 2024 00:48:17 -0600 Subject: [PATCH] - fix grid mode not populating on first run(fresh run with no settings saved). - refresh game list button. --- src/qt_gui/main_window.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/qt_gui/main_window.cpp b/src/qt_gui/main_window.cpp index ef128e07..1fef5aef 100644 --- a/src/qt_gui/main_window.cpp +++ b/src/qt_gui/main_window.cpp @@ -145,6 +145,8 @@ void MainWindow::CreateConnects() { connect(ui->exitAct, &QAction::triggered, this, &QWidget::close); + connect(ui->refreshGameListAct, &QAction::triggered, this, &MainWindow::RefreshGameTable); + connect(ui->sizeSlider, &QSlider::valueChanged, this, [this](int value) { if (isTableList) { m_game_list_frame->icon_size = @@ -217,8 +219,10 @@ void MainWindow::CreateConnects() { m_dock_widget->setWidget(m_game_list_frame); m_game_list_frame->show(); m_game_grid_frame->hide(); - m_game_list_frame->clearContents(); - m_game_list_frame->PopulateGameList(); + if (m_game_list_frame->item(0, 0) == nullptr) { + m_game_list_frame->clearContents(); + m_game_list_frame->PopulateGameList(); + } isTableList = true; m_gui_settings->SetValue(gui::m_table_mode, 0); // save table mode int slider_pos = m_gui_settings->GetValue(gui::m_slide_pos).toInt(); @@ -229,6 +233,10 @@ void MainWindow::CreateConnects() { m_dock_widget->setWidget(m_game_grid_frame); m_game_grid_frame->show(); m_game_list_frame->hide(); + if (m_game_grid_frame->item(0, 0) == nullptr) { + m_game_grid_frame->clearContents(); + m_game_grid_frame->PopulateGameGrid(m_game_info->m_games, false); + } isTableList = false; m_gui_settings->SetValue(gui::m_table_mode, 1); // save table mode int slider_pos_grid = m_gui_settings->GetValue(gui::m_slide_pos_grid).toInt();