[QGIS Commit] r9158 - in trunk/qgis/src: app app/composer core/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sun Aug 24 17:05:27 EDT 2008


Author: jef
Date: 2008-08-24 17:05:26 -0400 (Sun, 24 Aug 2008)
New Revision: 9158

Modified:
   trunk/qgis/src/app/composer/qgscomposer.cpp
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/core/composer/qgscomposeritem.cpp
   trunk/qgis/src/core/composer/qgscomposition.cpp
   trunk/qgis/src/core/composer/qgscomposition.h
Log:
update indentation and fix a warning

Modified: trunk/qgis/src/app/composer/qgscomposer.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.cpp	2008-08-24 20:27:47 UTC (rev 9157)
+++ trunk/qgis/src/app/composer/qgscomposer.cpp	2008-08-24 21:05:26 UTC (rev 9158)
@@ -76,10 +76,10 @@
 
   toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionGroupItems.png" ) ), tr( "&Group Items" ), this, SLOT( groupItems() ) );
   toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionUngroupItems.png" ) ), tr( "&Ungroup Items" ), this, SLOT( ungroupItems() ) );
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionRaiseItems.png")), tr("Raise selected items"), this, SLOT(raiseSelectedItems()));
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionLowerItems.png")), tr("Lower selected items"), this, SLOT(lowerSelectedItems()));
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToTop.png")), tr("Move selected items to top"), this, SLOT(moveSelectedItemsToTop()));
-  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToBottom.png")), tr("Move selected items to bottom"), this, SLOT(moveSelectedItemsToBottom()));
+  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionRaiseItems.png" ) ), tr( "Raise selected items" ), this, SLOT( raiseSelectedItems() ) );
+  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionLowerItems.png" ) ), tr( "Lower selected items" ), this, SLOT( lowerSelectedItems() ) );
+  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToTop.png" ) ), tr( "Move selected items to top" ), this, SLOT( moveSelectedItemsToTop() ) );
+  toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToBottom.png" ) ), tr( "Move selected items to bottom" ), this, SLOT( moveSelectedItemsToBottom() ) );
 
   QActionGroup* toggleActionGroup = new QActionGroup( this );
   toggleActionGroup->addAction( moveItemContentAction );
@@ -1034,34 +1034,34 @@
 
 void QgsComposer::raiseSelectedItems()
 {
-  if(mComposition)
-    {
-      mComposition->raiseSelectedItems();
-    }
+  if ( mComposition )
+  {
+    mComposition->raiseSelectedItems();
+  }
 }
 
 void QgsComposer::lowerSelectedItems()
 {
-  if(mComposition)
-    {
-      mComposition->lowerSelectedItems();
-    }
+  if ( mComposition )
+  {
+    mComposition->lowerSelectedItems();
+  }
 }
 
 void QgsComposer::moveSelectedItemsToTop()
 {
-  if(mComposition)
-    {
-      mComposition->moveSelectedItemsToTop();
-    }
+  if ( mComposition )
+  {
+    mComposition->moveSelectedItemsToTop();
+  }
 }
 
 void QgsComposer::moveSelectedItemsToBottom()
 {
-  if(mComposition)
-    {
-      mComposition->moveSelectedItemsToBottom();
-    }
+  if ( mComposition )
+  {
+    mComposition->moveSelectedItemsToBottom();
+  }
 }
 
 void QgsComposer::moveEvent( QMoveEvent *e ) { saveWindowState(); }

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2008-08-24 20:27:47 UTC (rev 9157)
+++ trunk/qgis/src/app/qgisapp.cpp	2008-08-24 21:05:26 UTC (rev 9158)
@@ -4658,14 +4658,12 @@
 
 void QgisApp::changeEvent( QEvent* event )
 {
-  switch ( event->type() )
-  {
-    case QEvent::WindowTitleChange:
 #ifdef Q_WS_MAC
-      mWindowAction->setText( windowTitle() );
-#endif
-      break;
+  if ( event->type() == QEvent::WindowTitleChange )
+  {
+    mWindowAction->setText( windowTitle() );
   }
+#endif
   QWidget::changeEvent( event );
 }
 

Modified: trunk/qgis/src/core/composer/qgscomposeritem.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposeritem.cpp	2008-08-24 20:27:47 UTC (rev 9157)
+++ trunk/qgis/src/core/composer/qgscomposeritem.cpp	2008-08-24 21:05:26 UTC (rev 9158)
@@ -39,10 +39,10 @@
   setPen( defaultPen );
 
   //let z-Value be managed by composition
-  if(mComposition)
-    {
-      mComposition->addItemToZList(this);
-    }
+  if ( mComposition )
+  {
+    mComposition->addItemToZList( this );
+  }
 }
 
 QgsComposerItem::QgsComposerItem( qreal x, qreal y, qreal width, qreal height, QgsComposition* composition ): QGraphicsRectItem( 0, 0, width, height, 0 ), mComposition( composition ), mBoundingResizeRectangle( 0 ), mFrame( true )
