[QGIS Commit] r9740 - in branches/advanced_printing_branch2/src: app/composer ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Thu Dec 4 09:40:18 EST 2008


Author: mhugent
Date: 2008-12-04 09:40:18 -0500 (Thu, 04 Dec 2008)
New Revision: 9740

Modified:
   branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp
   branches/advanced_printing_branch2/src/app/composer/qgscomposer.h
   branches/advanced_printing_branch2/src/ui/qgscomposerbase.ui
Log:
Make the new icons themeable and move actions to ui file

Modified: branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp	2008-12-04 12:50:34 UTC (rev 9739)
+++ branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp	2008-12-04 14:40:18 UTC (rev 9740)
@@ -70,8 +70,6 @@
   setupUi( this );
   setupTheme();
 
-  QString myIconPath = QgsApplication::activeThemePath();
-
   QToolButton* orderingToolButton = new QToolButton(this);
   orderingToolButton->setPopupMode(QToolButton::InstantPopup);
   orderingToolButton->setAutoRaise(true);
@@ -89,43 +87,13 @@
   alignToolButton->setAutoRaise(true);
   alignToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
 
-  //align left
-  QAction* alignLeftAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignLeft.png")), tr("Align left"), this);
-  QObject::connect(alignLeftAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsLeft()));
-  alignLeftAction->setToolTip(tr("Align selected items left"));
-
-  //align hcenter
-  QAction* alignHCenterAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignHCenter.png")), tr("Align center horizontal"), this);
-  QObject::connect(alignHCenterAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsHCenter()));
-  alignHCenterAction->setToolTip( tr("Align center horizontal"));
-
-  //align right
-  QAction* alignRightAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignRight.png")), tr("Align right"), this);
-  QObject::connect(alignRightAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsRight()));
-  alignRightAction->setToolTip( tr("Align selected items right"));
-
-  //align top
-  QAction* alignTopAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignTop.png")), tr("Align top"), this);
-  QObject::connect(alignTopAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsTop()));
-  alignTopAction->setToolTip( tr("Align selected items to top"));
-  
-  //align vcenter
-  QAction* alignVCenterAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignVCenter.png")), tr("Align center vertical"), this);
-  QObject::connect(alignVCenterAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsVCenter()));
-  alignVCenterAction->setToolTip(tr("Align center vertical"));
-
-  //align bottom
-  QAction* alignBottomAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignBottom.png")), tr("Align bottom"), this);
-  QObject::connect(alignBottomAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsBottom()));
-  alignBottomAction->setToolTip( tr("Align selected items bottom"));
-
-  alignToolButton->addAction(alignLeftAction);
-  alignToolButton->addAction(alignHCenterAction);
-  alignToolButton->addAction(alignRightAction);
-  alignToolButton->addAction(alignTopAction);
-  alignToolButton->addAction(alignVCenterAction);
-  alignToolButton->addAction(alignBottomAction);
-  alignToolButton->setDefaultAction(alignLeftAction);
+  alignToolButton->addAction(mActionAlignLeft);
+  alignToolButton->addAction(mActionAlignHCenter);
+  alignToolButton->addAction(mActionAlignRight);
+  alignToolButton->addAction(mActionAlignTop);
+  alignToolButton->addAction(mActionAlignVCenter);
+  alignToolButton->addAction(mActionAlignBottom);
+  alignToolButton->setDefaultAction(mActionAlignLeft);
   toolBar->addWidget(alignToolButton);
 
   QActionGroup* toggleActionGroup = new QActionGroup( this );
@@ -289,6 +257,12 @@
   mActionLowerItems->setIcon( QgisApp::getThemeIcon("/mActionLowerItems.png"));
   mActionMoveItemsToTop->setIcon( QgisApp::getThemeIcon("/mActionMoveItemsToTop.png"));
   mActionMoveItemsToBottom->setIcon( QgisApp::getThemeIcon("/mActionMoveItemsToBottom.png"));
+  mActionAlignLeft->setIcon(QgisApp::getThemeIcon("/mActionAlignLeft.png"));
+  mActionAlignHCenter->setIcon(QgisApp::getThemeIcon("/mActionAlignHCenter.png"));
+  mActionAlignRight->setIcon(QgisApp::getThemeIcon("/mActionAlignRight.png"));
+  mActionAlignTop->setIcon(QgisApp::getThemeIcon("/mActionAlignTop.png"));
+  mActionAlignVCenter->setIcon(QgisApp::getThemeIcon("/mActionAlignVCenter.png"));
+  mActionAlignBottom->setIcon(QgisApp::getThemeIcon("/mActionAlignBottom.png"));
 }
 
 void QgsComposer::connectSlots()
@@ -772,7 +746,7 @@
   }
 }
 
-void QgsComposer::saveAsTemplate(void)
+void QgsComposer::on_mActionSaveAsTemplate_activated(void)
 {
   //show file dialog
   QSettings settings;
@@ -802,7 +776,7 @@
   }
 }
 
-void QgsComposer::loadFromTemplate(void)
+void QgsComposer::on_mActionLoadFromTemplate_activated(void)
 {
   QSettings settings;
   QString openFileDir = settings.value("UI/lastComposerTemplateDir", "").toString();
@@ -884,7 +858,7 @@
   }
 }
 
-void QgsComposer::on_mActionMoveItemsToBottom(void)
+void QgsComposer::on_mActionMoveItemsToBottom_activated(void)
 {
   if ( mComposition )
   {
@@ -892,7 +866,7 @@
   }
 }
 
-void QgsComposer::alignSelectedItemsLeft()
+void QgsComposer::on_mActionAlignLeft_activated(void)
 {
   if(mComposition)
     {
@@ -900,7 +874,7 @@
     }
 }
 
-void QgsComposer::alignSelectedItemsHCenter()
+void QgsComposer::on_mActionAlignHCenter_activated(void)
 {
   if(mComposition)
     {
@@ -908,7 +882,7 @@
     }
 }
 
-void QgsComposer::alignSelectedItemsRight()
+void QgsComposer::on_mActionAlignRight_activated(void)
 {
   if(mComposition)
     {
@@ -916,7 +890,7 @@
     }
 }
 
-void QgsComposer::alignSelectedItemsTop()
+void QgsComposer::on_mActionAlignTop_activated(void)
 {
   if(mComposition)
     {
@@ -924,7 +898,7 @@
     }
 }
 
-void QgsComposer::alignSelectedItemsVCenter()
+void QgsComposer::on_mActionAlignVCenter_activated(void)
 {
   if(mComposition)
     {
@@ -932,7 +906,7 @@
     }
 }
 
-void QgsComposer::alignSelectedItemsBottom()
+void QgsComposer::on_mActionAlignBottom_activated(void)
 {
   if(mComposition)
     {

Modified: branches/advanced_printing_branch2/src/app/composer/qgscomposer.h
===================================================================
--- branches/advanced_printing_branch2/src/app/composer/qgscomposer.h	2008-12-04 12:50:34 UTC (rev 9739)
+++ branches/advanced_printing_branch2/src/app/composer/qgscomposer.h	2008-12-04 14:40:18 UTC (rev 9740)
@@ -133,9 +133,9 @@
     void on_mActionAddImage_activated( void );
 
     //! Save composer as template
-    void saveAsTemplate(void);
+    void on_mActionSaveAsTemplate_activated(void);
 
-    void loadFromTemplate(void);
+    void on_mActionLoadFromTemplate_activated(void);
 
     //! Set tool to move item content
     void on_mActionMoveItemContent_activated(void);
@@ -156,25 +156,25 @@
     void on_mActionMoveItemsToTop_activated(void);
 
     //!Move selected items to bottom
-    void on_mActionMoveItemsToBottom(void);
+    void on_mActionMoveItemsToBottom_activated(void);
 
     //!Align selected composer items left
-    void alignSelectedItemsLeft();
+    void on_mActionAlignLeft_activated(void);
 
     //!Align selected composere items horizontally centered
-    void alignSelectedItemsHCenter();
+    void on_mActionAlignHCenter_activated(void);
 
     //!Align selected composer items right
-    void alignSelectedItemsRight();
+    void on_mActionAlignRight_activated(void);
 
     //!Align selected composer items to top
-    void alignSelectedItemsTop();
+    void on_mActionAlignTop_activated(void);
 
     //!Align selected composer items vertically centered
-    void alignSelectedItemsVCenter();
+    void on_mActionAlignVCenter_activated(void);
 
     //!Align selected composer items to bottom
-    void alignSelectedItemsBottom();
+    void on_mActionAlignBottom_activated(void);
 
     //! Save window state
     void saveWindowState();

Modified: branches/advanced_printing_branch2/src/ui/qgscomposerbase.ui
===================================================================
--- branches/advanced_printing_branch2/src/ui/qgscomposerbase.ui	2008-12-04 12:50:34 UTC (rev 9739)
+++ branches/advanced_printing_branch2/src/ui/qgscomposerbase.ui	2008-12-04 14:40:18 UTC (rev 9740)
@@ -5,7 +5,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>1769</width>
+    <width>737</width>
     <height>609</height>
    </rect>
   </property>
@@ -438,6 +438,54 @@
     <string>Save as template</string>
    </property>
   </action>
+  <action name="mActionAlignLeft" >
+   <property name="text" >
+    <string>Align left</string>
+   </property>
+   <property name="toolTip" >
+    <string>Align selected items left</string>
+   </property>
+  </action>
+  <action name="mActionAlignHCenter" >
+   <property name="text" >
+    <string>Align center</string>
+   </property>
+   <property name="toolTip" >
+    <string>Align center horizontal</string>
+   </property>
+  </action>
+  <action name="mActionAlignRight" >
+   <property name="text" >
+    <string>Align right</string>
+   </property>
+   <property name="toolTip" >
+    <string>Align selected items right</string>
+   </property>
+  </action>
+  <action name="mActionAlignTop" >
+   <property name="text" >
+    <string>Align top</string>
+   </property>
+   <property name="toolTip" >
+    <string>Align selected items to top</string>
+   </property>
+  </action>
+  <action name="mActionAlignVCenter" >
+   <property name="text" >
+    <string>Align center vertical</string>
+   </property>
+   <property name="toolTip" >
+    <string>Align center vertical</string>
+   </property>
+  </action>
+  <action name="mActionAlignBottom" >
+   <property name="text" >
+    <string>Align bottom</string>
+   </property>
+   <property name="toolTip" >
+    <string>Align selected items bottom</string>
+   </property>
+  </action>
  </widget>
  <tabstops>
   <tabstop>mOptionsTabWidget</tabstop>



More information about the QGIS-commit mailing list