Merge pull request #7499 from JosJuice/purge-game-list-cache

DolphinQt: Implement "Purge Game List Cache"
This commit is contained in:
Pierre Bourdon
2018-10-28 17:00:04 +01:00
committed by GitHub
11 changed files with 41 additions and 3 deletions

View File

@ -89,6 +89,11 @@ GameList::GameList(QWidget* parent) : QStackedWidget(parent)
[this] { m_grid_proxy->invalidate(); });
}
void GameList::PurgeCache()
{
m_model->PurgeCache();
}
void GameList::MakeListView()
{
m_list = new QTableView(this);

View File

@ -41,6 +41,8 @@ public:
void resizeEvent(QResizeEvent* event) override;
void PurgeCache();
signals:
void GameSelected();
void NetPlayHost(const QString& game_id);

View File

@ -362,3 +362,8 @@ void GameListModel::DeleteTag(const QString& name)
Settings::GetQSettings().setValue(QStringLiteral("gamelist/tags"), m_tag_list);
}
void GameListModel::PurgeCache()
{
m_tracker.PurgeCache();
}

View File

@ -75,6 +75,8 @@ public:
void NewTag(const QString& name);
void DeleteTag(const QString& name);
void PurgeCache();
private:
// Index in m_games, or -1 if it isn't found
int FindGame(const std::string& path) const;

View File

@ -75,6 +75,9 @@ GameTracker::GameTracker(QObject* parent) : QFileSystemWatcher(parent)
});
QueueOnObject(this, [this] { Settings::Instance().NotifyMetadataRefreshComplete(); });
break;
case CommandType::PurgeCache:
m_cache.Clear(UICommon::GameFileCache::DeleteOnDisk::Yes);
break;
}
});
@ -322,3 +325,9 @@ void GameTracker::LoadGame(const QString& path)
m_cache.Save();
}
}
void GameTracker::PurgeCache()
{
m_load_thread.EmplaceItem(Command{CommandType::PurgeCache, {}});
RefreshAll();
}

View File

@ -41,6 +41,7 @@ public:
void AddDirectory(const QString& dir);
void RemoveDirectory(const QString& dir);
void RefreshAll();
void PurgeCache();
signals:
void GameLoaded(const std::shared_ptr<const UICommon::GameFile>& game);
@ -70,7 +71,8 @@ private:
RemoveDirectory,
UpdateDirectory,
UpdateFile,
UpdateMetadata
UpdateMetadata,
PurgeCache
};
struct Command