[QGIS Commit] r9731 - in trunk/qgis/src: app app/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Dec 3 06:20:03 EST 2008


Author: mhugent
Date: 2008-12-03 06:20:02 -0500 (Wed, 03 Dec 2008)
New Revision: 9731

Modified:
   trunk/qgis/src/app/composer/qgscomposer.cpp
   trunk/qgis/src/app/composer/qgscomposer.h
   trunk/qgis/src/app/qgisapp.cpp
   trunk/qgis/src/app/qgsoptions.cpp
   trunk/qgis/src/ui/qgscomposerbase.ui
Log:
Consider themes for all composer items and change icon themes in composer together with application. Fixes bug #1438

Modified: trunk/qgis/src/app/composer/qgscomposer.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.cpp	2008-12-02 23:23:46 UTC (rev 9730)
+++ trunk/qgis/src/app/composer/qgscomposer.cpp	2008-12-03 11:20:02 UTC (rev 9731)
@@ -78,35 +78,16 @@
   // mActionAddImage
   // mActionSelectMoveItem
 
-  QAction* moveItemContentAction = new QAction( QIcon( QPixmap( myIconPath + "mActionMoveItemContent.png" ) ),
-      tr( "Move Content" ), 0 );
-  moveItemContentAction->setToolTip( tr( "Move item content" ) );
-  moveItemContentAction->setCheckable( true );
-  connect( moveItemContentAction, SIGNAL( triggered() ), this, SLOT( moveItemContent() ) );
-  toolBar->addAction( moveItemContentAction );
-  //toolBar->addAction(QIcon(QPixmap(myIconPath+"mActionMoveItemContent.png")), tr("Move Item content"), this, SLOT(moveItemContent()));
+  mActionMoveItemContent->setToolTip( tr( "Move item content" ) );
+  mActionGroupItems->setToolTip( tr( "Group items" ) );
+  mActionUngroupItems->setToolTip( tr( "Ungroup items" ) );
+  mActionRaiseItems->setToolTip( tr( "Raise selected items" ) );
+  mActionLowerItems->setToolTip( tr( "Lower selected items" ) );
+  mActionMoveItemsToTop->setToolTip( tr( "Move selected items to top" ) );
+  mActionMoveItemsToBottom->setToolTip( tr( "Move selected items to bottom" ) );
 
-  QAction* groupItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionGroupItems.png" ) ),
-                              tr( "&Group" ), this, SLOT( groupItems() ) );
-  groupItemsAction->setToolTip( tr( "Group items" ) );
-  QAction* ungroupItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionUngroupItems.png" ) ),
-                                tr( "&Ungroup" ), this, SLOT( ungroupItems() ) );
-  ungroupItemsAction->setToolTip( tr( "Ungroup items" ) );
-  QAction* raiseItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionRaiseItems.png" ) ),
-                              tr( "Raise" ), this, SLOT( raiseSelectedItems() ) );
-  raiseItemsAction->setToolTip( tr( "Raise selected items" ) );
-  QAction* lowerItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionLowerItems.png" ) ),
-                              tr( "Lower" ), this, SLOT( lowerSelectedItems() ) );
-  lowerItemsAction->setToolTip( tr( "Lower selected items" ) );
-  QAction* moveItemsToTopAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToTop.png" ) ),
-                                  tr( "Bring to Front" ), this, SLOT( moveSelectedItemsToTop() ) );
-  moveItemsToTopAction->setToolTip( tr( "Move selected items to top" ) );
-  QAction* moveItemsToBottomAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToBottom.png" ) ),
-                                     tr( "Send to Back" ), this, SLOT( moveSelectedItemsToBottom() ) );
-  moveItemsToBottomAction->setToolTip( tr( "Move selected items to bottom" ) );
-
   QActionGroup* toggleActionGroup = new QActionGroup( this );
-  toggleActionGroup->addAction( moveItemContentAction );
+  toggleActionGroup->addAction( mActionMoveItemContent);
   toggleActionGroup->addAction( mActionAddNewMap );
   toggleActionGroup->addAction( mActionAddNewLabel );
   toggleActionGroup->addAction( mActionAddNewLegend );
@@ -124,6 +105,7 @@
   mActionSelectMoveItem->setCheckable( true );
   mActionAddNewScalebar->setCheckable( true );
   mActionAddImage->setCheckable( true );
