From 943e661af4b2a98a6bb4c0a8cb486e7849d1a4ef Mon Sep 17 00:00:00 2001 From: h0neybadger Date: Fri, 25 Dec 2020 10:08:36 +0100 Subject: [PATCH] Update switch gui HostInterface class to inherit from brls::List --- switch/include/gui.h | 8 +++----- switch/src/gui.cpp | 13 ++++++------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/switch/include/gui.h b/switch/include/gui.h index 246d743..3a81833 100644 --- a/switch/include/gui.h +++ b/switch/include/gui.h @@ -19,17 +19,15 @@ #include "discoverymanager.h" #include "io.h" -class HostInterface +class HostInterface : public brls::List { private: - brls::TabFrame * root; IO * io; Host * host; Settings * settings; - brls::List * hostList; bool connected = false; public: - HostInterface(brls::List * hostList, IO * io, Host * host, Settings * settings); + HostInterface(IO * io, Host * host, Settings * settings); ~HostInterface(); static void Register(IO * io, Host * host, @@ -52,7 +50,7 @@ class MainApplication DiscoveryManager * discoverymanager; IO * io; brls::TabFrame * rootFrame; - std::map host_menuitems; + std::map host_menuitems; // add_host local settings std::string remote_display_name = ""; std::string remote_addr = ""; diff --git a/switch/src/gui.cpp b/switch/src/gui.cpp index afef09e..7193f9b 100644 --- a/switch/src/gui.cpp +++ b/switch/src/gui.cpp @@ -21,21 +21,21 @@ using namespace brls::i18n::literals; // for _i18n brls::Logger::info("Dialog: {0}", r); -HostInterface::HostInterface(brls::List * hostList, IO * io, Host * host, Settings * settings) - : hostList(hostList), io(io), host(host), settings(settings) +HostInterface::HostInterface(IO * io, Host * host, Settings * settings) + : io(io), host(host), settings(settings) { brls::ListItem* connect = new brls::ListItem("Connect"); connect->getClickEvent()->subscribe(std::bind(&HostInterface::Connect, this, std::placeholders::_1)); - this->hostList->addView(connect); + this->addView(connect); brls::ListItem* wakeup = new brls::ListItem("Wakeup"); wakeup->getClickEvent()->subscribe(std::bind(&HostInterface::Wakeup, this, std::placeholders::_1)); - this->hostList->addView(wakeup); + this->addView(wakeup); // message delimiter brls::Label* info = new brls::Label(brls::LabelStyle::REGULAR, "Host configuration", true); - this->hostList->addView(info); + this->addView(info); // push opengl chiaki stream // when the host is connected @@ -313,10 +313,9 @@ bool MainApplication::Load() if(this->host_menuitems.find(&it->second) == this->host_menuitems.end() && (it->second.HasRPkey() == true || it->second.IsDiscovered() == true)) { - brls::List* new_host = new brls::List(); + HostInterface * new_host = new HostInterface(this->io, &it->second, this->settings); this->host_menuitems[&it->second] = new_host; // create host if udefined - HostInterface host_menu = HostInterface(new_host, this->io, &it->second, this->settings); BuildConfigurationMenu(new_host, &it->second); this->rootFrame->addTab(it->second.GetHostName().c_str(), new_host); }