summaryrefslogtreecommitdiffstats
path: root/src/gui/ConnectWindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/ConnectWindow.cpp')
-rw-r--r--src/gui/ConnectWindow.cpp74
1 files changed, 39 insertions, 35 deletions
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index 2fd3be8c..edafdfa4 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -20,29 +20,33 @@
#include "Window.hpp"
#include "WindowFactory.hpp"
-#include "ingen/Atom.hpp"
-#include "ingen/Configuration.hpp"
-#include "ingen/EngineBase.hpp"
-#include "ingen/Forge.hpp"
-#include "ingen/Interface.hpp"
-#include "ingen/Log.hpp"
-#include "ingen/QueuedInterface.hpp"
-#include "ingen/URIs.hpp"
-#include "ingen/World.hpp"
-#include "ingen/client/ClientStore.hpp"
-#include "ingen/client/GraphModel.hpp" // IWYU pragma: keep
-#include "ingen/client/SigClientInterface.hpp"
-#include "ingen/client/SocketClient.hpp"
-#include "ingen/paths.hpp"
-#include "raul/Path.hpp"
-#include "raul/Process.hpp"
+#include <ingen/Atom.hpp>
+#include <ingen/Configuration.hpp>
+#include <ingen/EngineBase.hpp>
+#include <ingen/Forge.hpp>
+#include <ingen/Interface.hpp>
+#include <ingen/Log.hpp>
+#include <ingen/Message.hpp>
+#include <ingen/QueuedInterface.hpp>
+#include <ingen/Status.hpp>
+#include <ingen/URI.hpp>
+#include <ingen/URIs.hpp>
+#include <ingen/World.hpp>
+#include <ingen/client/ClientStore.hpp>
+#include <ingen/client/GraphModel.hpp>
+#include <ingen/client/SigClientInterface.hpp>
+#include <ingen/client/SocketClient.hpp>
+#include <ingen/fmt.hpp>
+#include <ingen/paths.hpp>
+#include <raul/Path.hpp>
+#include <raul/Process.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>
@@ -54,6 +58,7 @@
#include <gtkmm/stock.h>
#include <sigc++/adaptors/bind.h>
#include <sigc++/functors/mem_fun.h>
+#include <sigc++/functors/slot.h>
#include <sigc++/signal.h>
#include <limits>
@@ -108,7 +113,7 @@ ConnectWindow::start(App& app, ingen::World& world)
}
set_connected_to(world.interface());
- connect(bool(world.interface()));
+ connect(!!world.interface());
}
void
@@ -195,7 +200,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);
@@ -438,18 +443,17 @@ ConnectWindow::internal_toggled()
void
ConnectWindow::next_stage()
{
- static const char* labels[] = {
- "Connecting...",
- "Pinging engine...",
- "Attaching to engine...",
- "Requesting root graph...",
- "Waiting for root graph...",
- "Connected"
- };
-
-
++_connect_stage;
if (_widgets_loaded) {
+ static const char* labels[] = {
+ "Connecting...",
+ "Pinging engine...",
+ "Attaching to engine...",
+ "Requesting root graph...",
+ "Waiting for root graph...",
+ "Connected"
+ };
+
_progress_label->set_text(labels[_connect_stage]);
}
}
@@ -472,8 +476,8 @@ ConnectWindow::gtk_callback()
// Show if attempted connection goes on for a noticeable amount of time
if (!is_visible()) {
- const float ms_since_start = (now.tv_sec - start.tv_sec) * 1000.0f +
- (now.tv_usec - start.tv_usec) * 0.001f;
+ const float ms_since_start = ((now.tv_sec - start.tv_sec) * 1000.0f) +
+ ((now.tv_usec - start.tv_usec) * 0.001f);
if (ms_since_start > 500) {
present();
set_connecting_widget_states();
@@ -481,8 +485,8 @@ ConnectWindow::gtk_callback()
}
if (_connect_stage == 0) {
- const float ms_since_last = (now.tv_sec - last.tv_sec) * 1000.0f +
- (now.tv_usec - last.tv_usec) * 0.001f;
+ const float ms_since_last = ((now.tv_sec - last.tv_sec) * 1000.0f) +
+ ((now.tv_usec - last.tv_usec) * 0.001f);
if (ms_since_last >= 250) {
last = now;
if (_mode == Mode::INTERNAL) {
@@ -511,8 +515,8 @@ ConnectWindow::gtk_callback()
if (_attached) {
next_stage();
} else {
- const float ms_since_last = (now.tv_sec - last.tv_sec) * 1000.0f +
- (now.tv_usec - last.tv_usec) * 0.001f;
+ const float ms_since_last = ((now.tv_sec - last.tv_sec) * 1000.0f) +
+ ((now.tv_usec - last.tv_usec) * 0.001f);
if (attempts > 10) {
error("Failed to ping engine");
_connect_stage = -1;