diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/yuzu/multiplayer/direct_connect.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/multiplayer/host_room.cpp | 16 | ||||
| -rw-r--r-- | src/yuzu/multiplayer/lobby.cpp | 7 | ||||
| -rw-r--r-- | src/yuzu/uisettings.h | 88 |
4 files changed, 63 insertions, 57 deletions
diff --git a/src/yuzu/multiplayer/direct_connect.cpp b/src/yuzu/multiplayer/direct_connect.cpp index d71cc23a7..a415a953f 100644 --- a/src/yuzu/multiplayer/direct_connect.cpp +++ b/src/yuzu/multiplayer/direct_connect.cpp | |||
| @@ -34,13 +34,14 @@ DirectConnectWindow::DirectConnectWindow(Core::System& system_, QWidget* parent) | |||
| 34 | connect(watcher, &QFutureWatcher<void>::finished, this, &DirectConnectWindow::OnConnection); | 34 | connect(watcher, &QFutureWatcher<void>::finished, this, &DirectConnectWindow::OnConnection); |
| 35 | 35 | ||
| 36 | ui->nickname->setValidator(validation.GetNickname()); | 36 | ui->nickname->setValidator(validation.GetNickname()); |
| 37 | ui->nickname->setText(UISettings::values.multiplayer_nickname.GetValue()); | 37 | ui->nickname->setText( |
| 38 | QString::fromStdString(UISettings::values.multiplayer_nickname.GetValue())); | ||
| 38 | if (ui->nickname->text().isEmpty() && !Settings::values.yuzu_username.GetValue().empty()) { | 39 | if (ui->nickname->text().isEmpty() && !Settings::values.yuzu_username.GetValue().empty()) { |
| 39 | // Use yuzu Web Service user name as nickname by default | 40 | // Use yuzu Web Service user name as nickname by default |
| 40 | ui->nickname->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue())); | 41 | ui->nickname->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue())); |
| 41 | } | 42 | } |
| 42 | ui->ip->setValidator(validation.GetIP()); | 43 | ui->ip->setValidator(validation.GetIP()); |
| 43 | ui->ip->setText(UISettings::values.multiplayer_ip.GetValue()); | 44 | ui->ip->setText(QString::fromStdString(UISettings::values.multiplayer_ip.GetValue())); |
| 44 | ui->port->setValidator(validation.GetPort()); | 45 | ui->port->setValidator(validation.GetPort()); |
| 45 | ui->port->setText(QString::number(UISettings::values.multiplayer_port.GetValue())); | 46 | ui->port->setText(QString::number(UISettings::values.multiplayer_port.GetValue())); |
| 46 | 47 | ||
| @@ -91,8 +92,8 @@ void DirectConnectWindow::Connect() { | |||
| 91 | } | 92 | } |
| 92 | 93 | ||
| 93 | // Store settings | 94 | // Store settings |
| 94 | UISettings::values.multiplayer_nickname = ui->nickname->text(); | 95 | UISettings::values.multiplayer_nickname = ui->nickname->text().toStdString(); |
| 95 | UISettings::values.multiplayer_ip = ui->ip->text(); | 96 | UISettings::values.multiplayer_ip = ui->ip->text().toStdString(); |
| 96 | if (ui->port->isModified() && !ui->port->text().isEmpty()) { | 97 | if (ui->port->isModified() && !ui->port->text().isEmpty()) { |
| 97 | UISettings::values.multiplayer_port = ui->port->text().toInt(); | 98 | UISettings::values.multiplayer_port = ui->port->text().toInt(); |
| 98 | } else { | 99 | } else { |
diff --git a/src/yuzu/multiplayer/host_room.cpp b/src/yuzu/multiplayer/host_room.cpp index a8faa5b24..ef364ee43 100644 --- a/src/yuzu/multiplayer/host_room.cpp +++ b/src/yuzu/multiplayer/host_room.cpp | |||
| @@ -55,12 +55,14 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list, | |||
| 55 | connect(ui->host, &QPushButton::clicked, this, &HostRoomWindow::Host); | 55 | connect(ui->host, &QPushButton::clicked, this, &HostRoomWindow::Host); |
| 56 | 56 | ||
| 57 | // Restore the settings: | 57 | // Restore the settings: |
| 58 | ui->username->setText(UISettings::values.multiplayer_room_nickname.GetValue()); | 58 | ui->username->setText( |
| 59 | QString::fromStdString(UISettings::values.multiplayer_room_nickname.GetValue())); | ||
| 59 | if (ui->username->text().isEmpty() && !Settings::values.yuzu_username.GetValue().empty()) { | 60 | if (ui->username->text().isEmpty() && !Settings::values.yuzu_username.GetValue().empty()) { |
| 60 | // Use yuzu Web Service user name as nickname by default | 61 | // Use yuzu Web Service user name as nickname by default |
| 61 | ui->username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue())); | 62 | ui->username->setText(QString::fromStdString(Settings::values.yuzu_username.GetValue())); |
| 62 | } | 63 | } |
| 63 | ui->room_name->setText(UISettings::values.multiplayer_room_name.GetValue()); | 64 | ui->room_name->setText( |
| 65 | QString::fromStdString(UISettings::values.multiplayer_room_name.GetValue())); | ||
| 64 | ui->port->setText(QString::number(UISettings::values.multiplayer_room_port.GetValue())); | 66 | ui->port->setText(QString::number(UISettings::values.multiplayer_room_port.GetValue())); |
| 65 | ui->max_player->setValue(UISettings::values.multiplayer_max_player.GetValue()); | 67 | ui->max_player->setValue(UISettings::values.multiplayer_max_player.GetValue()); |
| 66 | int index = UISettings::values.multiplayer_host_type.GetValue(); | 68 | int index = UISettings::values.multiplayer_host_type.GetValue(); |
| @@ -72,7 +74,8 @@ HostRoomWindow::HostRoomWindow(QWidget* parent, QStandardItemModel* list, | |||
| 72 | if (index != -1) { | 74 | if (index != -1) { |
| 73 | ui->game_list->setCurrentIndex(index); | 75 | ui->game_list->setCurrentIndex(index); |
| 74 | } | 76 | } |
| 75 | ui->room_description->setText(UISettings::values.multiplayer_room_description.GetValue()); | 77 | ui->room_description->setText( |
| 78 | QString::fromStdString(UISettings::values.multiplayer_room_description.GetValue())); | ||
| 76 | } | 79 | } |
| 77 | 80 | ||
| 78 | HostRoomWindow::~HostRoomWindow() = default; | 81 | HostRoomWindow::~HostRoomWindow() = default; |
| @@ -218,8 +221,8 @@ void HostRoomWindow::Host() { | |||
| 218 | Network::NoPreferredIP, password, token); | 221 | Network::NoPreferredIP, password, token); |
| 219 | 222 | ||
| 220 | // Store settings | 223 | // Store settings |
| 221 | UISettings::values.multiplayer_room_nickname = ui->username->text(); | 224 | UISettings::values.multiplayer_room_nickname = ui->username->text().toStdString(); |
| 222 | UISettings::values.multiplayer_room_name = ui->room_name->text(); | 225 | UISettings::values.multiplayer_room_name = ui->room_name->text().toStdString(); |
| 223 | UISettings::values.multiplayer_game_id = | 226 | UISettings::values.multiplayer_game_id = |
| 224 | ui->game_list->currentData(GameListItemPath::ProgramIdRole).toLongLong(); | 227 | ui->game_list->currentData(GameListItemPath::ProgramIdRole).toLongLong(); |
| 225 | UISettings::values.multiplayer_max_player = ui->max_player->value(); | 228 | UISettings::values.multiplayer_max_player = ui->max_player->value(); |
| @@ -230,7 +233,8 @@ void HostRoomWindow::Host() { | |||
| 230 | } else { | 233 | } else { |
| 231 | UISettings::values.multiplayer_room_port = Network::DefaultRoomPort; | 234 | UISettings::values.multiplayer_room_port = Network::DefaultRoomPort; |
| 232 | } | 235 | } |
| 233 | UISettings::values.multiplayer_room_description = ui->room_description->toPlainText(); | 236 | UISettings::values.multiplayer_room_description = |
| 237 | ui->room_description->toPlainText().toStdString(); | ||
| 234 | ui->host->setEnabled(true); | 238 | ui->host->setEnabled(true); |
| 235 | emit SaveConfig(); | 239 | emit SaveConfig(); |
| 236 | close(); | 240 | close(); |
diff --git a/src/yuzu/multiplayer/lobby.cpp b/src/yuzu/multiplayer/lobby.cpp index 387f6f7c9..603e9ae3d 100644 --- a/src/yuzu/multiplayer/lobby.cpp +++ b/src/yuzu/multiplayer/lobby.cpp | |||
| @@ -60,7 +60,8 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list, | |||
| 60 | ui->room_list->setContextMenuPolicy(Qt::CustomContextMenu); | 60 | ui->room_list->setContextMenuPolicy(Qt::CustomContextMenu); |
| 61 | 61 | ||
| 62 | ui->nickname->setValidator(validation.GetNickname()); | 62 | ui->nickname->setValidator(validation.GetNickname()); |
| 63 | ui->nickname->setText(UISettings::values.multiplayer_nickname.GetValue()); | 63 | ui->nickname->setText( |
| 64 | QString::fromStdString(UISettings::values.multiplayer_nickname.GetValue())); | ||
| 64 | 65 | ||
| 65 | // Try find the best nickname by default | 66 | // Try find the best nickname by default |
| 66 | if (ui->nickname->text().isEmpty() || ui->nickname->text() == QStringLiteral("yuzu")) { | 67 | if (ui->nickname->text().isEmpty() || ui->nickname->text() == QStringLiteral("yuzu")) { |
| @@ -202,9 +203,9 @@ void Lobby::OnJoinRoom(const QModelIndex& source) { | |||
| 202 | // TODO(jroweboy): disable widgets and display a connecting while we wait | 203 | // TODO(jroweboy): disable widgets and display a connecting while we wait |
| 203 | 204 | ||
| 204 | // Save settings | 205 | // Save settings |
| 205 | UISettings::values.multiplayer_nickname = ui->nickname->text(); | 206 | UISettings::values.multiplayer_nickname = ui->nickname->text().toStdString(); |
| 206 | UISettings::values.multiplayer_ip = | 207 | UISettings::values.multiplayer_ip = |
| 207 | proxy->data(connection_index, LobbyItemHost::HostIPRole).toString(); | 208 | proxy->data(connection_index, LobbyItemHost::HostIPRole).value<QString>().toStdString(); |
| 208 | UISettings::values.multiplayer_port = | 209 | UISettings::values.multiplayer_port = |
| 209 | proxy->data(connection_index, LobbyItemHost::HostPortRole).toInt(); | 210 | proxy->data(connection_index, LobbyItemHost::HostPortRole).toInt(); |
| 210 | emit SaveConfig(); | 211 | emit SaveConfig(); |
diff --git a/src/yuzu/uisettings.h b/src/yuzu/uisettings.h index 20a517d34..0be8ee369 100644 --- a/src/yuzu/uisettings.h +++ b/src/yuzu/uisettings.h | |||
| @@ -14,6 +14,8 @@ | |||
| 14 | #include "common/common_types.h" | 14 | #include "common/common_types.h" |
| 15 | #include "common/settings.h" | 15 | #include "common/settings.h" |
| 16 | 16 | ||
| 17 | using Settings::Setting; | ||
| 18 | |||
| 17 | namespace UISettings { | 19 | namespace UISettings { |
| 18 | 20 | ||
| 19 | bool IsDarkTheme(); | 21 | bool IsDarkTheme(); |
| @@ -64,30 +66,33 @@ struct Values { | |||
| 64 | QByteArray gamelist_header_state; | 66 | QByteArray gamelist_header_state; |
| 65 | 67 | ||
| 66 | QByteArray microprofile_geometry; | 68 | QByteArray microprofile_geometry; |
| 67 | Settings::Setting<bool> microprofile_visible{false, "microProfileDialogVisible"}; | 69 | Setting<bool> microprofile_visible{false, "microProfileDialogVisible"}; |
| 68 | 70 | ||
| 69 | Settings::Setting<bool> single_window_mode{true, "singleWindowMode"}; | 71 | Setting<bool> single_window_mode{true, "singleWindowMode"}; |
| 70 | Settings::Setting<bool> fullscreen{false, "fullscreen"}; | 72 | Setting<bool> fullscreen{false, "fullscreen"}; |
| 71 | Settings::Setting<bool> display_titlebar{true, "displayTitleBars"}; | 73 | Setting<bool> display_titlebar{true, "displayTitleBars"}; |
| 72 | Settings::Setting<bool> show_filter_bar{true, "showFilterBar"}; | 74 | Setting<bool> show_filter_bar{true, "showFilterBar"}; |
| 73 | Settings::Setting<bool> show_status_bar{true, "showStatusBar"}; | 75 | Setting<bool> show_status_bar{true, "showStatusBar"}; |
| 74 | 76 | ||
| 75 | Settings::Setting<bool> confirm_before_closing{true, "confirmClose"}; | 77 | Setting<bool> confirm_before_closing{true, "confirmClose"}; |
| 76 | Settings::Setting<bool> first_start{true, "firstStart"}; | 78 | Setting<bool> first_start{true, "firstStart"}; |
| 77 | Settings::Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; | 79 | Setting<bool> pause_when_in_background{false, "pauseWhenInBackground"}; |
| 78 | Settings::Setting<bool> mute_when_in_background{false, "muteWhenInBackground"}; | 80 | Setting<bool> mute_when_in_background{false, "muteWhenInBackground"}; |
| 79 | Settings::Setting<bool> hide_mouse{true, "hideInactiveMouse"}; | 81 | Setting<bool> hide_mouse{true, "hideInactiveMouse"}; |
| 80 | Settings::Setting<bool> controller_applet_disabled{false, "disableControllerApplet"}; | 82 | Setting<bool> controller_applet_disabled{false, "disableControllerApplet"}; |
| 81 | |||
| 82 | // Set when Vulkan is known to crash the application | 83 | // Set when Vulkan is known to crash the application |
| 83 | bool has_broken_vulkan = false; | 84 | bool has_broken_vulkan = false; |
| 84 | 85 | ||
| 85 | Settings::Setting<bool> select_user_on_boot{false, "select_user_on_boot"}; | 86 | Setting<bool> select_user_on_boot{false, "select_user_on_boot"}; |
| 87 | Setting<bool> disable_web_applet{true, "disable_web_applet"}; | ||
| 86 | 88 | ||
| 87 | // Discord RPC | 89 | // Discord RPC |
| 88 | Settings::Setting<bool> enable_discord_presence{true, "enable_discord_presence"}; | 90 | Setting<bool> enable_discord_presence{true, "enable_discord_presence"}; |
| 89 | 91 | ||
| 90 | Settings::Setting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"}; | 92 | // logging |
| 93 | Setting<bool> show_console{false, "showConsole"}; | ||
| 94 | |||
| 95 | Setting<bool> enable_screenshot_save_as{true, "enable_screenshot_save_as"}; | ||
| 91 | 96 | ||
| 92 | QString roms_path; | 97 | QString roms_path; |
| 93 | QString symbols_path; | 98 | QString symbols_path; |
| @@ -102,47 +107,42 @@ struct Values { | |||
| 102 | // Shortcut name <Shortcut, context> | 107 | // Shortcut name <Shortcut, context> |
| 103 | std::vector<Shortcut> shortcuts; | 108 | std::vector<Shortcut> shortcuts; |
| 104 | 109 | ||
| 105 | Settings::Setting<uint32_t> callout_flags{0, "calloutFlags"}; | 110 | Setting<u32> callout_flags{0, "calloutFlags"}; |
| 106 | 111 | ||
| 107 | // multiplayer settings | 112 | // multiplayer settings |
| 108 | Settings::Setting<QString> multiplayer_nickname{{}, "nickname"}; | 113 | Setting<std::string> multiplayer_nickname{{}, "nickname"}; |
| 109 | Settings::Setting<QString> multiplayer_ip{{}, "ip"}; | 114 | Setting<std::string> multiplayer_ip{{}, "ip"}; |
| 110 | Settings::SwitchableSetting<uint, true> multiplayer_port{24872, 0, UINT16_MAX, "port"}; | 115 | Setting<u16, true> multiplayer_port{24872, 0, UINT16_MAX, "port"}; |
| 111 | Settings::Setting<QString> multiplayer_room_nickname{{}, "room_nickname"}; | 116 | Setting<std::string> multiplayer_room_nickname{{}, "room_nickname"}; |
| 112 | Settings::Setting<QString> multiplayer_room_name{{}, "room_name"}; | 117 | Setting<std::string> multiplayer_room_name{{}, "room_name"}; |
| 113 | Settings::SwitchableSetting<uint, true> multiplayer_max_player{8, 0, 8, "max_player"}; | 118 | Setting<u8, true> multiplayer_max_player{8, 0, 8, "max_player"}; |
| 114 | Settings::SwitchableSetting<uint, true> multiplayer_room_port{24872, 0, UINT16_MAX, | 119 | Setting<u16, true> multiplayer_room_port{24872, 0, UINT16_MAX, "room_port"}; |
| 115 | "room_port"}; | 120 | Setting<u8, true> multiplayer_host_type{0, 0, 1, "host_type"}; |
| 116 | Settings::SwitchableSetting<uint, true> multiplayer_host_type{0, 0, 1, "host_type"}; | 121 | Setting<unsigned long long> multiplayer_game_id{{}, "game_id"}; |
| 117 | Settings::Setting<qulonglong> multiplayer_game_id{{}, "game_id"}; | 122 | Setting<std::string> multiplayer_room_description{{}, "room_description"}; |
| 118 | Settings::Setting<QString> multiplayer_room_description{{}, "room_description"}; | ||
| 119 | std::pair<std::vector<std::string>, std::vector<std::string>> multiplayer_ban_list; | 123 | std::pair<std::vector<std::string>, std::vector<std::string>> multiplayer_ban_list; |
| 120 | 124 | ||
| 121 | // logging | ||
| 122 | Settings::Setting<bool> show_console{false, "showConsole"}; | ||
| 123 | |||
| 124 | // Game List | 125 | // Game List |
| 125 | Settings::Setting<bool> show_add_ons{true, "show_add_ons"}; | 126 | Setting<bool> show_add_ons{true, "show_add_ons"}; |
| 126 | Settings::Setting<uint32_t> game_icon_size{64, "game_icon_size"}; | 127 | Setting<u32> game_icon_size{64, "game_icon_size"}; |
| 127 | Settings::Setting<uint32_t> folder_icon_size{48, "folder_icon_size"}; | 128 | Setting<u32> folder_icon_size{48, "folder_icon_size"}; |
| 128 | Settings::Setting<uint8_t> row_1_text_id{3, "row_1_text_id"}; | 129 | Setting<u8> row_1_text_id{3, "row_1_text_id"}; |
| 129 | Settings::Setting<uint8_t> row_2_text_id{2, "row_2_text_id"}; | 130 | Setting<u8> row_2_text_id{2, "row_2_text_id"}; |
| 130 | std::atomic_bool is_game_list_reload_pending{false}; | 131 | std::atomic_bool is_game_list_reload_pending{false}; |
| 131 | Settings::Setting<bool> cache_game_list{true, "cache_game_list"}; | 132 | Setting<bool> cache_game_list{true, "cache_game_list"}; |
| 132 | Settings::Setting<bool> favorites_expanded{true, "favorites_expanded"}; | 133 | Setting<bool> favorites_expanded{true, "favorites_expanded"}; |
| 133 | QVector<u64> favorited_ids; | 134 | QVector<u64> favorited_ids; |
| 134 | 135 | ||
| 135 | // Compatibility List | 136 | // Compatibility List |
| 136 | Settings::Setting<bool> show_compat{false, "show_compat"}; | 137 | Setting<bool> show_compat{false, "show_compat"}; |
| 137 | 138 | ||
| 138 | // Size & File Types Column | 139 | // Size & File Types Column |
| 139 | Settings::Setting<bool> show_size{true, "show_size"}; | 140 | Setting<bool> show_size{true, "show_size"}; |
| 140 | Settings::Setting<bool> show_types{true, "show_types"}; | 141 | Setting<bool> show_types{true, "show_types"}; |
| 141 | 142 | ||
| 142 | bool configuration_applied; | 143 | bool configuration_applied; |
| 143 | bool reset_to_defaults; | 144 | bool reset_to_defaults; |
| 144 | bool shortcut_already_warned{false}; | 145 | bool shortcut_already_warned{false}; |
| 145 | Settings::Setting<bool> disable_web_applet{true, "disable_web_applet"}; | ||
| 146 | }; | 146 | }; |
| 147 | 147 | ||
| 148 | extern Values values; | 148 | extern Values values; |