summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-03-08 12:38:19 +0100
committerDavid Robillard <d@drobilla.net>2019-03-09 00:43:43 +0100
commit532af2452bac2cdd0e2732ad145fdc2b141a4afc (patch)
tree0b078c37a137ef0da3a1e76bc150e99f65f6d7dc /src/gui
parent6bb3c48972d172fec244afae08a905e2246d9cda (diff)
downloadingen-532af2452bac2cdd0e2732ad145fdc2b141a4afc.tar.gz
ingen-532af2452bac2cdd0e2732ad145fdc2b141a4afc.tar.bz2
ingen-532af2452bac2cdd0e2732ad145fdc2b141a4afc.zip
Localise dependency on boost::format and improve logging API
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/App.cpp22
-rw-r--r--src/gui/ConnectWindow.cpp2
-rw-r--r--src/gui/GraphBox.cpp36
-rw-r--r--src/gui/GraphCanvas.cpp8
-rw-r--r--src/gui/GraphTreeWindow.cpp6
-rw-r--r--src/gui/NodeModule.cpp6
-rw-r--r--src/gui/PluginMenu.cpp4
-rw-r--r--src/gui/PropertiesWindow.cpp6
-rw-r--r--src/gui/RDFS.cpp2
-rw-r--r--src/gui/WidgetFactory.cpp4
10 files changed, 44 insertions, 52 deletions
diff --git a/src/gui/App.cpp b/src/gui/App.cpp
index df4159a1..b9b7f7dc 100644
--- a/src/gui/App.cpp
+++ b/src/gui/App.cpp
@@ -323,7 +323,7 @@ App::property_change(const URI& subject,
} else if (key == uris().ingen_maxRunLoad && value.type() == forge().Float) {
_max_run_load = value.get<float>();
} else {
- _world.log().warn(fmt("Unknown engine property %1%\n") % key);
+ _world.log().warn("Unknown engine property %1%\n", key);
return;
}
@@ -343,19 +343,18 @@ fraction_label(float f)
char col_str[8];
snprintf(col_str, sizeof(col_str), "%02X%02X%02X",
RGBA_R(col), RGBA_G(col), RGBA_B(col));
- return (fmt("<span color='#%s'>%d%%</span>") % col_str % (f * 100)).str();
+ return fmt("<span color='#%s'>%d%%</span>", col_str, (f * 100));
}
std::string
App::status_text() const
{
- return (fmt("%2.1f kHz / %.1f ms, %s, %s DSP")
- % (_sample_rate / 1e3f)
- % (_block_length * 1e3f / (float)_sample_rate)
- % ((_n_threads == 1)
- ? "1 thread"
- : (fmt("%1% threads") % _n_threads).str())
- % fraction_label(_max_run_load)).str();
+ return fmt(
+ "%2.1f kHz / %.1f ms, %s, %s DSP",
+ (_sample_rate / 1e3f),
+ (_block_length * 1e3f / (float)_sample_rate),
+ ((_n_threads == 1) ? "1 thread" : fmt("%1% threads", _n_threads)),
+ fraction_label(_max_run_load));
}
void
@@ -470,10 +469,9 @@ App::quit(Gtk::Window* dialog_parent)
try {
const std::string path = _world.conf().save(
_world.uri_map(), "ingen", "gui.ttl", Configuration::GUI);
- std::cout << (fmt("Saved GUI settings to %1%\n") % path);
+ std::cout << fmt("Saved GUI settings to %1%\n", path);
} catch (const std::exception& e) {
- std::cerr << (fmt("Error saving GUI settings (%1%)\n")
- % e.what());
+ std::cerr << fmt("Error saving GUI settings (%1%)\n", e.what());
}
return true;
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp
index e2968ea2..369331e2 100644
--- a/src/gui/ConnectWindow.cpp
+++ b/src/gui/ConnectWindow.cpp
@@ -244,7 +244,7 @@ ConnectWindow::connect(bool existing)
}
if (!URI::is_valid(uri_str)) {
- error((fmt("Invalid socket URI %1%") % uri_str).str());
+ error(fmt("Invalid socket URI %1%", uri_str));
return;
}
diff --git a/src/gui/GraphBox.cpp b/src/gui/GraphBox.cpp
index cb9edf98..a201eca8 100644
--- a/src/gui/GraphBox.cpp
+++ b/src/gui/GraphBox.cpp
@@ -26,6 +26,7 @@
#include "ingen/Configuration.hpp"
#include "ingen/Interface.hpp"
#include "ingen/Log.hpp"
+#include "ingen/fmt.hpp"
#include "ingen/client/ClientStore.hpp"
#include "ingen/client/GraphModel.hpp"
@@ -220,9 +221,8 @@ GraphBox::init_box(App& app)
if (engine_uri == "ingen:/clients/event_writer") {
_status_bar->push("Running internal engine", STATUS_CONTEXT_ENGINE);
} else {
- _status_bar->push(
- (fmt("Connected to %1%") % engine_uri).str(),
- STATUS_CONTEXT_ENGINE);
+ _status_bar->push(fmt("Connected to %1%", engine_uri),
+ STATUS_CONTEXT_ENGINE);
}
_menu_view_messages_window->signal_activate().connect(
@@ -428,7 +428,7 @@ GraphBox::show_status(const ObjectModel* model)
} else if ((block = dynamic_cast<const BlockModel*>(model))) {
const PluginModel* plugin = dynamic_cast<const PluginModel*>(block->plugin());
if (plugin) {
- msg << ((boost::format(" (%1%)") % plugin->human_name()).str());
+ msg << fmt(" (%1%)", plugin->human_name());
}
_status_bar->push(msg.str(), STATUS_CONTEXT_HOVER);
}
@@ -541,14 +541,12 @@ GraphBox::save_graph(const URI& uri)
{
if (_app->interface()->uri().string().substr(0, 3) == "tcp") {
_status_bar->push(
- (boost::format("Saved %1% to %2% on client")
- % _graph->path() % uri).str(),
+ fmt("Saved %1% to %2% on client", _graph->path(), uri),
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(),
+ fmt("Saved %1% to %2% on server", _graph->path(), uri),
STATUS_CONTEXT_GRAPH);
_app->interface()->copy(_graph->uri(), uri);
}
@@ -618,23 +616,22 @@ GraphBox::event_save_as()
if (Glib::file_test(filename, Glib::FILE_TEST_IS_DIR)) {
if (Glib::file_test(Glib::build_filename(filename, "manifest.ttl"),
Glib::FILE_TEST_EXISTS)) {
- confirmed = confirm(
- (boost::format("<b>The bundle \"%1%\" already exists."
- " Replace it?</b>") % basename).str());
+ confirmed = confirm(fmt("<b>The bundle \"%1%\" already exists."
+ " Replace it?</b>",
+ basename));
} else {
confirmed = confirm(
- (boost::format("<b>A directory named \"%1%\" already exists,"
- "but is not an Ingen bundle. "
- "Save into it anyway?</b>") % basename).str(),
+ fmt("<b>A directory named \"%1%\" already exists,"
+ "but is not an Ingen bundle. "
+ "Save into it anyway?</b>", basename),
"This will create at least 2 .ttl files in this directory,"
"and possibly several more files and/or directories, recursively. "
"Existing files will be overwritten.");
}
} else if (Glib::file_test(filename, Glib::FILE_TEST_EXISTS)) {
- confirmed = confirm(
- (boost::format("<b>A file named \"%1%\" already exists. "
- "Replace it with an Ingen bundle?</b>")
- % basename).str());
+ confirmed = confirm(fmt("<b>A file named \"%1%\" already exists. "
+ "Replace it with an Ingen bundle?</b>",
+ basename));
if (confirmed) {
::g_remove(filename.c_str());
}
@@ -703,8 +700,7 @@ GraphBox::event_export_image()
}
}
_view->canvas()->export_image(filename.c_str(), bg_but->get_active());
- _status_bar->push((boost::format("Rendered %1% to %2%")
- % _graph->path() % filename).str(),
+ _status_bar->push(fmt("Rendered %1% to %2%", _graph->path(), filename),
STATUS_CONTEXT_GRAPH);
}
}
diff --git a/src/gui/GraphCanvas.cpp b/src/gui/GraphCanvas.cpp
index 47a0abcf..986fefdc 100644
--- a/src/gui/GraphCanvas.cpp
+++ b/src/gui/GraphCanvas.cpp
@@ -421,8 +421,8 @@ GraphCanvas::connection(SPtr<const ArcModel> arc)
if (tail && head) {
new gui::Arc(*this, arc, tail, head);
} else {
- _app.log().error(fmt("Unable to find ports to connect %1% => %2%\n")
- % arc->tail_path() % arc->head_path());
+ _app.log().error("Unable to find ports to connect %1% => %2%\n",
+ arc->tail_path(), arc->head_path());
}
}
@@ -442,8 +442,8 @@ GraphCanvas::disconnection(SPtr<const ArcModel> arc)
}
}
} else {
- _app.log().error(fmt("Unable to find ports to disconnect %1% => %2%\n")
- % arc->tail_path() % arc->head_path());
+ _app.log().error("Unable to find ports to disconnect %1% => %2%\n",
+ arc->tail_path(), arc->head_path());
}
}
diff --git a/src/gui/GraphTreeWindow.cpp b/src/gui/GraphTreeWindow.cpp
index 2edf8a44..7d00b0f5 100644
--- a/src/gui/GraphTreeWindow.cpp
+++ b/src/gui/GraphTreeWindow.cpp
@@ -205,8 +205,7 @@ GraphTreeWindow::graph_property_changed(const URI& key,
Gtk::TreeModel::Row row = *i;
row[_graph_tree_columns.enabled_col] = value.get<int32_t>();
} else {
- _app->log().error(fmt("Unable to find graph %1%\n")
- % graph->path());
+ _app->log().error("Unable to find graph %1%\n", graph->path());
}
}
_enable_signal = true;
@@ -224,8 +223,7 @@ GraphTreeWindow::graph_moved(SPtr<GraphModel> graph)
Gtk::TreeModel::Row row = *i;
row[_graph_tree_columns.name_col] = graph->symbol().c_str();
} else {
- _app->log().error(fmt("Unable to find graph %1%\n")
- % graph->path());
+ _app->log().error("Unable to find graph %1%\n", graph->path());
}
_enable_signal = true;
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index ae030067..abb9e970 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -334,8 +334,8 @@ NodeModule::delete_port_view(SPtr<const PortModel> model)
if (p) {
delete p;
} else {
- app().log().warn(fmt("Failed to find port %1% on module %2%\n")
- % model->path() % _block->path());
+ app().log().warn("Failed to find port %1% on module %2%\n",
+ model->path(), _block->path());
}
}
@@ -381,7 +381,7 @@ NodeModule::popup_gui()
return true;
} else {
- app().log().warn(fmt("No LV2 GUI for %1%\n") % _block->path());
+ app().log().warn("No LV2 GUI for %1%\n", _block->path());
}
}
diff --git a/src/gui/PluginMenu.cpp b/src/gui/PluginMenu.cpp
index e85d1da7..49ee059d 100644
--- a/src/gui/PluginMenu.cpp
+++ b/src/gui/PluginMenu.cpp
@@ -112,8 +112,8 @@ PluginMenu::build_plugin_class_menu(Gtk::Menu* menu,
const char* sub_label_str = lilv_node_as_string(lilv_plugin_class_get_label(c));
const char* sub_uri_str = lilv_node_as_string(lilv_plugin_class_get_uri(c));
if (ancestors.find(sub_uri_str) != ancestors.end()) {
- _world.log().warn(fmt("Infinite LV2 class recursion: %1% <: %2%\n")
- % class_uri_str % sub_uri_str);
+ _world.log().warn("Infinite LV2 class recursion: %1% <: %2%\n",
+ class_uri_str, sub_uri_str);
return 0;
}
diff --git a/src/gui/PropertiesWindow.cpp b/src/gui/PropertiesWindow.cpp
index 994ed224..ba25d69b 100644
--- a/src/gui/PropertiesWindow.cpp
+++ b/src/gui/PropertiesWindow.cpp
@@ -359,7 +359,7 @@ PropertiesWindow::create_value_widget(const URI& key,
return widget;
}
- _app->log().error(fmt("No widget for value type %1%\n") % type);
+ _app->log().error("No widget for value type %1%\n", type);
return nullptr;
}
@@ -453,7 +453,7 @@ PropertiesWindow::get_value(LV2_URID type, Gtk::Widget* value_widget)
if (uri_entry && URI::is_valid(uri_entry->get_text())) {
return _app->forge().make_urid(URI(uri_entry->get_text()));
} else {
- _app->log().error(fmt("Invalid URI <%1%>\n") % uri_entry->get_text());
+ _app->log().error("Invalid URI <%1%>\n", uri_entry->get_text());
}
} else if (type == forge.String) {
Gtk::Entry* entry = dynamic_cast<Gtk::Entry*>(value_widget);
@@ -480,7 +480,7 @@ PropertiesWindow::on_change(const URI& key)
if (value.is_valid()) {
record.value = value;
} else {
- _app->log().error(fmt("Failed to get `%1%' value from widget\n") % key);
+ _app->log().error("Failed to get `%1%' value from widget\n", key);
}
}
diff --git a/src/gui/RDFS.cpp b/src/gui/RDFS.cpp
index 1ce3618d..80cc24f1 100644
--- a/src/gui/RDFS.cpp
+++ b/src/gui/RDFS.cpp
@@ -132,7 +132,7 @@ types(World& world, SPtr<const client::ObjectModel> model)
types.insert(world.uris().lv2_Plugin);
}
} else {
- world.log().error(fmt("<%1%> has non-URI type\n") % model->uri());
+ world.log().error("<%1%> has non-URI type\n", model->uri());
}
}
diff --git a/src/gui/WidgetFactory.cpp b/src/gui/WidgetFactory.cpp
index 3ca4eec4..a2a83a6f 100644
--- a/src/gui/WidgetFactory.cpp
+++ b/src/gui/WidgetFactory.cpp
@@ -58,8 +58,8 @@ WidgetFactory::find_ui_file()
return;
}
- throw std::runtime_error((fmt("Unable to find ingen_gui.ui in %1%\n")
- % INGEN_DATA_DIR).str());
+ throw std::runtime_error(fmt("Unable to find ingen_gui.ui in %1%\n",
+ INGEN_DATA_DIR));
}
Glib::RefPtr<Gtk::Builder>