about summary refs log tree commit diff stats
path: root/src/tracker_frame.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-03-07 10:31:22 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2024-03-17 12:51:07 -0400
commitd532e4937fbf9c1d1458f9bdfb02ed54c50122c3 (patch)
treea597d9d46f722244ec1dcf8d0e80b5fda31354c6 /src/tracker_frame.cpp
parente07e0318666e9b05b2a78b7de0979d5706cc28b7 (diff)
downloadlingo-ap-tracker-d532e4937fbf9c1d1458f9bdfb02ed54c50122c3.tar.gz
lingo-ap-tracker-d532e4937fbf9c1d1458f9bdfb02ed54c50122c3.tar.bz2
lingo-ap-tracker-d532e4937fbf9c1d1458f9bdfb02ed54c50122c3.zip
Added connection history
Diffstat (limited to 'src/tracker_frame.cpp')
-rw-r--r--src/tracker_frame.cpp21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/tracker_frame.cpp b/src/tracker_frame.cpp index a8c1063..d64e0d3 100644 --- a/src/tracker_frame.cpp +++ b/src/tracker_frame.cpp
@@ -115,9 +115,24 @@ void TrackerFrame::OnConnect(wxCommandEvent &event) {
115 ConnectionDialog dlg; 115 ConnectionDialog dlg;
116 116
117 if (dlg.ShowModal() == wxID_OK) { 117 if (dlg.ShowModal() == wxID_OK) {
118 GetTrackerConfig().ap_server = dlg.GetServerValue(); 118 GetTrackerConfig().connection_details.ap_server = dlg.GetServerValue();
119 GetTrackerConfig().ap_player = dlg.GetPlayerValue(); 119 GetTrackerConfig().connection_details.ap_player = dlg.GetPlayerValue();
120 GetTrackerConfig().ap_password = dlg.GetPasswordValue(); 120 GetTrackerConfig().connection_details.ap_password = dlg.GetPasswordValue();
121
122 std::deque<ConnectionDetails> new_history;
123 new_history.push_back(GetTrackerConfig().connection_details);
124
125 for (const ConnectionDetails& details : GetTrackerConfig().connection_history) {
126 if (details != GetTrackerConfig().connection_details) {
127 new_history.push_back(details);
128 }
129 }
130
131 while (new_history.size() > 5) {
132 new_history.pop_back();
133 }
134
135 GetTrackerConfig().connection_history = std::move(new_history);
121 GetTrackerConfig().Save(); 136 GetTrackerConfig().Save();
122 137
123 AP_Connect(dlg.GetServerValue(), dlg.GetPlayerValue(), 138 AP_Connect(dlg.GetServerValue(), dlg.GetPlayerValue(),