summary refs log tree commit diff stats
path: root/data/maps/the_bearer/rooms/Overlook.txtpb
Commit message (Collapse)AuthorAgeFilesLines
* Added the_bearerStar Rauchenberger2025-08-081-0/+2
tle='Blame the previous revision' href='/lingo-ap-tracker/blame/connection_dialog.cpp?id=22014b967d0d9651b72bffbe02aba75dc98180a4'>^
6d6f5db ^


ba59d40 ^
6d6f5db ^


ba59d40 ^
d0029a8 ^
6d6f5db ^

ba59d40 ^
116ba41 ^
ba59d40 ^

116ba41 ^













d0029a8 ^
6d6f5db ^

d0029a8 ^
6d6f5db ^
d0029a8 ^
6d6f5db ^
d0029a8 ^




6d6f5db ^

d0029a8 ^





116ba41 ^



d0029a8 ^
6d6f5db ^

116ba41 ^



a3eaefc ^
116ba41 ^
d0029a8 ^


6d6f5db ^




d0029a8 ^

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78

                              

                           

                                                             


                                                                          
                                                   


                                                                          
                                                   
                                 

                                                                            
                                                   
 

                                                       













                                                                     
                                          

                                               
                          
                                                          
                         
                                                          




                                        

                                                                              





                                                                       



                                                                               
                                                                    

                                                    



                            
                          
 


                                                                 




                                                                     

   
#include "connection_dialog.h"

#include "tracker_config.h"

ConnectionDialog::ConnectionDialog()
    : wxDialog(nullptr, wxID_ANY, "Connect to Archipelago") {
  server_box_ = new wxTextCtrl(
      this, -1,
      wxString::FromUTF8(GetTrackerConfig().connection_details.ap_server),
      wxDefaultPosition, FromDIP(wxSize{300, -1}));
  player_box_ = new wxTextCtrl(
      this, -1,
      wxString::FromUTF8(GetTrackerConfig().connection_details.ap_player),
      wxDefaultPosition, FromDIP(wxSize{300, -1}));
  password_box_ = new wxTextCtrl(
      this, -1,
      wxString::FromUTF8(GetTrackerConfig().connection_details.ap_password),
      wxDefaultPosition, FromDIP(wxSize{300, -1}));

  wxFlexGridSizer* form_sizer =
      new wxFlexGridSizer(2, FromDIP(10), FromDIP(10));

  form_sizer->Add(
      new wxStaticText(this, -1, "Server:"),
      wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
  form_sizer->Add(server_box_, wxSizerFlags().Expand());
  form_sizer->Add(
      new wxStaticText(this, -1, "Player:"),
      wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
  form_sizer->Add(player_box_, wxSizerFlags().Expand());
  form_sizer->Add(
      new wxStaticText(this, -1, "Password:"),
      wxSizerFlags().Align(wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT));
  form_sizer->Add(password_box_, wxSizerFlags().Expand());

  history_list_ = new wxListBox(this, -1);
  for (const ConnectionDetails& details :
       GetTrackerConfig().connection_history) {
    wxString display_text;
    display_text << wxString::FromUTF8(details.ap_player);
    display_text << " (";
    display_text << wxString::FromUTF8(details.ap_server);
    display_text << ")";

    history_list_->Append(display_text);
  }

  history_list_->Bind(wxEVT_LISTBOX, &ConnectionDialog::OnOldConnectionChosen,
                      this);

  wxBoxSizer* mid_sizer = new wxBoxSizer(wxHORIZONTAL);
  mid_sizer->Add(form_sizer, wxSizerFlags().Proportion(3).Expand());
  mid_sizer->AddSpacer(10);
  mid_sizer->Add(history_list_, wxSizerFlags().Proportion(2).Expand());

  wxBoxSizer* top_sizer = new wxBoxSizer(wxVERTICAL);
  top_sizer->Add(new wxStaticText(
                     this, -1, "Enter the details to connect to Archipelago."),
                 wxSizerFlags().Align(wxALIGN_LEFT).DoubleBorder());
  top_sizer->Add(mid_sizer, wxSizerFlags().DoubleBorder().Expand());
  top_sizer->Add(CreateButtonSizer(wxOK | wxCANCEL),
                 wxSizerFlags().Border().Center());

  SetSizerAndFit(top_sizer);

  Center();
  server_box_->SetFocus();
}

void ConnectionDialog::OnOldConnectionChosen(wxCommandEvent& e) {
  if (e.IsSelection()) {
    const ConnectionDetails& details =
        GetTrackerConfig().connection_history.at(e.GetSelection());
    server_box_->SetValue(wxString::FromUTF8(details.ap_server));
    player_box_->SetValue(wxString::FromUTF8(details.ap_player));
    password_box_->SetValue(wxString::FromUTF8(details.ap_password));
  }
}