summaryrefslogtreecommitdiffstats
path: root/src/libs/gui/ConnectWindow.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-19 18:51:06 +0000
committerDavid Robillard <d@drobilla.net>2008-08-19 18:51:06 +0000
commite16206982d074e62956de00eeef611478f01c430 (patch)
tree388bc6e5ad9220cf9cdedf865a2d45856f418ae4 /src/libs/gui/ConnectWindow.cpp
parent14764da12f3808da0c40b643ac8224716f060729 (diff)
downloadingen-e16206982d074e62956de00eeef611478f01c430.tar.gz
ingen-e16206982d074e62956de00eeef611478f01c430.tar.bz2
ingen-e16206982d074e62956de00eeef611478f01c430.zip
Preliminary connecting via HTTP in Gtk client.
Better handling of overflowed client event receive buffer. Store fixes, complain only once about orphans, don't request an orphan parent over and over. git-svn-id: http://svn.drobilla.net/lad/ingen@1447 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui/ConnectWindow.cpp')
-rw-r--r--src/libs/gui/ConnectWindow.cpp26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/libs/gui/ConnectWindow.cpp b/src/libs/gui/ConnectWindow.cpp
index 03f8408a..eb095af5 100644
--- a/src/libs/gui/ConnectWindow.cpp
+++ b/src/libs/gui/ConnectWindow.cpp
@@ -29,6 +29,7 @@
#include "engine/Engine.hpp"
#include "engine/QueuedEngineInterface.hpp"
#include "client/OSCClientReceiver.hpp"
+#include "client/HTTPClientReceiver.hpp"
#include "client/OSCEngineSender.hpp"
#include "client/ThreadedSigClientInterface.hpp"
#include "client/ClientStore.hpp"
@@ -143,7 +144,9 @@ ConnectWindow::set_connecting_widget_states()
void
ConnectWindow::connect(bool existing)
{
- assert(!_attached);
+ if (_attached)
+ _attached = false;
+
assert(!App::instance().client());
_connect_stage = 0;
@@ -153,15 +156,22 @@ ConnectWindow::connect(bool existing)
if (_mode == CONNECT_REMOTE) {
if (!existing) {
- const string url = (_widgets_loaded ? _url_entry->get_text() : "osc.udp://localhost:16180");
+ const string url = (_widgets_loaded ? (string)_url_entry->get_text() : world->engine->uri());
world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(url));
}
-
- // FIXME: static args
+
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
- SharedPtr<OSCClientReceiver> client(new OSCClientReceiver(16181, tsci));
- App::instance().attach(tsci, client);
+ SharedPtr<Raul::Deletable> client;
+
+ const string& uri = world->engine->uri();
+ const string& scheme = uri.substr(0, uri.find(":"));
+ if (scheme == "osc.udp" || scheme == "osc.tcp")
+ client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci)); // FIXME: port
+ else if (scheme == "http")
+ client = SharedPtr<HTTPClientReceiver>(new HTTPClientReceiver(world, uri, tsci));
+ App::instance().attach(tsci, client);
+
Glib::signal_timeout().connect(
sigc::mem_fun(App::instance(), &App::gtk_main_iteration), 40, G_PRIORITY_DEFAULT);
@@ -377,7 +387,7 @@ ConnectWindow::gtk_callback()
assert(App::instance().client());
App::instance().client()->signal_response_ok.connect(
- sigc::mem_fun(this, &ConnectWindow::response_ok_received));
+ sigc::mem_fun(this, &ConnectWindow::on_response));
_ping_id = abs(rand()) / 2 * 2; // avoid -1
App::instance().engine()->set_next_response_id(_ping_id);
@@ -391,7 +401,7 @@ ConnectWindow::gtk_callback()
++_connect_stage;
} else if (_connect_stage == 1) {
- if (_attached) {
+ if (_attached || App::instance().client()->enabled()) {
App::instance().engine()->activate();
++_connect_stage;
} else {