GameListModel: make UpdateGame update existing files as well
This commit is contained in:
parent
8d7f28e79b
commit
f724a06108
|
@ -204,15 +204,18 @@ void GameListModel::UpdateGame(QSharedPointer<GameFile> game)
|
|||
{
|
||||
QString path = game->GetFilePath();
|
||||
|
||||
int entry = FindGame(path);
|
||||
if (entry < 0)
|
||||
entry = m_games.size();
|
||||
int index = FindGame(path);
|
||||
if (index < 0)
|
||||
{
|
||||
beginInsertRows(QModelIndex(), m_games.size(), m_games.size());
|
||||
m_games.push_back(game);
|
||||
endInsertRows();
|
||||
}
|
||||
else
|
||||
return;
|
||||
|
||||
beginInsertRows(QModelIndex(), entry, entry);
|
||||
m_games.insert(entry, game);
|
||||
endInsertRows();
|
||||
{
|
||||
m_games[index] = game;
|
||||
emit dataChanged(createIndex(index, 0), createIndex(index + 1, columnCount(QModelIndex())));
|
||||
}
|
||||
}
|
||||
|
||||
void GameListModel::RemoveGame(const QString& path)
|
||||
|
|
Loading…
Reference in New Issue