Qt: Fix possible cover cache overflow when zooming

This commit is contained in:
Connor McLaughlin 2022-07-25 18:50:57 +10:00
parent a8f5146010
commit 418898fe94

View file

@ -86,6 +86,7 @@ void GameListWidget::initialize()
m_model = new GameListModel(this); m_model = new GameListModel(this);
m_model->setCoverScale(Host::GetBaseFloatSettingValue("UI", "GameListCoverArtScale", 0.45f)); m_model->setCoverScale(Host::GetBaseFloatSettingValue("UI", "GameListCoverArtScale", 0.45f));
m_model->setShowCoverTitles(Host::GetBaseBoolSettingValue("UI", "GameListShowCoverTitles", true)); m_model->setShowCoverTitles(Host::GetBaseBoolSettingValue("UI", "GameListShowCoverTitles", true));
m_model->updateCacheSize(width(), height());
m_sort_model = new GameListSortModel(m_model); m_sort_model = new GameListSortModel(m_model);
m_sort_model->setSourceModel(m_model); m_sort_model->setSourceModel(m_model);
@ -322,6 +323,7 @@ void GameListWidget::listZoom(float delta)
const float new_scale = std::clamp(m_model->getCoverScale() + delta, MIN_SCALE, MAX_SCALE); const float new_scale = std::clamp(m_model->getCoverScale() + delta, MIN_SCALE, MAX_SCALE);
Host::SetBaseFloatSettingValue("UI", "GameListCoverArtScale", new_scale); Host::SetBaseFloatSettingValue("UI", "GameListCoverArtScale", new_scale);
m_model->setCoverScale(new_scale); m_model->setCoverScale(new_scale);
m_model->updateCacheSize(width(), height());
updateListFont(); updateListFont();
updateToolbar(); updateToolbar();
@ -344,6 +346,7 @@ void GameListWidget::gridIntScale(int int_scale)
Host::SetBaseFloatSettingValue("UI", "GameListCoverArtScale", new_scale); Host::SetBaseFloatSettingValue("UI", "GameListCoverArtScale", new_scale);
m_model->setCoverScale(new_scale); m_model->setCoverScale(new_scale);
m_model->updateCacheSize(width(), height());
updateListFont(); updateListFont();
updateToolbar(); updateToolbar();