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:
zhupengfei
2019-04-20 12:50:26 +08:00
parent 4a9ea65e49
commit 40ad54c5c7
9 changed files with 69 additions and 17 deletions
+11 -7
View File
@@ -41,13 +41,7 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
// Create a proxy to the game list to display the list of preferred games
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 ComboBoxProxyModel;
proxy->setSourceModel(game_list);
@@ -79,6 +73,16 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list,
HostRoomWindow::~HostRoomWindow() = default;
void HostRoomWindow::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());
}
}
}
void HostRoomWindow::RetranslateUi() {
ui->retranslateUi(this);
}