+  mActionMoveItemContent->setCheckable( true );
 
 #ifdef Q_WS_MAC
   QMenu *appMenu = menuBar()->addMenu( tr( "QGIS" ) );
@@ -257,6 +239,13 @@
   mActionAddNewLegend->setIcon( QgisApp::getThemeIcon( "/mActionAddLegend.png" ) );
   mActionAddNewScalebar->setIcon( QgisApp::getThemeIcon( "/mActionScaleBar.png" ) );
   mActionSelectMoveItem->setIcon( QgisApp::getThemeIcon( "/mActionSelectPan.png" ) );
+  mActionMoveItemContent->setIcon( QgisApp::getThemeIcon("/mActionMoveItemContent.png"));
+  mActionGroupItems->setIcon( QgisApp::getThemeIcon("/mActionGroupItems.png"));
+  mActionUngroupItems->setIcon( QgisApp::getThemeIcon("/mActionUngroupItems.png"));
+  mActionRaiseItems->setIcon( QgisApp::getThemeIcon("/mActionRaiseItems.png"));
+  mActionLowerItems->setIcon( QgisApp::getThemeIcon("/mActionLowerItems.png"));
+  mActionMoveItemsToTop->setIcon( QgisApp::getThemeIcon("/mActionMoveItemsToTop.png"));
+  mActionMoveItemsToBottom->setIcon( QgisApp::getThemeIcon("/mActionMoveItemsToBottom.png"));
 }
 
 void QgsComposer::connectSlots()
@@ -740,7 +729,7 @@
   }
 }
 
-void QgsComposer::moveItemContent()
+void QgsComposer::on_mActionMoveItemContent_activated(void)
 {
   if ( mView )
   {
@@ -748,7 +737,7 @@
   }
 }
 
-void QgsComposer::groupItems( void )
+void QgsComposer::on_mActionGroupItems_activated( void )
 {
   if ( mView )
   {
@@ -756,7 +745,7 @@
   }
 }
 
-void QgsComposer::ungroupItems( void )
+void QgsComposer::on_mActionUngroupItems_activated( void )
 {
   if ( mView )
   {
@@ -764,7 +753,7 @@
   }
 }
 
-void QgsComposer::raiseSelectedItems()
+void QgsComposer::on_mActionRaiseItems_activated( void )
 {
   if ( mComposition )
   {
@@ -772,7 +761,7 @@
   }
 }
 
-void QgsComposer::lowerSelectedItems()
+void QgsComposer::on_mActionLowerItems_activated(void)
 {
   if ( mComposition )
   {
@@ -780,7 +769,7 @@
   }
 }
 
-void QgsComposer::moveSelectedItemsToTop()
+void QgsComposer::on_mActionMoveItemsToTop_activated(void)
 {
   if ( mComposition )
   {
@@ -788,7 +777,7 @@
   }
 }
 
