citra_qt: Update the multiplayer dialogs when game list is repopulated
The multiplayer state object and dialogs hold a (modified) game list model, but it isn't updated when the actual game list changes. This updates the multiplayer dialogs with the new game list when it got repopulated.
This commit is contained in:
@@ -35,13 +35,7 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
|
||||
// Create a proxy to the game list to get the list of games owned
|
||||
game_list = new QStandardItemModel;
|
||||
|
||||
for (int i = 0; i < list->rowCount(); i++) {
|
||||
auto parent = list->item(i, 0);
|
||||
for (int j = 0; j < parent->rowCount(); j++) {
|
||||
game_list->appendRow(parent->child(j)->clone());
|
||||
}
|
||||
}
|
||||
UpdateGameList(list);
|
||||
|
||||
proxy = new LobbyFilterProxyModel(this, game_list);
|
||||
proxy->setSourceModel(model);
|
||||
@@ -88,6 +82,18 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
|
||||
RefreshLobby();
|
||||
}
|
||||
|
||||
void Lobby::UpdateGameList(QStandardItemModel* list) {
|
||||
game_list->clear();
|
||||
for (int i = 0; i < list->rowCount(); i++) {
|
||||
auto parent = list->item(i, 0);
|
||||
for (int j = 0; j < parent->rowCount(); j++) {
|
||||
game_list->appendRow(parent->child(j)->clone());
|
||||
}
|
||||
}
|
||||
if (proxy)
|
||||
proxy->UpdateGameList(game_list);
|
||||
}
|
||||
|
||||
void Lobby::RetranslateUi() {
|
||||
ui->retranslateUi(this);
|
||||
}
|
||||
@@ -260,6 +266,10 @@ void Lobby::OnRefreshLobby() {
|
||||
LobbyFilterProxyModel::LobbyFilterProxyModel(QWidget* parent, QStandardItemModel* list)
|
||||
: QSortFilterProxyModel(parent), game_list(list) {}
|
||||
|
||||
void LobbyFilterProxyModel::UpdateGameList(QStandardItemModel* list) {
|
||||
game_list = list;
|
||||
}
|
||||
|
||||
bool LobbyFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelIndex& sourceParent) const {
|
||||
// Prioritize filters by fastest to compute
|
||||
|
||||
|
||||
Reference in New Issue
Block a user