[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/work/~dang/kdegraphics/kolourpaint/mainwindow
From:       Clarence Dang <dang () kde ! org>
Date:       2007-06-22 10:14:00
Message-ID: 1182507240.589453.3745.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 678798 by dang:

Use Q_ASSERT not "if"

 M  +4 -19     kpMainWindow_Image.cpp  
 M  +2 -10     kpMainWindow_Tools.cpp  


--- branches/work/~dang/kdegraphics/kolourpaint/mainwindow/kpMainWindow_Image.cpp \
#678797:678798 @@ -235,13 +235,8 @@
         return kpColor::Transparent;
     else
     {
-        if (m_colorToolBar)
-            return m_colorToolBar->backgroundColor ();
-        else
-        {
-            kError () << "kpMainWindow::backgroundColor() without colorToolBar" << \
                endl;
-            return kpColor::Invalid;
-        }
+        Q_ASSERT (m_colorToolBar);
+        return m_colorToolBar->backgroundColor ();
     }
 }
 
@@ -258,11 +253,7 @@
                << endl;
 #endif
 
-    if (!m_document)
-    {
-        kError () << "kpMainWindow::addImageOrSelectionCommand() without doc" << \
                endl;
-        return;
-    }
+    Q_ASSERT (m_document);
 
 
     if (m_viewManager)
@@ -367,13 +358,7 @@
     if (toolHasBegunShape ())
         tool ()->endShapeInternal ();
 
-    if (!m_document || !m_document->selection ())
-    {
-        kError () << "kpMainWindow::slotCrop() doc=" << m_document
-                   << " sel=" << (m_document ? m_document->selection () : 0)
-                   << endl;
-        return;
-    }
+    Q_ASSERT (m_document && m_document->selection ());
 
 
     ::kpTransformCrop (this);
--- branches/work/~dang/kdegraphics/kolourpaint/mainwindow/kpMainWindow_Tools.cpp \
#678797:678798 @@ -319,11 +319,7 @@
 kpSelectionTransparency kpMainWindow::selectionTransparency () const
 {
     kpToolWidgetOpaqueOrTransparent *oot = \
                m_toolToolBar->toolWidgetOpaqueOrTransparent ();
-    if (!oot)
-    {
-        kError () << "kpMainWindow::selectionTransparency() without \
                opaqueOrTransparent widget" << endl;
-        return kpSelectionTransparency ();
-    }
+    Q_ASSERT (oot);
 
     return kpSelectionTransparency (oot->isOpaque (), backgroundColor (), \
m_colorToolBar->colorSimilarity ());  }
@@ -339,11 +335,7 @@
 #endif
 
     kpToolWidgetOpaqueOrTransparent *oot = \
                m_toolToolBar->toolWidgetOpaqueOrTransparent ();
-    if (!oot)
-    {
-        kError () << "kpMainWindow::setSelectionTransparency() without \
                opaqueOrTransparent widget" << endl;
-        return;
-    }
+    Q_ASSERT (oot);
 
     m_settingSelectionTransparency++;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic