]> git.tdb.fi Git - r2c2.git/blob - source/remote/connectdialog.cpp
Add a new remote control program with GLtk-based UI
[r2c2.git] / source / remote / connectdialog.cpp
1 #include <msp/core/maputils.h>
2 #include <msp/net/inet.h>
3 #include <msp/net/resolve.h>
4 #include "connectdialog.h"
5
6 using namespace Msp;
7 using namespace R2C2;
8
9 ConnectDialog::ConnectDialog(Client &c):
10         client(c)
11 {
12         Loader::WidgetMap widgets;
13         DataFile::load(*this, "data/remote/connectdialog.ui", widgets);
14
15         ent_host = dynamic_cast<GLtk::Entry *>(get_item(widgets, "ent_host"));
16         ent_port = dynamic_cast<GLtk::Entry *>(get_item(widgets, "ent_port"));
17         ent_port->set_text("8315");
18 }
19
20 void ConnectDialog::on_response(int)
21 {
22         Net::SockAddr *addr = Net::resolve(ent_host->get_text(), ent_port->get_text(), Net::INET);
23         client.connect(*addr);
24         delete addr;
25 }