|
|
|
@ -252,12 +252,7 @@ bool GameListModel::getShowLocalizedTitles() const
|
|
|
|
void GameListModel::setShowLocalizedTitles(bool enabled)
|
|
|
|
void GameListModel::setShowLocalizedTitles(bool enabled)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_show_localized_titles = enabled;
|
|
|
|
m_show_localized_titles = enabled;
|
|
|
|
|
|
|
|
invalidateColumn(Column_Title);
|
|
|
|
emit dataChanged(index(0, Column_Title), index(rowCount() - 1, Column_Title), {Qt::DisplayRole, Qt::ToolTipRole});
|
|
|
|
|
|
|
|
if (m_show_titles_for_covers)
|
|
|
|
|
|
|
|
emit dataChanged(index(0, Column_Cover), index(rowCount() - 1, Column_Cover), {Qt::DisplayRole});
|
|
|
|
|
|
|
|
// emit cover changed as well since the autogenerated covers will differ
|
|
|
|
|
|
|
|
refreshCovers();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool GameListModel::getShowCoverTitles() const
|
|
|
|
bool GameListModel::getShowCoverTitles() const
|
|
|
|
@ -303,13 +298,7 @@ void GameListModel::setIconSize(int size)
|
|
|
|
emit headerDataChanged(Qt::Vertical, 0, rowCount() - 1);
|
|
|
|
emit headerDataChanged(Qt::Vertical, 0, rowCount() - 1);
|
|
|
|
|
|
|
|
|
|
|
|
loadSizeDependentPixmaps();
|
|
|
|
loadSizeDependentPixmaps();
|
|
|
|
refreshIcons();
|
|
|
|
invalidateColumn(Column_Icon);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::refreshIcons()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_icon_pixmap_cache.Clear();
|
|
|
|
|
|
|
|
emit dataChanged(index(0, Column_Icon), index(rowCount() - 1, Column_Icon), {Qt::DecorationRole});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
float GameListModel::getCoverScale() const
|
|
|
|
float GameListModel::getCoverScale() const
|
|
|
|
@ -372,12 +361,6 @@ void GameListModel::updateCoverScale()
|
|
|
|
{Qt::DecorationRole, Qt::FontRole, Qt::SizeHintRole});
|
|
|
|
{Qt::DecorationRole, Qt::FontRole, Qt::SizeHintRole});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::refreshCovers()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_cover_pixmap_cache.Clear();
|
|
|
|
|
|
|
|
emit dataChanged(index(0, Column_Cover), index(rowCount() - 1, Column_Cover), {Qt::DecorationRole});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::updateCacheSize(int num_rows, int num_columns, QSortFilterProxyModel* const sort_model,
|
|
|
|
void GameListModel::updateCacheSize(int num_rows, int num_columns, QSortFilterProxyModel* const sort_model,
|
|
|
|
int top_left_row)
|
|
|
|
int top_left_row)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
@ -422,8 +405,8 @@ void GameListModel::setDevicePixelRatio(qreal dpr)
|
|
|
|
m_flag_pixmap_cache.clear();
|
|
|
|
m_flag_pixmap_cache.clear();
|
|
|
|
loadCommonImages();
|
|
|
|
loadCommonImages();
|
|
|
|
loadCoverScaleDependentPixmaps();
|
|
|
|
loadCoverScaleDependentPixmaps();
|
|
|
|
refreshCovers();
|
|
|
|
invalidateColumn(Column_Icon);
|
|
|
|
refreshIcons();
|
|
|
|
invalidateColumn(Column_Cover);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::reloadThemeSpecificImages()
|
|
|
|
void GameListModel::reloadThemeSpecificImages()
|
|
|
|
@ -510,7 +493,7 @@ void GameListModel::coverLoaded(const std::string& path, const QImage& image, fl
|
|
|
|
pmp->scale = scale;
|
|
|
|
pmp->scale = scale;
|
|
|
|
pmp->is_loading = false;
|
|
|
|
pmp->is_loading = false;
|
|
|
|
|
|
|
|
|
|
|
|
invalidateCoverForPath(path);
|
|
|
|
invalidateColumnForPath(path, Column_Cover, false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::rowsChanged(const QList<int>& rows)
|
|
|
|
void GameListModel::rowsChanged(const QList<int>& rows)
|
|
|
|
@ -537,17 +520,66 @@ void GameListModel::rowsChanged(const QList<int>& rows)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::invalidateCoverForPath(const std::string& path)
|
|
|
|
Qt::ItemDataRole GameListModel::getRoleToInvalidate(int column)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (column == Column_Icon || column == Column_Cover || column == Column_Region)
|
|
|
|
|
|
|
|
return Qt::DecorationRole;
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return Qt::DisplayRole;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::invalidateColumn(int column, bool invalidate_cache /* = true */)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (invalidate_cache)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (column == Column_Icon)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_icon_pixmap_cache.Clear();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (column == Column_Cover)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_cover_pixmap_cache.Clear();
|
|
|
|
|
|
|
|
if (QtHost::IsFullscreenUIStarted())
|
|
|
|
|
|
|
|
Host::RunOnCPUThread([]() { FullscreenUI::InvalidateCoverCache(); });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
emit dataChanged(index(0, column), index(rowCount() - 1, column), {getRoleToInvalidate(column)});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::invalidateColumnForPath(const std::string& path, int column, bool invalidate_cache /* = true */)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
std::optional<u32> row;
|
|
|
|
// if we're changing the title, the cover could change
|
|
|
|
|
|
|
|
if (column == Column_Title)
|
|
|
|
|
|
|
|
invalidateColumnForPath(path, Column_Cover, invalidate_cache);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (invalidate_cache)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
if (column == Column_Icon)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_icon_pixmap_cache.Remove(path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if (column == Column_Cover)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_cover_pixmap_cache.Remove(path);
|
|
|
|
|
|
|
|
if (QtHost::IsFullscreenUIStarted())
|
|
|
|
|
|
|
|
Host::RunOnCPUThread([path]() mutable { FullscreenUI::InvalidateCoverCache(std::move(path)); });
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const auto remove_entry = [this, &column](const GameList::Entry* ge, int row) {
|
|
|
|
|
|
|
|
const QModelIndex mi(index(row, column));
|
|
|
|
|
|
|
|
emit dataChanged(mi, mi, {getRoleToInvalidate(column)});
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
if (hasTakenGameList())
|
|
|
|
if (hasTakenGameList())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
for (u32 i = 0; i < static_cast<u32>(m_taken_entries->size()); i++)
|
|
|
|
for (u32 i = 0; i < static_cast<u32>(m_taken_entries->size()); i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (path == m_taken_entries.value()[i].path)
|
|
|
|
if (path == m_taken_entries.value()[i].path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
row = i;
|
|
|
|
remove_entry(&m_taken_entries.value()[i], static_cast<int>(i));
|
|
|
|
break;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -558,28 +590,14 @@ void GameListModel::invalidateCoverForPath(const std::string& path)
|
|
|
|
const size_t count = GameList::GetEntryCount();
|
|
|
|
const size_t count = GameList::GetEntryCount();
|
|
|
|
for (size_t i = 0; i < count; i++)
|
|
|
|
for (size_t i = 0; i < count; i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (GameList::GetEntryByIndex(i)->path == path)
|
|
|
|
const GameList::Entry* const entry = GameList::GetEntryByIndex(static_cast<u32>(i));
|
|
|
|
|
|
|
|
if (entry->path == path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
row = static_cast<int>(i);
|
|
|
|
remove_entry(entry, static_cast<int>(i));
|
|
|
|
break;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!row.has_value())
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
// Game removed?
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const QModelIndex mi(index(static_cast<int>(row.value()), Column_Cover));
|
|
|
|
|
|
|
|
emit dataChanged(mi, mi, {Qt::DecorationRole});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GameListModel::invalidateCoverCacheForPath(const std::string& path)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_cover_pixmap_cache.Remove(path);
|
|
|
|
|
|
|
|
invalidateCoverForPath(path);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const QPixmap& GameListModel::getCoverForEntry(const GameList::Entry* ge) const
|
|
|
|
const QPixmap& GameListModel::getCoverForEntry(const GameList::Entry* ge) const
|
|
|
|
@ -672,7 +690,8 @@ void GameListModel::setShowGameIcons(bool enabled)
|
|
|
|
|
|
|
|
|
|
|
|
if (enabled)
|
|
|
|
if (enabled)
|
|
|
|
GameList::ReloadMemcardTimestampCache();
|
|
|
|
GameList::ReloadMemcardTimestampCache();
|
|
|
|
refreshIcons();
|
|
|
|
|
|
|
|
|
|
|
|
invalidateColumn(Column_Icon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
QIcon GameListModel::getIconForGame(const QString& path)
|
|
|
|
QIcon GameListModel::getIconForGame(const QString& path)
|
|
|
|
@ -2053,12 +2072,6 @@ void GameListWidget::onGridViewContextMenuRequested(const QPoint& point)
|
|
|
|
emit entryContextMenuRequested(m_grid_view->mapToGlobal(point));
|
|
|
|
emit entryContextMenuRequested(m_grid_view->mapToGlobal(point));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameListWidget::refreshGridCovers()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
m_model->refreshCovers();
|
|
|
|
|
|
|
|
Host::RunOnCPUThread(&FullscreenUI::InvalidateCoverCache);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void GameListWidget::focusSearchWidget()
|
|
|
|
void GameListWidget::focusSearchWidget()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
m_ui.searchText->setFocus(Qt::ShortcutFocusReason);
|
|
|
|
m_ui.searchText->setFocus(Qt::ShortcutFocusReason);
|
|
|
|
@ -2110,7 +2123,6 @@ 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::setShowLocalizedTitles(bool enabled)
|
|
|
|
void GameListWidget::setShowLocalizedTitles(bool enabled)
|
|
|
|
@ -2160,7 +2172,7 @@ void GameListWidget::setPreferAchievementGameIcons(bool enabled)
|
|
|
|
if (!enabled)
|
|
|
|
if (!enabled)
|
|
|
|
GameList::ReloadMemcardTimestampCache();
|
|
|
|
GameList::ReloadMemcardTimestampCache();
|
|
|
|
|
|
|
|
|
|
|
|
m_model->refreshIcons();
|
|
|
|
m_model->invalidateColumn(GameListModel::Column_Icon);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void GameListWidget::setShowCoverTitles(bool enabled)
|
|
|
|
void GameListWidget::setShowCoverTitles(bool enabled)
|
|
|
|
|