diff options
author | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-03 11:20:59 -0500 |
---|---|---|
committer | Star Rauchenberger <fefferburbia@gmail.com> | 2025-03-03 11:20:59 -0500 |
commit | 6d6f5dbf8c8e39aa0cf641a932d4da12200160fe (patch) | |
tree | 7ce1551c0c80d83af36b48ddf18274232514370f /src/connection_dialog.cpp | |
parent | 969919119acd83320c4deb621a60ce6f36ff9583 (diff) | |
download | lingo-ap-tracker-6d6f5dbf8c8e39aa0cf641a932d4da12200160fe.tar.gz lingo-ap-tracker-6d6f5dbf8c8e39aa0cf641a932d4da12200160fe.tar.bz2 lingo-ap-tracker-6d6f5dbf8c8e39aa0cf641a932d4da12200160fe.zip |
Handle unicode conversion between wx and rest of app
Diffstat (limited to 'src/connection_dialog.cpp')
-rw-r--r-- | src/connection_dialog.cpp | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/src/connection_dialog.cpp b/src/connection_dialog.cpp index 64fee98..45a5b53 100644 --- a/src/connection_dialog.cpp +++ b/src/connection_dialog.cpp | |||
@@ -4,14 +4,17 @@ | |||
4 | 4 | ||
5 | ConnectionDialog::ConnectionDialog() | 5 | ConnectionDialog::ConnectionDialog() |
6 | : wxDialog(nullptr, wxID_ANY, "Connect to Archipelago") { | 6 | : wxDialog(nullptr, wxID_ANY, "Connect to Archipelago") { |
7 | server_box_ = | 7 | server_box_ = new wxTextCtrl( |
8 | new wxTextCtrl(this, -1, GetTrackerConfig().connection_details.ap_server, | 8 | this, -1, |
9 | wxDefaultPosition, {300, -1}); | 9 | wxString::FromUTF8(GetTrackerConfig().connection_details.ap_server), |
10 | player_box_ = | 10 | wxDefaultPosition, {300, -1}); |
11 | new wxTextCtrl(this, -1, GetTrackerConfig().connection_details.ap_player, | 11 | player_box_ = new wxTextCtrl( |
12 | wxDefaultPosition, {300, -1}); | 12 | this, -1, |
13 | wxString::FromUTF8(GetTrackerConfig().connection_details.ap_player), | ||
14 | wxDefaultPosition, {300, -1}); | ||
13 | password_box_ = new wxTextCtrl( | 15 | password_box_ = new wxTextCtrl( |
14 | this, -1, GetTrackerConfig().connection_details.ap_password, | 16 | this, -1, |
17 | wxString::FromUTF8(GetTrackerConfig().connection_details.ap_password), | ||
15 | wxDefaultPosition, {300, -1}); | 18 | wxDefaultPosition, {300, -1}); |
16 | 19 | ||
17 | wxFlexGridSizer* form_sizer = new wxFlexGridSizer(2, 10, 10); | 20 | wxFlexGridSizer* form_sizer = new wxFlexGridSizer(2, 10, 10); |
@@ -30,17 +33,19 @@ ConnectionDialog::ConnectionDialog() | |||
30 | form_sizer->Add(password_box_, wxSizerFlags().Expand()); | 33 | form_sizer->Add(password_box_, wxSizerFlags().Expand()); |
31 | 34 | ||
32 | history_list_ = new wxListBox(this, -1); | 35 | history_list_ = new wxListBox(this, -1); |
33 | for (const ConnectionDetails& details : GetTrackerConfig().connection_history) { | 36 | for (const ConnectionDetails& details : |
37 | GetTrackerConfig().connection_history) { | ||
34 | wxString display_text; | 38 | wxString display_text; |
35 | display_text << details.ap_player; | 39 | display_text << wxString::FromUTF8(details.ap_player); |
36 | display_text << " ("; | 40 | display_text << " ("; |
37 | display_text << details.ap_server; | 41 | display_text << wxString::FromUTF8(details.ap_server); |
38 | display_text << ")"; | 42 | display_text << ")"; |
39 | 43 | ||
40 | history_list_->Append(display_text); | 44 | history_list_->Append(display_text); |
41 | } | 45 | } |
42 | 46 | ||
43 | history_list_->Bind(wxEVT_LISTBOX, &ConnectionDialog::OnOldConnectionChosen, this); | 47 | history_list_->Bind(wxEVT_LISTBOX, &ConnectionDialog::OnOldConnectionChosen, |
48 | this); | ||
44 | 49 | ||
45 | wxBoxSizer* mid_sizer = new wxBoxSizer(wxHORIZONTAL); | 50 | wxBoxSizer* mid_sizer = new wxBoxSizer(wxHORIZONTAL); |
46 | mid_sizer->Add(form_sizer, wxSizerFlags().Proportion(3).Expand()); | 51 | mid_sizer->Add(form_sizer, wxSizerFlags().Proportion(3).Expand()); |
@@ -52,7 +57,8 @@ ConnectionDialog::ConnectionDialog() | |||
52 | this, -1, "Enter the details to connect to Archipelago."), | 57 | this, -1, "Enter the details to connect to Archipelago."), |
53 | wxSizerFlags().Align(wxALIGN_LEFT).DoubleBorder()); | 58 | wxSizerFlags().Align(wxALIGN_LEFT).DoubleBorder()); |
54 | top_sizer->Add(mid_sizer, wxSizerFlags().DoubleBorder().Expand()); | 59 | top_sizer->Add(mid_sizer, wxSizerFlags().DoubleBorder().Expand()); |
55 | top_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), wxSizerFlags().Border().Center()); | 60 | top_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL), |
61 | wxSizerFlags().Border().Center()); | ||
56 | 62 | ||
57 | SetSizerAndFit(top_sizer); | 63 | SetSizerAndFit(top_sizer); |
58 | 64 | ||
@@ -62,9 +68,10 @@ ConnectionDialog::ConnectionDialog() | |||
62 | 68 | ||
63 | void ConnectionDialog::OnOldConnectionChosen(wxCommandEvent& e) { | 69 | void ConnectionDialog::OnOldConnectionChosen(wxCommandEvent& e) { |
64 | if (e.IsSelection()) { | 70 | if (e.IsSelection()) { |
65 | const ConnectionDetails& details = GetTrackerConfig().connection_history.at(e.GetSelection()); | 71 | const ConnectionDetails& details = |
66 | server_box_->SetValue(details.ap_server); | 72 | GetTrackerConfig().connection_history.at(e.GetSelection()); |
67 | player_box_->SetValue(details.ap_player); | 73 | server_box_->SetValue(wxString::FromUTF8(details.ap_server)); |
68 | password_box_->SetValue(details.ap_password); | 74 | player_box_->SetValue(wxString::FromUTF8(details.ap_player)); |
75 | password_box_->SetValue(wxString::FromUTF8(details.ap_password)); | ||
69 | } | 76 | } |
70 | } | 77 | } |