| 267 | } |
| 268 | |
| 269 | void onTextInput(WidgetIndex widgetIndex, std::string_view text) override |
| 270 | { |
| 271 | if (text.empty()) |
| 272 | return; |
| 273 | |
| 274 | auto temp = u8string{ text }; |
| 275 | |
| 276 | switch (widgetIndex) |
| 277 | { |
| 278 | case WIDX_PLAYER_NAME_INPUT: |
| 279 | if (_playerName == text) |
| 280 | return; |
| 281 | |
| 282 | _playerName = temp; |
| 283 | Config::Get().network.playerName = _playerName; |
| 284 | widgets[WIDX_PLAYER_NAME_INPUT].string = const_cast<utf8*>(_playerName.c_str()); |
| 285 | |
| 286 | invalidateWidget(WIDX_PLAYER_NAME_INPUT); |
| 287 | break; |
| 288 | |
| 289 | case WIDX_ADD_SERVER: |
| 290 | { |
| 291 | Network::ServerListEntry entry; |
| 292 | entry.Address = text; |
| 293 | entry.Name = text; |
| 294 | entry.Favourite = true; |
| 295 | _serverList.Add(entry); |
| 296 | _serverList.WriteFavourites(); |
| 297 | invalidate(); |
| 298 | break; |
| 299 | } |
| 300 | } |
| 301 | } |
| 302 | |
| 303 | StringWithArgs onTooltip(WidgetIndex widgetIndex, StringId fallback) override |
| 304 | { |
nothing calls this directly
no test coverage detected