diff options
Diffstat (limited to 'src/gui/ConnectWindow.cpp')
-rw-r--r-- | src/gui/ConnectWindow.cpp | 56 |
1 files changed, 19 insertions, 37 deletions
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index ea1a6e27..f49b8788 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -27,6 +27,7 @@ #include "ingen/Interface.hpp" #include "ingen/Log.hpp" #include "ingen/QueuedInterface.hpp" +#include "ingen/Status.hpp" #include "ingen/URIs.hpp" #include "ingen/World.hpp" #include "ingen/client/ClientStore.hpp" @@ -37,13 +38,13 @@ #include "raul/Path.hpp" #include "raul/Process.hpp" -#include <boost/variant/get.hpp> #include <glib.h> #include <glibmm/main.h> #include <glibmm/signalproxy.h> #include <glibmm/ustring.h> #include <gtkmm/builder.h> #include <gtkmm/button.h> +#include <gtkmm/dialog.h> #include <gtkmm/entry.h> #include <gtkmm/enums.h> #include <gtkmm/image.h> @@ -62,44 +63,22 @@ #include <string> #include <sys/time.h> #include <utility> +#include <variant> -namespace ingen { -namespace gui { +namespace ingen::gui { ConnectWindow::ConnectWindow(BaseObjectType* cobject, Glib::RefPtr<Gtk::Builder> xml) : Dialog(cobject) , _xml(std::move(xml)) - , _icon(nullptr) - , _progress_bar(nullptr) - , _progress_label(nullptr) - , _url_entry(nullptr) - , _server_radio(nullptr) - , _port_spinbutton(nullptr) - , _launch_radio(nullptr) - , _internal_radio(nullptr) - , _activate_button(nullptr) - , _deactivate_button(nullptr) - , _disconnect_button(nullptr) - , _connect_button(nullptr) - , _quit_button(nullptr) - , _mode(Mode::CONNECT_REMOTE) - , _connect_uri("unix:///tmp/ingen.sock") - , _ping_id(-1) - , _attached(false) - , _finished_connecting(false) - , _widgets_loaded(false) - , _connect_stage(0) - , _quit_flag(false) -{ -} +{} void ConnectWindow::message(const Message& msg) { - if (const Response* const r = boost::get<Response>(&msg)) { + if (const Response* const r = std::get_if<Response>(&msg)) { ingen_response(r->id, r->status, r->subject); - } else if (const Error* const e = boost::get<Error>(&msg)) { + } else if (const Error* const e = std::get_if<Error>(&msg)) { error(e->message); } } @@ -218,7 +197,7 @@ ConnectWindow::connect_remote(const URI& uri) auto sci = std::make_shared<client::SigClientInterface>(); auto qi = std::make_shared<QueuedInterface>(sci); - std::shared_ptr<ingen::Interface> iface(world.new_interface(uri, qi)); + const std::shared_ptr<ingen::Interface> iface{world.new_interface(uri, qi)}; if (iface) { world.set_interface(iface); _app->attach(qi); @@ -236,10 +215,10 @@ ConnectWindow::connect(bool existing) if (_app->client()) { error("Already connected"); return; - } else if (_attached) { - _attached = false; } + _attached = false; + set_connecting_widget_states(); _connect_stage = 0; @@ -286,10 +265,14 @@ ConnectWindow::connect(bool existing) if (!world.load_module("server")) { error("Failed to load server module"); return; - } else if (!world.load_module("jack")) { + } + + if (!world.load_module("jack")) { error("Failed to load jack module"); return; - } else if (!world.engine()->activate()) { + } + + if (!world.engine()->activate()) { error("Failed to activate engine"); return; } @@ -577,9 +560,9 @@ ConnectWindow::gtk_callback() _progress_label->set_text(std::string("Disconnected")); } return false; - } else { - return true; } + + return true; } void @@ -589,5 +572,4 @@ ConnectWindow::quit() Gtk::Main::quit(); } -} // namespace gui -} // namespace ingen +} // namespace ingen::gui |