mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-20 05:23:12 -07:00
Update switch gui HostInterface class to inherit from brls::List
This commit is contained in:
parent
7378b31bc1
commit
943e661af4
2 changed files with 9 additions and 12 deletions
|
@ -19,17 +19,15 @@
|
||||||
#include "discoverymanager.h"
|
#include "discoverymanager.h"
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
class HostInterface
|
class HostInterface : public brls::List
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
brls::TabFrame * root;
|
|
||||||
IO * io;
|
IO * io;
|
||||||
Host * host;
|
Host * host;
|
||||||
Settings * settings;
|
Settings * settings;
|
||||||
brls::List * hostList;
|
|
||||||
bool connected = false;
|
bool connected = false;
|
||||||
public:
|
public:
|
||||||
HostInterface(brls::List * hostList, IO * io, Host * host, Settings * settings);
|
HostInterface(IO * io, Host * host, Settings * settings);
|
||||||
~HostInterface();
|
~HostInterface();
|
||||||
|
|
||||||
static void Register(IO * io, Host * host,
|
static void Register(IO * io, Host * host,
|
||||||
|
@ -52,7 +50,7 @@ class MainApplication
|
||||||
DiscoveryManager * discoverymanager;
|
DiscoveryManager * discoverymanager;
|
||||||
IO * io;
|
IO * io;
|
||||||
brls::TabFrame * rootFrame;
|
brls::TabFrame * rootFrame;
|
||||||
std::map<Host *, brls::List *> host_menuitems;
|
std::map<Host *, HostInterface *> host_menuitems;
|
||||||
// add_host local settings
|
// add_host local settings
|
||||||
std::string remote_display_name = "";
|
std::string remote_display_name = "";
|
||||||
std::string remote_addr = "";
|
std::string remote_addr = "";
|
||||||
|
|
|
@ -21,21 +21,21 @@ using namespace brls::i18n::literals; // for _i18n
|
||||||
brls::Logger::info("Dialog: {0}", r);
|
brls::Logger::info("Dialog: {0}", r);
|
||||||
|
|
||||||
|
|
||||||
HostInterface::HostInterface(brls::List * hostList, IO * io, Host * host, Settings * settings)
|
HostInterface::HostInterface(IO * io, Host * host, Settings * settings)
|
||||||
: hostList(hostList), io(io), host(host), settings(settings)
|
: io(io), host(host), settings(settings)
|
||||||
{
|
{
|
||||||
brls::ListItem* connect = new brls::ListItem("Connect");
|
brls::ListItem* connect = new brls::ListItem("Connect");
|
||||||
connect->getClickEvent()->subscribe(std::bind(&HostInterface::Connect, this, std::placeholders::_1));
|
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");
|
brls::ListItem* wakeup = new brls::ListItem("Wakeup");
|
||||||
wakeup->getClickEvent()->subscribe(std::bind(&HostInterface::Wakeup, this, std::placeholders::_1));
|
wakeup->getClickEvent()->subscribe(std::bind(&HostInterface::Wakeup, this, std::placeholders::_1));
|
||||||
this->hostList->addView(wakeup);
|
this->addView(wakeup);
|
||||||
|
|
||||||
// message delimiter
|
// message delimiter
|
||||||
brls::Label* info = new brls::Label(brls::LabelStyle::REGULAR,
|
brls::Label* info = new brls::Label(brls::LabelStyle::REGULAR,
|
||||||
"Host configuration", true);
|
"Host configuration", true);
|
||||||
this->hostList->addView(info);
|
this->addView(info);
|
||||||
|
|
||||||
// push opengl chiaki stream
|
// push opengl chiaki stream
|
||||||
// when the host is connected
|
// when the host is connected
|
||||||
|
@ -313,10 +313,9 @@ bool MainApplication::Load()
|
||||||
if(this->host_menuitems.find(&it->second) == this->host_menuitems.end()
|
if(this->host_menuitems.find(&it->second) == this->host_menuitems.end()
|
||||||
&& (it->second.HasRPkey() == true || it->second.IsDiscovered() == true))
|
&& (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;
|
this->host_menuitems[&it->second] = new_host;
|
||||||
// create host if udefined
|
// create host if udefined
|
||||||
HostInterface host_menu = HostInterface(new_host, this->io, &it->second, this->settings);
|
|
||||||
BuildConfigurationMenu(new_host, &it->second);
|
BuildConfigurationMenu(new_host, &it->second);
|
||||||
this->rootFrame->addTab(it->second.GetHostName().c_str(), new_host);
|
this->rootFrame->addTab(it->second.GetHostName().c_str(), new_host);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue