Skip to content
Permalink
Browse files
Consider themes for all composer items and change icon themes in comp…
…oser together with application. Fixes bug #1438

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9731 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 3, 2008
1 parent 037b039 commit 598a66f2bed08d4692c2d284e4c5e287436516c3
Showing with 84 additions and 44 deletions.
  1. +23 −34 src/app/composer/qgscomposer.cpp
  2. +11 −9 src/app/composer/qgscomposer.h
  3. +6 −0 src/app/qgisapp.cpp
  4. +1 −0 src/app/qgsoptions.cpp
  5. +43 −1 src/ui/qgscomposerbase.ui
@@ -78,35 +78,16 @@ QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow()
// 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()));

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" ) );
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" ) );

QActionGroup* toggleActionGroup = new QActionGroup( this );
toggleActionGroup->addAction( moveItemContentAction );
toggleActionGroup->addAction( mActionMoveItemContent);
toggleActionGroup->addAction( mActionAddNewMap );
toggleActionGroup->addAction( mActionAddNewLabel );
toggleActionGroup->addAction( mActionAddNewLegend );
@@ -124,6 +105,7 @@ QgsComposer::QgsComposer( QgisApp *qgis ): QMainWindow()
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 @@ void QgsComposer::setupTheme()
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,55 +729,55 @@ void QgsComposer::on_mActionAddImage_activated( void )
}
}

void QgsComposer::moveItemContent()
void QgsComposer::on_mActionMoveItemContent_activated(void)
{
if ( mView )
{
mView->setCurrentTool( QgsComposerView::MoveItemContent );
}
}

void QgsComposer::groupItems( void )
void QgsComposer::on_mActionGroupItems_activated( void )
{
if ( mView )
{
mView->groupItems();
}
}

void QgsComposer::ungroupItems( void )
void QgsComposer::on_mActionUngroupItems_activated( void )
{
if ( mView )
{
mView->ungroupItems();
}
}

void QgsComposer::raiseSelectedItems()
void QgsComposer::on_mActionRaiseItems_activated( void )
{
if ( mComposition )
{
mComposition->raiseSelectedItems();
}
}

void QgsComposer::lowerSelectedItems()
void QgsComposer::on_mActionLowerItems_activated(void)
{
if ( mComposition )
{
mComposition->lowerSelectedItems();
}
}

void QgsComposer::moveSelectedItemsToTop()
void QgsComposer::on_mActionMoveItemsToTop_activated(void)
{
if ( mComposition )
{
mComposition->moveSelectedItemsToTop();
}
}

void QgsComposer::moveSelectedItemsToBottom()
void QgsComposer::on_mActionMoveItemsToBottom(void)
{
if ( mComposition )
{
@@ -50,6 +50,9 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
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 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
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 @@ class QgsComposer: public QMainWindow, private Ui::QgsComposerBase
void activate();

private:
//! Set the pixmap / icons on the toolbar buttons
void setupTheme();

/**Establishes the signal slot connection for the class*/
void connectSlots();

@@ -304,6 +304,7 @@ QgisApp *QgisApp::smInstance = 0;
QgisApp::QgisApp( QSplashScreen *splash, QWidget * parent, Qt::WFlags fl )
: QMainWindow( parent, fl ),
mSplash( splash ),
mComposer(0),
mPythonConsole( NULL ),
mPythonUtils( NULL )
{
@@ -1480,6 +1481,11 @@ void QgisApp::setTheme( QString theThemeName )
mActionCustomProjection->setIcon( getThemeIcon( "/mActionCustomProjection.png" ) );
mActionAddWmsLayer->setIcon( getThemeIcon( "/mActionAddWmsLayer.png" ) );
mActionAddToOverview->setIcon( getThemeIcon( "/mActionInOverview.png" ) );

if(mComposer)
{
mComposer->setupTheme();
}
}

void QgisApp::setupConnections()
@@ -245,6 +245,7 @@ void QgsOptions::themeChanged( const QString &newThemeName )
QString newt = newThemeName;
QgisApp::instance()->setTheme( newt );
}

QString QgsOptions::theme()
{
// returns the current theme (as selected in the cmbTheme combo box)
@@ -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>

0 comments on commit 598a66f

Please sign in to comment.