@@ -60,19 +60,19 @@
   defaultPen.setWidth( 1 );
   setPen( defaultPen );
 
- //let z-Value be managed by composition
-  if(mComposition)
-    {
-      mComposition->addItemToZList(this);
-    }
+//let z-Value be managed by composition
+  if ( mComposition )
+  {
+    mComposition->addItemToZList( this );
+  }
 }
 
 QgsComposerItem::~QgsComposerItem()
 {
-  if(mComposition)
-    {
-      mComposition->removeItemFromZList(this);
-    }
+  if ( mComposition )
+  {
+    mComposition->removeItemFromZList( this );
+  }
 }
 
 void QgsComposerItem::setSelected( bool s )

Modified: trunk/qgis/src/core/composer/qgscomposition.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposition.cpp	2008-08-24 20:27:47 UTC (rev 9157)
+++ trunk/qgis/src/core/composer/qgscomposition.cpp	2008-08-24 21:05:26 UTC (rev 9158)
@@ -190,133 +190,133 @@
   return true;
 }
 
-void QgsComposition::addItemToZList(QgsComposerItem* item)
+void QgsComposition::addItemToZList( QgsComposerItem* item )
 {
-  if(!item)
-    {
-      return;
-    }
-  mItemZList.push_back(item);
-  qWarning(QString::number(mItemZList.size()).toLocal8Bit().data());
-  item->setZValue(mItemZList.size());
+  if ( !item )
+  {
+    return;
+  }
+  mItemZList.push_back( item );
+  qWarning( QString::number( mItemZList.size() ).toLocal8Bit().data() );
+  item->setZValue( mItemZList.size() );
 }
 
-void QgsComposition::removeItemFromZList(QgsComposerItem* item)
+void QgsComposition::removeItemFromZList( QgsComposerItem* item )
 {
-  if(!item)
-    {
-      return;
-    }
-  mItemZList.removeAll(item);
+  if ( !item )
+  {
+    return;
+  }
+  mItemZList.removeAll( item );
 }
 
 void QgsComposition::raiseSelectedItems()
 {
   QList<QgsComposerItem*> selectedItems = selectedComposerItems();
   QList<QgsComposerItem*>::iterator it = selectedItems.begin();
-  for(; it != selectedItems.end(); ++it)
-    {
-      raiseItem(*it);
-    }
+  for ( ; it != selectedItems.end(); ++it )
+  {
+    raiseItem( *it );
+  }
 
   //update all positions
   updateZValues();
   update();
 }
 
-void QgsComposition::raiseItem(QgsComposerItem* item)
+void QgsComposition::raiseItem( QgsComposerItem* item )
 {
   //search item
-  QMutableLinkedListIterator<QgsComposerItem*> it(mItemZList);
-  if(it.findNext(item))
+  QMutableLinkedListIterator<QgsComposerItem*> it( mItemZList );
+  if ( it.findNext( item ) )
+  {
+    if ( it.hasNext() )
     {
-      if(it.hasNext())
-	{
-	  it.remove();
-	  it.next();
-	  it.insert(item);
-	}
+      it.remove();
+      it.next();
+      it.insert( item );
     }
+  }
 }
 
 void QgsComposition::lowerSelectedItems()
 {
   QList<QgsComposerItem*> selectedItems = selectedComposerItems();
   QList<QgsComposerItem*>::iterator it = selectedItems.begin();
-  for(; it != selectedItems.end(); ++it)
-    {
-      lowerItem(*it);
-    }
+  for ( ; it != selectedItems.end(); ++it )
+  {
+    lowerItem( *it );
+  }
 
   //update all positions
   updateZValues();
   update();
 }
 
