Restore selection after votes list update.

It allows to choose vote from list even if someone is spamming with random track button.
This commit is contained in:
Deve 2019-04-09 21:18:22 +02:00
parent a0b3bdd4c2
commit 19b0bc7fa9

View File

@ -764,6 +764,9 @@ void TracksScreen::updatePlayerVotes()
auto cl = LobbyProtocol::get<ClientLobby>();
if (GUIEngine::getCurrentScreen() != this || !cl || !m_vote_list)
return;
std::string selected_name = m_vote_list->getSelectionInternalName();
m_vote_list->clear();
for (unsigned i = 0; i < m_index_to_hostid.size(); i++)
{
@ -828,6 +831,12 @@ void TracksScreen::updatePlayerVotes()
StringUtils::toString(m_index_to_hostid[i]), row);
}
}
if (!selected_name.empty())
{
int id = m_vote_list->getItemID(selected_name);
m_vote_list->setSelectionID(id);
}
} // updatePlayerVotes
// ----------------------------------------------------------------------------