From 116ba412079ddf647d19a54d09eb61e67a2f9aac Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Tue, 2 May 2023 15:21:29 -0400 Subject: Tracker connects to AP now --- tracker_frame.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'tracker_frame.cpp') diff --git a/tracker_frame.cpp b/tracker_frame.cpp index b33cce9..d58dfe8 100644 --- a/tracker_frame.cpp +++ b/tracker_frame.cpp @@ -1,14 +1,21 @@ #include "tracker_frame.h" +#include "ap_state.h" +#include "connection_dialog.h" #include "tracker_panel.h" +enum TrackerFrameIds { ID_CONNECT = 1 }; + TrackerFrame::TrackerFrame() : wxFrame(nullptr, wxID_ANY, "Lingo Archipelago Tracker") { ::wxInitAllImageHandlers(); + GetAPState().SetTrackerFrame(this); + SetSize(1280, 728); wxMenu *menuFile = new wxMenu(); + menuFile->Append(ID_CONNECT, "&Connect"); menuFile->Append(wxID_EXIT); wxMenu *menuHelp = new wxMenu(); @@ -25,13 +32,27 @@ TrackerFrame::TrackerFrame() Bind(wxEVT_MENU, &TrackerFrame::OnAbout, this, wxID_ABOUT); Bind(wxEVT_MENU, &TrackerFrame::OnExit, this, wxID_EXIT); + Bind(wxEVT_MENU, &TrackerFrame::OnConnect, this, ID_CONNECT); new TrackerPanel(this); } +void TrackerFrame::SetStatusMessage(std::string message) { + SetStatusText(message); +} + void TrackerFrame::OnAbout(wxCommandEvent &event) { wxMessageBox("Lingo Archipelago Tracker by hatkirby", "About lingo-ap-tracker", wxOK | wxICON_INFORMATION); } void TrackerFrame::OnExit(wxCommandEvent &event) { Close(true); } + +void TrackerFrame::OnConnect(wxCommandEvent &event) { + ConnectionDialog dlg; + + if (dlg.ShowModal() == wxID_OK) { + GetAPState().Connect(dlg.GetServerValue(), dlg.GetPlayerValue(), + dlg.GetPasswordValue()); + } +} -- cgit 1.4.1