-void QgsComposition::lowerItem(QgsComposerItem* item)
+void QgsComposition::lowerItem( QgsComposerItem* item )
 {
   //search item
-  QMutableLinkedListIterator<QgsComposerItem*> it(mItemZList);
-  if(it.findNext(item))
+  QMutableLinkedListIterator<QgsComposerItem*> it( mItemZList );
+  if ( it.findNext( item ) )
+  {
+    it.previous();
+    if ( it.hasPrevious() )
     {
+      it.remove();
       it.previous();
-      if(it.hasPrevious())
-	{
-	  it.remove();
-	  it.previous();
-	  it.insert(item);
-	}
+      it.insert( item );
     }
+  }
 }
 
 void QgsComposition::moveSelectedItemsToTop()
 {
   QList<QgsComposerItem*> selectedItems = selectedComposerItems();
   QList<QgsComposerItem*>::iterator it = selectedItems.begin();
-  for(; it != selectedItems.end(); ++it)
-    {
-      moveItemToTop(*it);
-    }
+  for ( ; it != selectedItems.end(); ++it )
+  {
+    moveItemToTop( *it );
+  }
 
   //update all positions
   updateZValues();
   update();
 }
 
-void QgsComposition::moveItemToTop(QgsComposerItem* item)
+void QgsComposition::moveItemToTop( QgsComposerItem* item )
 {
   //search item
-  QMutableLinkedListIterator<QgsComposerItem*> it(mItemZList);
-  if(it.findNext(item))
-    {
-      it.remove();
-    }
-  mItemZList.push_back(item);
+  QMutableLinkedListIterator<QgsComposerItem*> it( mItemZList );
+  if ( it.findNext( item ) )
+  {
+    it.remove();
+  }
+  mItemZList.push_back( item );
 }
- 
+
 void QgsComposition::moveSelectedItemsToBottom()
 {
   QList<QgsComposerItem*> selectedItems = selectedComposerItems();
   QList<QgsComposerItem*>::iterator it = selectedItems.begin();
-  for(; it != selectedItems.end(); ++it)
-    {
-      moveItemToBottom(*it);
-    }
+  for ( ; it != selectedItems.end(); ++it )
+  {
+    moveItemToBottom( *it );
+  }
 
   //update all positions
   updateZValues();
   update();
 }
 
-void QgsComposition::moveItemToBottom(QgsComposerItem* item)
+void QgsComposition::moveItemToBottom( QgsComposerItem* item )
 {
   //search item
-  QMutableLinkedListIterator<QgsComposerItem*> it(mItemZList);
-  if(it.findNext(item))
-    {
-      it.remove();
-    }
-  mItemZList.push_front(item);
+  QMutableLinkedListIterator<QgsComposerItem*> it( mItemZList );
+  if ( it.findNext( item ) )
+  {
+    it.remove();
+  }
+  mItemZList.push_front( item );
 }
 
 void QgsComposition::updateZValues()
@@ -325,79 +325,79 @@
   QLinkedList<QgsComposerItem*>::iterator it = mItemZList.begin();
   QgsComposerItem* currentItem = 0;
 
