diff options
author | David Robillard <d@drobilla.net> | 2016-10-06 15:51:11 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2016-10-06 15:51:11 -0400 |
commit | 77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f (patch) | |
tree | 50dca5900274ca2f95c3d06069b7fe0bd285e46b /src/gui | |
parent | a513af4218d0a62a45960d04ff6ddeecb8d3d4f5 (diff) | |
download | ingen-77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f.tar.gz ingen-77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f.tar.bz2 ingen-77f6e9e63ce9ad329b43c92e8a9556aff8e78f2f.zip |
Add plugin state saving
This only works with a server-side save, so the GUI now uses that if the
server is not running remotely, where "remotely" is defined as "via
TCP". This isn't perfect, since running ingen via TCP locally is a
perfectly valid thing to do, but it will do for now.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/GraphBox.cpp | 31 | ||||
-rw-r--r-- | src/gui/GraphBox.hpp | 2 |
2 files changed, 23 insertions, 10 deletions
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp index 692e378a..6423c016 100644 --- a/src/gui/GraphBox.cpp +++ b/src/gui/GraphBox.cpp @@ -493,11 +493,7 @@ GraphBox::event_save() if (!document.is_valid() || document.type() != _app->uris().forge.URI) { event_save_as(); } else { - _app->loader()->save_graph(_graph, document.ptr<char>()); - _status_bar->push( - (boost::format("Saved %1% to %2%") % _graph->path().c_str() - % document.ptr<char>()).str(), - STATUS_CONTEXT_GRAPH); + save_graph(Raul::URI(document.ptr<char>())); } } @@ -528,6 +524,24 @@ GraphBox::confirm(const Glib::ustring& message, } void +GraphBox::save_graph(const Raul::URI& uri) +{ + if (_app->interface()->uri().substr(0, 3) == "tcp") { + _status_bar->push( + (boost::format("Saved %1% to %2% on client") + % _graph->path() % uri).str(), + STATUS_CONTEXT_GRAPH); + _app->loader()->save_graph(_graph, uri); + } else { + _status_bar->push( + (boost::format("Saved %1% to %2% on server") + % _graph->path() % uri).str(), + STATUS_CONTEXT_GRAPH); + _app->interface()->copy(_graph->uri(), uri); + } +} + +void GraphBox::event_save_as() { const URIs& uris = _app->uris(); @@ -613,14 +627,11 @@ GraphBox::event_save_as() if (confirmed) { const Glib::ustring uri = Glib::filename_to_uri(filename); - _app->loader()->save_graph(_graph, uri); + save_graph(Raul::URI(uri)); + const_cast<GraphModel*>(_graph.get())->set_property( uris.ingen_file, _app->forge().alloc_uri(uri.c_str())); - _status_bar->push( - (boost::format("Saved %1% to %2%") % _graph->path().c_str() - % filename).str(), - STATUS_CONTEXT_GRAPH); } _app->world()->conf().set( diff --git a/src/gui/GraphBox.hpp b/src/gui/GraphBox.hpp index 3ffd1f91..20e0a764 100644 --- a/src/gui/GraphBox.hpp +++ b/src/gui/GraphBox.hpp @@ -106,6 +106,8 @@ private: bool confirm(const Glib::ustring& message, const Glib::ustring& secondary_text=""); + void save_graph(const Raul::URI& uri); + void event_import(); void event_save(); void event_save_as(); |