diff options
author | liamwhite <liamwhite@users.noreply.github.com> | 2024-02-03 17:09:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-03 17:09:51 +0100 |
commit | 327533be1f253e34fc373962b4f579a420049b62 (patch) | |
tree | e79814d30f08bad2ee8a70365466c2de645e14fb | |
parent | Merge pull request #12850 from Calinou/multiplayer-add-hotkeys (diff) | |
parent | Persist filters in multiplayer public lobby list (diff) | |
download | yuzu-327533be1f253e34fc373962b4f579a420049b62.tar yuzu-327533be1f253e34fc373962b4f579a420049b62.tar.gz yuzu-327533be1f253e34fc373962b4f579a420049b62.tar.bz2 yuzu-327533be1f253e34fc373962b4f579a420049b62.tar.lz yuzu-327533be1f253e34fc373962b4f579a420049b62.tar.xz yuzu-327533be1f253e34fc373962b4f579a420049b62.tar.zst yuzu-327533be1f253e34fc373962b4f579a420049b62.zip |
-rw-r--r-- | src/yuzu/multiplayer/lobby.cpp | 13 | ||||
-rw-r--r-- | src/yuzu/uisettings.h | 7 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/yuzu/multiplayer/lobby.cpp b/src/yuzu/multiplayer/lobby.cpp index 41692c05b..77ac84295 100644 --- a/src/yuzu/multiplayer/lobby.cpp +++ b/src/yuzu/multiplayer/lobby.cpp @@ -77,16 +77,23 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list, // UI Buttons connect(ui->refresh_list, &QPushButton::clicked, this, &Lobby::RefreshLobby); + connect(ui->search, &QLineEdit::textChanged, proxy, &LobbyFilterProxyModel::SetFilterSearch); connect(ui->games_owned, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterOwned); connect(ui->hide_empty, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterEmpty); connect(ui->hide_full, &QCheckBox::toggled, proxy, &LobbyFilterProxyModel::SetFilterFull); - connect(ui->search, &QLineEdit::textChanged, proxy, &LobbyFilterProxyModel::SetFilterSearch); connect(ui->room_list, &QTreeView::doubleClicked, this, &Lobby::OnJoinRoom); connect(ui->room_list, &QTreeView::clicked, this, &Lobby::OnExpandRoom); // Actions connect(&room_list_watcher, &QFutureWatcher<AnnounceMultiplayerRoom::RoomList>::finished, this, &Lobby::OnRefreshLobby); + + // Load persistent filters after events are connected to make sure they apply + ui->search->setText( + QString::fromStdString(UISettings::values.multiplayer_filter_text.GetValue())); + ui->games_owned->setChecked(UISettings::values.multiplayer_filter_games_owned.GetValue()); + ui->hide_empty->setChecked(UISettings::values.multiplayer_filter_hide_empty.GetValue()); + ui->hide_full->setChecked(UISettings::values.multiplayer_filter_hide_full.GetValue()); } Lobby::~Lobby() = default; @@ -204,6 +211,10 @@ void Lobby::OnJoinRoom(const QModelIndex& source) { // Save settings UISettings::values.multiplayer_nickname = ui->nickname->text().toStdString(); + UISettings::values.multiplayer_filter_text = ui->search->text().toStdString(); + UISettings::values.multiplayer_filter_games_owned = ui->games_owned->isChecked(); + UISettings::values.multiplayer_filter_hide_empty = ui->hide_empty->isChecked(); + UISettings::values.multiplayer_filter_hide_full = ui->hide_full->isChecked(); UISettings::values.multiplayer_ip = proxy->data(connection_index, LobbyItemHost::HostIPRole).value<QString>().toStdString(); UISettings::values.multiplayer_port = diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 8db8f7527..03e42b930 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h @@ -169,6 +169,13 @@ struct Values { // multiplayer settings Setting<std::string> multiplayer_nickname{linkage, {}, "nickname", Category::Multiplayer}; + Setting<std::string> multiplayer_filter_text{linkage, {}, "filter_text", Category::Multiplayer}; + Setting<bool> multiplayer_filter_games_owned{linkage, false, "filter_games_owned", + Category::Multiplayer}; + Setting<bool> multiplayer_filter_hide_empty{linkage, false, "filter_games_hide_empty", + Category::Multiplayer}; + Setting<bool> multiplayer_filter_hide_full{linkage, false, "filter_games_hide_full", + Category::Multiplayer}; Setting<std::string> multiplayer_ip{linkage, {}, "ip", Category::Multiplayer}; Setting<u16, true> multiplayer_port{linkage, 24872, 0, UINT16_MAX, "port", Category::Multiplayer}; |