mirror of
https://github.com/stenzek/duckstation.git
synced 2025-07-19 08:30:24 +00:00
Qt: Fix game list icons when toggling disc set merging
Also, make sure we call beginFilterChange() in the proxy model as mentioned in the Qt docs.
This commit is contained in:
parent
4b5be29eb2
commit
2f13538cc0
@ -143,11 +143,15 @@ void GameListModel::setShowGameIcons(bool enabled)
|
|||||||
{
|
{
|
||||||
m_show_game_icons = enabled;
|
m_show_game_icons = enabled;
|
||||||
|
|
||||||
beginResetModel();
|
|
||||||
m_memcard_pixmap_cache.Clear();
|
|
||||||
if (enabled)
|
if (enabled)
|
||||||
GameList::ReloadMemcardTimestampCache();
|
GameList::ReloadMemcardTimestampCache();
|
||||||
endResetModel();
|
refreshIcons();
|
||||||
|
}
|
||||||
|
|
||||||
|
void GameListModel::refreshIcons()
|
||||||
|
{
|
||||||
|
m_memcard_pixmap_cache.Clear();
|
||||||
|
emit dataChanged(index(0, Column_Icon), index(rowCount() - 1, Column_Icon), {Qt::DecorationRole});
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListModel::setCoverScale(float scale)
|
void GameListModel::setCoverScale(float scale)
|
||||||
@ -305,7 +309,7 @@ void GameListModel::rowsChanged(const QList<int>& rows)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
emit dataChanged(createIndex(rows[start], 0), createIndex(rows[idx], Column_Count - 1), roles_changed);
|
emit dataChanged(index(rows[start], 0), index(rows[idx], Column_Count - 1), roles_changed);
|
||||||
start = ++idx;
|
start = ++idx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -939,24 +943,28 @@ public:
|
|||||||
|
|
||||||
void setMergeDiscSets(bool enabled)
|
void setMergeDiscSets(bool enabled)
|
||||||
{
|
{
|
||||||
|
beginFilterChange();
|
||||||
m_merge_disc_sets = enabled;
|
m_merge_disc_sets = enabled;
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFilterType(GameList::EntryType type)
|
void setFilterType(GameList::EntryType type)
|
||||||
{
|
{
|
||||||
|
beginFilterChange();
|
||||||
m_filter_type = type;
|
m_filter_type = type;
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFilterRegion(DiscRegion region)
|
void setFilterRegion(DiscRegion region)
|
||||||
{
|
{
|
||||||
|
beginFilterChange();
|
||||||
m_filter_region = region;
|
m_filter_region = region;
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
}
|
}
|
||||||
|
|
||||||
void setFilterName(std::string name)
|
void setFilterName(std::string name)
|
||||||
{
|
{
|
||||||
|
beginFilterChange();
|
||||||
m_filter_name = std::move(name);
|
m_filter_name = std::move(name);
|
||||||
std::transform(m_filter_name.begin(), m_filter_name.end(), m_filter_name.begin(), StringUtil::ToLower);
|
std::transform(m_filter_name.begin(), m_filter_name.end(), m_filter_name.begin(), StringUtil::ToLower);
|
||||||
invalidateRowsFilter();
|
invalidateRowsFilter();
|
||||||
@ -1241,11 +1249,6 @@ void GameListWidget::refresh(bool invalidate_cache)
|
|||||||
m_refresh_thread->start();
|
m_refresh_thread->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListWidget::refreshModel()
|
|
||||||
{
|
|
||||||
m_model->refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GameListWidget::cancelRefresh()
|
void GameListWidget::cancelRefresh()
|
||||||
{
|
{
|
||||||
if (!m_refresh_thread)
|
if (!m_refresh_thread)
|
||||||
@ -1445,6 +1448,7 @@ void GameListWidget::setMergeDiscSets(bool enabled)
|
|||||||
Host::SetBaseBoolSettingValue("UI", "GameListMergeDiscSets", enabled);
|
Host::SetBaseBoolSettingValue("UI", "GameListMergeDiscSets", enabled);
|
||||||
Host::CommitBaseSettingChanges();
|
Host::CommitBaseSettingChanges();
|
||||||
m_sort_model->setMergeDiscSets(enabled);
|
m_sort_model->setMergeDiscSets(enabled);
|
||||||
|
m_model->refreshIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameListWidget::setShowGameIcons(bool enabled)
|
void GameListWidget::setShowGameIcons(bool enabled)
|
||||||
|
@ -90,6 +90,7 @@ public:
|
|||||||
bool getShowGameIcons() const { return m_show_game_icons; }
|
bool getShowGameIcons() const { return m_show_game_icons; }
|
||||||
void setShowGameIcons(bool enabled);
|
void setShowGameIcons(bool enabled);
|
||||||
QIcon getIconForGame(const QString& path);
|
QIcon getIconForGame(const QString& path);
|
||||||
|
void refreshIcons();
|
||||||
|
|
||||||
float getCoverScale() const { return m_cover_scale; }
|
float getCoverScale() const { return m_cover_scale; }
|
||||||
void setCoverScale(float scale);
|
void setCoverScale(float scale);
|
||||||
@ -101,10 +102,8 @@ public:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void coverScaleChanged(float scale);
|
void coverScaleChanged(float scale);
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void rowsChanged(const QList<int>& rows);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void rowsChanged(const QList<int>& rows);
|
||||||
QVariant data(const QModelIndex& index, int role, const GameList::Entry* ge) const;
|
QVariant data(const QModelIndex& index, int role, const GameList::Entry* ge) const;
|
||||||
|
|
||||||
void loadCommonImages();
|
void loadCommonImages();
|
||||||
@ -164,11 +163,10 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* e) override;
|
void resizeEvent(QResizeEvent* e) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
private:
|
||||||
void onHeaderSortIndicatorChanged(int, Qt::SortOrder);
|
void onHeaderSortIndicatorChanged(int, Qt::SortOrder);
|
||||||
void onHeaderContextMenuRequested(const QPoint& point);
|
void onHeaderContextMenuRequested(const QPoint& point);
|
||||||
|
|
||||||
private:
|
|
||||||
void loadColumnVisibilitySettings();
|
void loadColumnVisibilitySettings();
|
||||||
void loadColumnSortSettings();
|
void loadColumnSortSettings();
|
||||||
void saveColumnSortSettings();
|
void saveColumnSortSettings();
|
||||||
@ -198,10 +196,8 @@ protected:
|
|||||||
void wheelEvent(QWheelEvent* e) override;
|
void wheelEvent(QWheelEvent* e) override;
|
||||||
void resizeEvent(QResizeEvent* e) override;
|
void resizeEvent(QResizeEvent* e) override;
|
||||||
|
|
||||||
private Q_SLOTS:
|
|
||||||
void onCoverScaleChanged(float scale);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void onCoverScaleChanged(float scale);
|
||||||
void adjustZoom(float delta);
|
void adjustZoom(float delta);
|
||||||
|
|
||||||
GameListModel* m_model = nullptr;
|
GameListModel* m_model = nullptr;
|
||||||
@ -226,7 +222,6 @@ public:
|
|||||||
void resizeListViewColumnsToFit();
|
void resizeListViewColumnsToFit();
|
||||||
|
|
||||||
void refresh(bool invalidate_cache);
|
void refresh(bool invalidate_cache);
|
||||||
void refreshModel();
|
|
||||||
void cancelRefresh();
|
void cancelRefresh();
|
||||||
void reloadThemeSpecificImages();
|
void reloadThemeSpecificImages();
|
||||||
void updateBackground(bool reload_image);
|
void updateBackground(bool reload_image);
|
||||||
|
@ -2738,7 +2738,7 @@ void MainWindow::refreshGameList(bool invalidate_cache)
|
|||||||
|
|
||||||
void MainWindow::refreshGameListModel()
|
void MainWindow::refreshGameListModel()
|
||||||
{
|
{
|
||||||
m_game_list_widget->refreshModel();
|
m_game_list_widget->getModel()->refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::cancelGameListRefresh()
|
void MainWindow::cancelGameListRefresh()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user