Qt: Fix checked state on startup for disc merging

This commit is contained in:
Stenzek 2024-06-13 22:15:49 +10:00
parent 8124fb2ef5
commit 277147199e
No known key found for this signature in database
3 changed files with 14 additions and 7 deletions

View File

@ -38,7 +38,7 @@ class GameListSortModel final : public QSortFilterProxyModel
public:
explicit GameListSortModel(GameListModel* parent) : QSortFilterProxyModel(parent), m_model(parent) {}
bool getMergeDiscSets() const { return m_merge_disc_sets; }
bool isMergingDiscSets() const { return m_merge_disc_sets; }
void setMergeDiscSets(bool enabled)
{
@ -232,11 +232,16 @@ bool GameListWidget::isShowingGameGrid() const
return m_ui.stack->currentIndex() == 1;
}
bool GameListWidget::getShowGridCoverTitles() const
bool GameListWidget::isShowingGridCoverTitles() const
{
return m_model->getShowCoverTitles();
}
bool GameListWidget::isMergingDiscSets() const
{
return m_sort_model->isMergingDiscSets();
}
void GameListWidget::refresh(bool invalidate_cache)
{
cancelRefresh();
@ -453,7 +458,7 @@ void GameListWidget::setShowCoverTitles(bool enabled)
void GameListWidget::setMergeDiscSets(bool enabled)
{
if (m_sort_model->getMergeDiscSets() == enabled)
if (m_sort_model->isMergingDiscSets() == enabled)
{
updateToolbar();
return;
@ -483,7 +488,7 @@ void GameListWidget::updateToolbar()
}
{
QSignalBlocker sb(m_ui.viewMergeDiscSets);
m_ui.viewMergeDiscSets->setChecked(m_sort_model->getMergeDiscSets());
m_ui.viewMergeDiscSets->setChecked(m_sort_model->isMergingDiscSets());
}
{
QSignalBlocker sb(m_ui.gridScale);

View File

@ -50,7 +50,8 @@ public:
bool isShowingGameList() const;
bool isShowingGameGrid() const;
bool getShowGridCoverTitles() const;
bool isShowingGridCoverTitles() const;
bool isMergingDiscSets() const;
const GameList::Entry* getSelectedEntry() const;

View File

@ -1626,7 +1626,8 @@ void MainWindow::setupAdditionalUi()
m_game_list_widget = new GameListWidget(getContentParent());
m_game_list_widget->initialize();
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->getShowGridCoverTitles());
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->isShowingGridCoverTitles());
m_ui.actionMergeDiscSets->setChecked(m_game_list_widget->isMergingDiscSets());
if (s_use_central_widget)
{
m_ui.mainContainer = nullptr; // setCentralWidget() will delete this
@ -1666,7 +1667,7 @@ void MainWindow::setupAdditionalUi()
m_settings_toolbar_menu->addAction(m_ui.actionSettings);
m_settings_toolbar_menu->addAction(m_ui.actionViewGameProperties);
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->getShowGridCoverTitles());
m_ui.actionGridViewShowTitles->setChecked(m_game_list_widget->isShowingGridCoverTitles());
updateDebugMenuVisibility();
updateCheatActionsVisibility();