summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-29 03:48:09 +0000
committerDavid Robillard <d@drobilla.net>2009-05-29 03:48:09 +0000
commit90386cd6f49e2e9bfb11e7596ae6ce3ac51dfe16 (patch)
treee9d47b4de18f266691b13d63e58fedcdba398bc4 /src/gui
parent5245a25bafec9372d07c346457d473cfa76724df (diff)
downloadingen-90386cd6f49e2e9bfb11e7596ae6ce3ac51dfe16.tar.gz
ingen-90386cd6f49e2e9bfb11e7596ae6ce3ac51dfe16.tar.bz2
ingen-90386cd6f49e2e9bfb11e7596ae6ce3ac51dfe16.zip
Fix reconnecting to engine via various protocols (inferred from user URI) in GUI.
Separate HTTP client receiver and sender sanely. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2048 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/ConnectWindow.cpp50
1 files changed, 36 insertions, 14 deletions
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index e68f020e..80ac0de3 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -31,6 +31,7 @@
#include "engine/Driver.hpp"
#ifdef HAVE_SOUP
#include "client/HTTPClientReceiver.hpp"
+#include "client/HTTPEngineSender.hpp"
#endif
#ifdef HAVE_LIBLO
#include "client/OSCClientReceiver.hpp"
@@ -164,30 +165,51 @@ ConnectWindow::connect(bool existing)
Ingen::Shared::World* world = App::instance().world();
-#ifdef HAVE_LIBLO
+#if defined(HAVE_LIBLO) || defined(HAVE_SOUP)
if (_mode == CONNECT_REMOTE) {
- if (!existing) {
- Raul::URI engine_url("http://localhost:16180");
- if (_widgets_loaded) {
- const std::string& url_str = _url_entry->get_text();
- if (Raul::URI::is_valid(url_str))
- engine_url = url_str;
- }
- world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(engine_url));
+#ifdef HAVE_LIBLO
+ string uri = "osc.udp://localhost:16180";
+#else
+ string uri = "http://localhost:16180";
+#endif
+ if (_widgets_loaded) {
+ const std::string& user_uri = _url_entry->get_text();
+ if (Raul::URI::is_valid(user_uri))
+ uri = user_uri;
}
+ if (existing)
+ uri = world->engine->uri().str();
+
+ // Create client-side listener
SharedPtr<ThreadedSigClientInterface> tsci(new ThreadedSigClientInterface(1024));
SharedPtr<Raul::Deletable> client;
- const string& uri = world->engine->uri().str();
- const string& scheme = uri.substr(0, uri.find(":"));
+ string scheme = uri.substr(0, uri.find(":"));
+
+#ifdef HAVE_LIBLO
if (scheme == "osc.udp" || scheme == "osc.tcp")
- client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci)); // FIXME: port
+ client = SharedPtr<OSCClientReceiver>(new OSCClientReceiver(16181, tsci));
+#endif
#ifdef HAVE_SOUP
- else if (scheme == "http")
+ if (scheme == "http")
client = SharedPtr<HTTPClientReceiver>(new HTTPClientReceiver(world, uri, tsci));
#endif
+ if (!existing) {
+#ifdef HAVE_LIBLO
+ if (scheme == "osc.udp" || scheme == "osc.tcp")
+ world->engine = SharedPtr<EngineInterface>(new OSCEngineSender(uri));
+#endif
+#ifdef HAVE_SOUP
+ if (scheme == "http")
+ world->engine = SharedPtr<EngineInterface>(new HTTPEngineSender(world, uri));
+#endif
+ } else {
+ uri = world->engine->uri().str();
+ scheme = uri.substr(0, uri.find(":"));
+ }
+
App::instance().attach(tsci, client);
App::instance().register_callbacks();
@@ -220,7 +242,7 @@ ConnectWindow::connect(bool existing)
}
} else
-#endif
+#endif // defined(HAVE_LIBLO) || defined(HAVE_SOUP)
if (_mode == INTERNAL) {
if ( ! world->local_engine) {
assert(_new_engine);