-void QgsComposer::moveSelectedItemsToBottom()
+void QgsComposer::on_mActionMoveItemsToBottom(void)
 {
   if ( mComposition )
   {

Modified: trunk/qgis/src/app/composer/qgscomposer.h
===================================================================
--- trunk/qgis/src/app/composer/qgscomposer.h	2008-12-02 23:23:46 UTC (rev 9730)
+++ trunk/qgis/src/app/composer/qgscomposer.h	2008-12-03 11:20:02 UTC (rev 9731)
@@ -50,6 +50,9 @@
     QgsComposer( QgisApp *qgis );
     ~QgsComposer();
 
+    //! Set the pixmap / icons on the toolbar buttons
+    void setupTheme();
+
     //! Open and show, set defaults if first time
     void open();
 
@@ -130,25 +133,25 @@
     void on_mActionAddImage_activated( void );
 
     //! Set tool to move item content
-    void moveItemContent();
+    void on_mActionMoveItemContent_activated(void);
 
     //! Group selected items
-    void groupItems( void );
+    void on_mActionGroupItems_activated( void );
 
     //! Ungroup selected item group
-    void ungroupItems( void );
+    void on_mActionUngroupItems_activated( void );
 
     //! Move selected items one position up
-    void raiseSelectedItems();
+    void on_mActionRaiseItems_activated(void);
 
     //!Move selected items one position down
-    void lowerSelectedItems();
+    void on_mActionLowerItems_activated(void);
 
     //!Move selected items to top
-    void moveSelectedItemsToTop();
+    void on_mActionMoveItemsToTop_activated(void);
 
     //!Move selected items to bottom
-    void moveSelectedItemsToBottom();
+    void on_mActionMoveItemsToBottom(void);
 
     //! Save window state
     void saveWindowState();
@@ -196,8 +199,7 @@
     void activate();
 
   private:
-    //! Set the pixmap / icons on the toolbar buttons
-    void setupTheme();
+
     /**Establishes the signal slot connection for the class*/
     void connectSlots();
 

Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp	2008-12-02 23:23:46 UTC (rev 9730)
+++ trunk/qgis/src/app/qgisapp.cpp	2008-12-03 11:20:02 UTC (rev 9731)
@@ -304,6 +304,7 @@
 QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
     : QMainWindow( parent, fl ),
     mSplash( splash ),
+    mComposer(0),
     mPythonConsole( NULL ),
     mPythonUtils( NULL )
 {
@@ -1480,6 +1481,11 @@
   mActionCustomProjection->setIcon( getThemeIcon( "/mActionCustomProjection.png" ) );
   mActionAddWmsLayer->setIcon( getThemeIcon( "/mActionAddWmsLayer.png" ) );
   mActionAddToOverview->setIcon( getThemeIcon( "/mActionInOverview.png" ) );
+
+  if(mComposer)
+  {
+    mComposer->setupTheme();
+  }
 }
 
 void QgisApp::setupConnections()

Modified: trunk/qgis/src/app/qgsoptions.cpp
===================================================================
--- trunk/qgis/src/app/qgsoptions.cpp	2008-12-02 23:23:46 UTC (rev 9730)
+++ trunk/qgis/src/app/qgsoptions.cpp	2008-12-03 11:20:02 UTC (rev 9731)
@@ -245,6 +245,7 @@
   QString newt = newThemeName;
   QgisApp::instance()->setTheme( newt );
 }
+
 QString QgsOptions::theme()
 {
   // returns the current theme (as selected in the cmbTheme combo box)

Modified: trunk/qgis/src/ui/qgscomposerbase.ui
===================================================================
--- trunk/qgis/src/ui/qgscomposerbase.ui	2008-12-02 23:23:46 UTC (rev 9730)
+++ trunk/qgis/src/ui/qgscomposerbase.ui	2008-12-03 11:20:02 UTC (rev 9731)
@@ -5,7 +5,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
+    <width>710</width>
     <height>609</height>
    </rect>
   </property>
@@ -244,6 +244,13 @@
    <addaction name="mActionAddNewLegend" />
    <addaction name="mActionAddNewScalebar" />
    <addaction name="mActionSelectMoveItem" />
+   <addaction name="mActionMoveItemContent" />
+   <addaction name="mActionGroupItems" />
+   <addaction name="mActionUngroupItems" />
+   <addaction name="mActionRaiseItems" />
+   <addaction name="mActionLowerItems" />
+   <addaction name="mActionMoveItemsToTop" />
+   <addaction name="mActionMoveItemsToBottom" />
   </widget>
   <action name="mActionPrint" >
    <property name="icon" >
@@ -367,6 +374,41 @@
     <string>Add Image</string>
    </property>
   </action>
+  <action name="mActionMoveItemContent" >
+   <property name="text" >
+    <string>moveItemContent</string>
+   </property>
+  </action>
+  <action name="mActionGroupItems" >
+   <property name="text" >
+    <string>Group Items</string>
+   </property>
+  </action>
+  <action name="mActionUngroupItems" >
+   <property name="text" >
+    <string>Ungroup</string>
+   </property>
+  </action>
+  <action name="mActionRaiseItems" >
+   <property name="text" >
+    <string>Raise</string>
+   </property>
+  </action>
+  <action name="mActionLowerItems" >
+   <property name="text" >
+    <string>Lower</string>
+   </property>
+  </action>
+  <action name="mActionMoveItemsToTop" >
+   <property name="text" >
+    <string>Bring to front</string>
+   </property>
+  </action>
+  <action name="mActionMoveItemsToBottom" >
+   <property name="text" >
+    <string>Send to back</string>
+   </property>
+  </action>
  </widget>
  <tabstops>
   <tabstop>mOptionsTabWidget</tabstop>



More information about the QGIS-commit mailing list