From 15b3b0e9f8823752f80c7e597a70749813e61c79 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 25 Dec 2017 15:26:48 -0500 Subject: Always use braces --- src/gui/BreadCrumbs.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'src/gui/BreadCrumbs.cpp') diff --git a/src/gui/BreadCrumbs.cpp b/src/gui/BreadCrumbs.cpp index 0be15fa6..96fc2bdb 100644 --- a/src/gui/BreadCrumbs.cpp +++ b/src/gui/BreadCrumbs.cpp @@ -44,9 +44,11 @@ BreadCrumbs::BreadCrumbs(App& app) SPtr BreadCrumbs::view(const Raul::Path& path) { - for (const auto& b : _breadcrumbs) - if (b->path() == path) + for (const auto& b : _breadcrumbs) { + if (b->path() == path) { return b->view(); + } + } return SPtr(); } @@ -67,8 +69,9 @@ BreadCrumbs::build(Raul::Path path, SPtr view) for (const auto& b : _breadcrumbs) { if (b->path() == path) { b->set_active(true); - if (!b->view()) + if (!b->view()) { b->set_view(view); + } // views are expensive, having two around for the same graph is a bug assert(b->view() == view); @@ -86,22 +89,25 @@ BreadCrumbs::build(Raul::Path path, SPtr view) string suffix = path.substr(_full_path.length()); while (suffix.length() > 0) { - if (suffix[0] == '/') + if (suffix[0] == '/') { suffix = suffix.substr(1); + } const string name = suffix.substr(0, suffix.find("/")); _full_path = _full_path.child(Raul::Symbol(name)); BreadCrumb* but = create_crumb(_full_path, view); pack_start(*but, false, false, 1); _breadcrumbs.push_back(but); but->show(); - if (suffix.find("/") == string::npos) + if (suffix.find("/") == string::npos) { break; - else + } else { suffix = suffix.substr(suffix.find("/")+1); + } } - for (const auto& b : _breadcrumbs) + for (const auto& b : _breadcrumbs) { b->set_active(false); + } _breadcrumbs.back()->set_active(true); } else { @@ -112,8 +118,9 @@ BreadCrumbs::build(Raul::Path path, SPtr view) _active_path = path; // Empty existing breadcrumbs - for (const auto& b : _breadcrumbs) + for (const auto& b : _breadcrumbs) { remove(*b); + } _breadcrumbs.clear(); // Add root @@ -125,8 +132,9 @@ BreadCrumbs::build(Raul::Path path, SPtr view) Raul::Path working_path("/"); string suffix = path.substr(1); while (suffix.length() > 0) { - if (suffix[0] == '/') + if (suffix[0] == '/') { suffix = suffix.substr(1); + } const string name = suffix.substr(0, suffix.find("/")); working_path = working_path.child(Raul::Symbol(name)); BreadCrumb* but = create_crumb(working_path, view); @@ -134,10 +142,11 @@ BreadCrumbs::build(Raul::Path path, SPtr view) _breadcrumbs.push_back(but); but->set_active(working_path == _active_path); but->show(); - if (suffix.find("/") == string::npos) + if (suffix.find("/") == string::npos) { break; - else + } else { suffix = suffix.substr(suffix.find("/")+1); + } } } @@ -174,8 +183,9 @@ BreadCrumbs::breadcrumb_clicked(BreadCrumb* crumb) crumb->set_active(true); } else { signal_graph_selected.emit(crumb->path(), crumb->view()); - if (crumb->path() != _active_path) + if (crumb->path() != _active_path) { crumb->set_active(false); + } } _enable_signal = true; } @@ -209,8 +219,9 @@ void BreadCrumbs::object_moved(const Raul::Path& old_path, const Raul::Path& new_path) { for (const auto& b : _breadcrumbs) { - if (b->path() == old_path) + if (b->path() == old_path) { b->set_path(new_path); + } } } -- cgit v1.2.1