changeset 23223:4b642b593ec2

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.
author Rik <rik@octave.org>
date Thu, 23 Feb 2017 14:55:39 -0800
parents a88575e87481
children 73f7ef7169ac
files libgui/graphics/ButtonGroup.cc libgui/graphics/Container.cc libgui/graphics/Figure.cc libgui/graphics/GenericEventNotify.h libgui/graphics/Menu.cc libgui/graphics/MouseModeActionGroup.cc libgui/graphics/Panel.cc libgui/graphics/QtHandlesUtils.cc libgui/graphics/__init_qt__.cc libgui/src/m-editor/file-editor.cc libgui/src/m-editor/octave-qscintilla.cc
diffstat 11 files changed, 82 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- 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<QWidget*> ())
-        { w->setMouseTracking (true); }
+          w->setMouseTracking (true);
         foreach (QWidget* w, buttongroup->findChildren<QWidget*> ())
-        { w->setMouseTracking (true); }
+          w->setMouseTracking (true);
       }
 
     QString title = Utils::fromStdString (pp.get_title ());
--- 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<QWidget> ()
-                  ->setGeometry (octave::math::round (bb(0)), octave::math::round (bb(1)),
-                                 octave::math::round (bb(2)), octave::math::round (bb(3)));
-                }
-            }
-        }
-    }
+                    obj->qWidget<QWidget> ()->setGeometry (
+                      octave::math::round (bb(0)), octave::math::round (bb(1)),
+                      octave::math::round (bb(2)), octave::math::round (bb(3)));
+                  }
+              }
+          }
+      }
   }
 
   void
--- 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<QWidget> ()->findChildren<QFrame*> ())
-    {
-      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<QWidget*> ())
-    { w->setMouseTracking (true); }
+      w->setMouseTracking (true);
   }
 
 }
--- 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) \
--- 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<double> (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<uimenu> (go);
+                    // Probably overkill as a uimenu child can only be another
+                    // uimenu object.
+                    if (go.isa ("uimenu"))
+                      {
+                        uimenu::properties& up = Utils::properties<uimenu> (go);
 
-                      up.get_property ("position").set
-                      (octave_value (count), true, false);
-                    }
-                }
+                        up.get_property ("position").set
+                        (octave_value (count), true, false);
+                      }
+                  }
 
-              count++;
-            }
-        }
+                count++;
+              }
+          }
       }
   }
 
--- 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)
--- 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<QWidget*> ())
-        { w->setMouseTracking (true); }
+          w->setMouseTracking (true);
       }
 
     QString title = Utils::fromStdString (pp.get_title ());
--- 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;
     }
--- 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);
--- 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 ());
-      }
     }
 }
 
--- 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)));