-  for(; it != mItemZList.end(); ++it)
+  for ( ; it != mItemZList.end(); ++it )
+  {
+    currentItem = *it;
+    if ( currentItem )
     {
-      currentItem = *it;
-      if(currentItem)
-	{
-	  qWarning(QString::number(counter).toLocal8Bit().data());
-	  currentItem->setZValue(counter);
-	}
-      ++counter;
+      qWarning( QString::number( counter ).toLocal8Bit().data() );
+      currentItem->setZValue( counter );
     }
+    ++counter;
+  }
 }
 
 void QgsComposition::sortZList()
 {
   //debug: list before sorting
-  qWarning("before sorting");
+  qWarning( "before sorting" );
   QLinkedList<QgsComposerItem*>::iterator before_it = mItemZList.begin();
-  for(; before_it != mItemZList.end(); ++before_it)
-    {
-      qWarning(QString::number((*before_it)->zValue()).toLocal8Bit().data());
-    }
+  for ( ; before_it != mItemZList.end(); ++before_it )
+  {
+    qWarning( QString::number(( *before_it )->zValue() ).toLocal8Bit().data() );
+  }
 
-  QMutableLinkedListIterator<QgsComposerItem*> it(mItemZList);
+  QMutableLinkedListIterator<QgsComposerItem*> it( mItemZList );
   int previousZ, afterZ; //z values of items before and after
   QgsComposerItem* previousItem;
   QgsComposerItem* afterItem;
 
-  while(it.hasNext())
+  while ( it.hasNext() )
+  {
+    previousItem = it.next();
+    if ( previousItem )
     {
-      previousItem = it.next();
-      if(previousItem)
-	{
-	  previousZ = previousItem->zValue();
-	}
-      else
-	{
-	  previousZ = -1;
-	}
+      previousZ = previousItem->zValue();
+    }
+    else
+    {
+      previousZ = -1;
+    }
 
-      if(!it.hasNext())
-	{
-	  break; //this is the end...
-	}
-      afterItem = it.peekNext();
+    if ( !it.hasNext() )
+    {
+      break; //this is the end...
+    }
+    afterItem = it.peekNext();
 
-      if(afterItem)
-	{
-	  afterZ = afterItem->zValue();
-	}
-      else
-	{
-	  afterZ = -1;
-	}
+    if ( afterItem )
+    {
+      afterZ = afterItem->zValue();
+    }
+    else
+    {
+      afterZ = -1;
+    }
 
-      if(previousZ > afterZ)
-	{
-	  //swap items
-	  if(previousItem && afterItem)
-	    {
-	      it.remove();
-	      it.next();
-	      it.insert(previousItem);
-	      it.previous();
-	    }
-	}
+    if ( previousZ > afterZ )
+    {
+      //swap items
+      if ( previousItem && afterItem )
+      {
+        it.remove();
+        it.next();
+        it.insert( previousItem );
+        it.previous();
+      }
     }
+  }
 
   //debug: list after sorting
   //debug: list before sorting
-  qWarning("after sorting");
+  qWarning( "after sorting" );
   QLinkedList<QgsComposerItem*>::iterator after_it = mItemZList.begin();
-  for(; after_it != mItemZList.end(); ++after_it)
-    {
-      qWarning(QString::number((*after_it)->zValue()).toLocal8Bit().data());
-    }
+  for ( ; after_it != mItemZList.end(); ++after_it )
+  {
+    qWarning( QString::number(( *after_it )->zValue() ).toLocal8Bit().data() );
+  }
 }

Modified: trunk/qgis/src/core/composer/qgscomposition.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposition.h	2008-08-24 20:27:47 UTC (rev 9157)
+++ trunk/qgis/src/core/composer/qgscomposition.h	2008-08-24 21:05:26 UTC (rev 9158)
@@ -30,7 +30,7 @@
 /** \ingroup MapComposer
  * Graphics scene for map printing. The class manages the paper item which always
  * is the item in the back (z-value 0). It maintains the z-Values of the items and stores
- * them in a list in ascending z-Order. This list can be changed to lower/raise items one position 
+ * them in a list in ascending z-Order. This list can be changed to lower/raise items one position
  * or to bring them to front/back.
  * */
 class CORE_EXPORT QgsComposition: public QGraphicsScene
@@ -93,24 +93,24 @@
     bool readXML( const QDomElement& compositionElem, const QDomDocument& doc );
 
     /**Adds item to z list. Usually called from constructor of QgsComposerItem*/
-    void addItemToZList(QgsComposerItem* item);
+    void addItemToZList( QgsComposerItem* item );
     /**Removes item from z list. Usually called from destructor of QgsComposerItem*/
-    void removeItemFromZList(QgsComposerItem* item);
+    void removeItemFromZList( QgsComposerItem* item );
 
     void raiseSelectedItems();
-    void raiseItem(QgsComposerItem* item);
+    void raiseItem( QgsComposerItem* item );
     void lowerSelectedItems();
-    void lowerItem(QgsComposerItem* item);
+    void lowerItem( QgsComposerItem* item );
     void moveSelectedItemsToTop();
-    void moveItemToTop(QgsComposerItem* item);
+    void moveItemToTop( QgsComposerItem* item );
     void moveSelectedItemsToBottom();
-    void moveItemToBottom(QgsComposerItem* item);
+    void moveItemToBottom( QgsComposerItem* item );
 
     /**Sorts the zList. The only time where this function needs to be called is from QgsComposer
      after reading all the items from xml file*/
     void sortZList();
-    
 
+
   private:
     /**Pointer to map renderer of QGIS main map*/
     QgsMapRenderer* mMapRenderer;



More information about the QGIS-commit mailing list