# HG changeset patch # User Rik # Date 1487890539 28800 # Node ID 4b642b593ec20c20a86620a89d67cf83488f6848 # Parent a88575e874810140f76143f10d4481fe9fc60701 maint: Indent foreach blocks in Qt GUI code for readability. * ButtonGroup.cc, Container.cc, Figure.cc, GenericEventNotify.h, Menu.cc, MouseModeActionGroup.cc, Panel.cc, QtHandlesUtils.cc, __init_qt__.cc, file-editor.cc, octave-qscintilla.cc: Indent foreach blocks in Qt GUI code for readability. diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/ButtonGroup.cc --- a/libgui/graphics/ButtonGroup.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/ButtonGroup.cc Thu Feb 23 14:55:39 2017 -0800 @@ -139,9 +139,9 @@ if (frame->hasMouseTracking ()) { foreach (QWidget* w, frame->findChildren ()) - { w->setMouseTracking (true); } + w->setMouseTracking (true); foreach (QWidget* w, buttongroup->findChildren ()) - { w->setMouseTracking (true); } + w->setMouseTracking (true); } QString title = Utils::fromStdString (pp.get_title ()); diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/Container.cc --- a/libgui/graphics/Container.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/Container.cc Thu Feb 23 14:55:39 2017 -0800 @@ -81,26 +81,26 @@ gh_manager::auto_lock lock; foreach (QObject* qObj, children ()) - { - if (qObj->isWidgetType ()) - { - Object* obj = Object::fromQObject (qObj); + { + if (qObj->isWidgetType ()) + { + Object* obj = Object::fromQObject (qObj); - if (obj) - { - graphics_object go = obj->object (); + if (obj) + { + graphics_object go = obj->object (); - if (go.valid_object ()) - { - Matrix bb = go.get_properties ().get_boundingbox (false); + if (go.valid_object ()) + { + Matrix bb = go.get_properties ().get_boundingbox (false); - obj->qWidget () - ->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)), - octave::math::round (bb(2)), octave::math::round (bb(3))); - } - } - } - } + obj->qWidget ()->setGeometry ( + octave::math::round (bb(0)), octave::math::round (bb(1)), + octave::math::round (bb(2)), octave::math::round (bb(3))); + } + } + } + } } void diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/Figure.cc --- a/libgui/graphics/Figure.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/Figure.cc Thu Feb 23 14:55:39 2017 -0800 @@ -372,16 +372,16 @@ foreach (QFrame* frame, qWidget ()->findChildren ()) - { - if (frame->objectName () == "UIPanel" - || frame->objectName () == "UIButtonGroup") - { - Object* obj = Object::fromQObject (frame); + { + if (frame->objectName () == "UIPanel" + || frame->objectName () == "UIButtonGroup") + { + Object* obj = Object::fromQObject (frame); - if (obj) - obj->slotRedraw (); - } - } + if (obj) + obj->slotRedraw (); + } + } updateFigureToolBarAndMenuBar (); } @@ -1024,7 +1024,7 @@ m_container->setMouseTracking (true); m_container->canvas (m_handle)->qWidget ()->setMouseTracking (true); foreach (QWidget* w, m_container->findChildren ()) - { w->setMouseTracking (true); } + w->setMouseTracking (true); } } diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/GenericEventNotify.h --- a/libgui/graphics/GenericEventNotify.h Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/GenericEventNotify.h Thu Feb 23 14:55:39 2017 -0800 @@ -69,8 +69,9 @@ QEvent* evt) { foreach (GenericEventNotifyReceiver* r, m_receivers) - if (r->eventNotifyBefore (obj, evt)) - return true; + if (r->eventNotifyBefore (obj, evt)) + return true; + return false; } @@ -79,7 +80,7 @@ QEvent* evt) { foreach (GenericEventNotifyReceiver* r, m_receivers) - r->eventNotifyAfter (obj, evt); + r->eventNotifyAfter (obj, evt); } #define DECLARE_GENERICEVENTNOTIFY_SENDER(T,B) \ diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/Menu.cc --- a/libgui/graphics/Menu.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/Menu.cc Thu Feb 23 14:55:39 2017 -0800 @@ -115,8 +115,9 @@ int count = 0; foreach (QAction* a, m_parent->actions ()) - if (! a->isSeparator () && a->objectName () != "builtinMenu") - count++; + if (! a->isSeparator () && a->objectName () != "builtinMenu") + count++; + up.get_property ("position").set (octave_value (static_cast (count)), true, false); } @@ -127,13 +128,15 @@ QAction* before = 0; foreach (QAction* a, m_parent->actions ()) - if (! a->isSeparator () && a->objectName () != "builtinMenu") { - count++; - if (pos <= count) + if (! a->isSeparator () && a->objectName () != "builtinMenu") { - before = a; - break; + count++; + if (pos <= count) + { + before = a; + break; + } } } @@ -230,13 +233,15 @@ int count = 0; foreach (QAction* a, m_parent->actions ()) - if (! a->isSeparator () && a->objectName () != "builtinMenu") { - count++; - if (pos <= count) + if (! a->isSeparator () && a->objectName () != "builtinMenu") { - before = a; - break; + count++; + if (pos <= count) + { + before = a; + break; + } } } } @@ -298,29 +303,29 @@ double count = 1.0; foreach (QAction* a, m_parent->actions ()) - { - if (! a->isSeparator () && a->objectName () != "builtinMenu") - { - Object* aObj = Object::fromQObject (a); + { + if (! a->isSeparator () && a->objectName () != "builtinMenu") + { + Object* aObj = Object::fromQObject (a); - if (aObj) - { - graphics_object go = aObj->object (); + if (aObj) + { + graphics_object go = aObj->object (); - // Probably overkill as a uimenu child can only be another - // uimenu object. - if (go.isa ("uimenu")) - { - uimenu::properties& up = Utils::properties (go); + // Probably overkill as a uimenu child can only be another + // uimenu object. + if (go.isa ("uimenu")) + { + uimenu::properties& up = Utils::properties (go); - up.get_property ("position").set - (octave_value (count), true, false); - } - } + up.get_property ("position").set + (octave_value (count), true, false); + } + } - count++; - } - } + count++; + } + } } } diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/MouseModeActionGroup.cc --- a/libgui/graphics/MouseModeActionGroup.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/MouseModeActionGroup.cc Thu Feb 23 14:55:39 2017 -0800 @@ -54,10 +54,10 @@ tr ("Select"), this)); foreach (QAction* a, m_actions) - { - a->setCheckable (true); - connect (a, SIGNAL (toggled (bool)), this, SLOT (actionToggled (bool))); - } + { + a->setCheckable (true); + connect (a, SIGNAL (toggled (bool)), this, SLOT (actionToggled (bool))); + } } MouseModeActionGroup::~MouseModeActionGroup (void) diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/Panel.cc --- a/libgui/graphics/Panel.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/Panel.cc Thu Feb 23 14:55:39 2017 -0800 @@ -122,7 +122,7 @@ if (frame->hasMouseTracking ()) { foreach (QWidget* w, frame->findChildren ()) - { w->setMouseTracking (true); } + w->setMouseTracking (true); } QString title = Utils::fromStdString (pp.get_title ()); diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/QtHandlesUtils.cc --- a/libgui/graphics/QtHandlesUtils.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/QtHandlesUtils.cc Thu Feb 23 14:55:39 2017 -0800 @@ -78,7 +78,7 @@ int i = 0; foreach (const QString& s, l) - v[i++] = toStdString (s); + v[i++] = toStdString (s); return v; } diff -r a88575e87481 -r 4b642b593ec2 libgui/graphics/__init_qt__.cc --- a/libgui/graphics/__init_qt__.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/graphics/__init_qt__.cc Thu Feb 23 14:55:39 2017 -0800 @@ -237,13 +237,13 @@ int i = 0; foreach (const QString& s, files) - { - QFileInfo fi (s); + { + QFileInfo fi (s); - if (dirName.isEmpty ()) - dirName = appendDirSep (fi.canonicalPath ()); - cFiles(i++) = toStdString (fi.fileName ()); - } + if (dirName.isEmpty ()) + dirName = appendDirSep (fi.canonicalPath ()); + cFiles(i++) = toStdString (fi.fileName ()); + } retval(0) = cFiles; retval(1) = toStdString (dirName); diff -r a88575e87481 -r 4b642b593ec2 libgui/src/m-editor/file-editor.cc --- a/libgui/src/m-editor/file-editor.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/src/m-editor/file-editor.cc Thu Feb 23 14:55:39 2017 -0800 @@ -2388,9 +2388,7 @@ if (e->mimeData ()->hasUrls ()) { foreach (QUrl url, e->mimeData ()->urls ()) - { request_open_file (url.toLocalFile ()); - } } } diff -r a88575e87481 -r 4b642b593ec2 libgui/src/m-editor/octave-qscintilla.cc --- a/libgui/src/m-editor/octave-qscintilla.cc Thu Feb 23 19:28:41 2017 +0100 +++ b/libgui/src/m-editor/octave-qscintilla.cc Thu Feb 23 14:55:39 2017 -0800 @@ -252,7 +252,7 @@ QAction* a; foreach (a, all_actions) - context_menu->removeAction (a); + context_menu->removeAction (a); a = context_menu->addAction (tr ("dbstop if ..."), this, SLOT (contextmenu_break_condition (bool)));