Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
move getThemeIcon() and getThemePixmap() to QgsApplication
  • Loading branch information
etiennesky committed Jul 16, 2012
1 parent d5e8745 commit 008592b
Show file tree
Hide file tree
Showing 32 changed files with 330 additions and 339 deletions.
74 changes: 37 additions & 37 deletions src/app/composer/qgscomposer.cpp
Expand Up @@ -303,43 +303,43 @@ void QgsComposer::setupTheme()
{
//now set all the icons - getThemeIcon will fall back to default theme if its
//missing from active theme
mActionQuit->setIcon( QgisApp::getThemeIcon( "/mActionFileExit.png" ) );
mActionLoadFromTemplate->setIcon( QgisApp::getThemeIcon( "/mActionFileOpen.png" ) );
mActionSaveAsTemplate->setIcon( QgisApp::getThemeIcon( "/mActionFileSaveAs.png" ) );
mActionExportAsImage->setIcon( QgisApp::getThemeIcon( "/mActionSaveMapAsImage.png" ) );
mActionExportAsSVG->setIcon( QgisApp::getThemeIcon( "/mActionSaveAsSVG.png" ) );
mActionExportAsPDF->setIcon( QgisApp::getThemeIcon( "/mActionSaveAsPDF.png" ) );
mActionPrint->setIcon( QgisApp::getThemeIcon( "/mActionFilePrint.png" ) );
mActionZoomAll->setIcon( QgisApp::getThemeIcon( "/mActionZoomFullExtent.png" ) );
mActionZoomIn->setIcon( QgisApp::getThemeIcon( "/mActionZoomIn.png" ) );
mActionZoomOut->setIcon( QgisApp::getThemeIcon( "/mActionZoomOut.png" ) );
mActionRefreshView->setIcon( QgisApp::getThemeIcon( "/mActionDraw.png" ) );
mActionUndo->setIcon( QgisApp::getThemeIcon( "/mActionUndo.png" ) );
mActionRedo->setIcon( QgisApp::getThemeIcon( "/mActionRedo.png" ) );
mActionAddImage->setIcon( QgisApp::getThemeIcon( "/mActionAddImage.png" ) );
mActionAddNewMap->setIcon( QgisApp::getThemeIcon( "/mActionAddMap.png" ) );
mActionAddNewLabel->setIcon( QgisApp::getThemeIcon( "/mActionLabel.png" ) );
mActionAddNewLegend->setIcon( QgisApp::getThemeIcon( "/mActionAddLegend.png" ) );
mActionAddNewScalebar->setIcon( QgisApp::getThemeIcon( "/mActionScaleBar.png" ) );
mActionAddRectangle->setIcon( QgisApp::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddTriangle->setIcon( QgisApp::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddEllipse->setIcon( QgisApp::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddArrow->setIcon( QgisApp::getThemeIcon( "/mActionAddArrow.png" ) );
mActionAddTable->setIcon( QgisApp::getThemeIcon( "/mActionOpenTable.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" ) );
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" ) );
mActionQuit->setIcon( QgsApplication::getThemeIcon( "/mActionFileExit.png" ) );
mActionLoadFromTemplate->setIcon( QgsApplication::getThemeIcon( "/mActionFileOpen.png" ) );
mActionSaveAsTemplate->setIcon( QgsApplication::getThemeIcon( "/mActionFileSaveAs.png" ) );
mActionExportAsImage->setIcon( QgsApplication::getThemeIcon( "/mActionSaveMapAsImage.png" ) );
mActionExportAsSVG->setIcon( QgsApplication::getThemeIcon( "/mActionSaveAsSVG.png" ) );
mActionExportAsPDF->setIcon( QgsApplication::getThemeIcon( "/mActionSaveAsPDF.png" ) );
mActionPrint->setIcon( QgsApplication::getThemeIcon( "/mActionFilePrint.png" ) );
mActionZoomAll->setIcon( QgsApplication::getThemeIcon( "/mActionZoomFullExtent.png" ) );
mActionZoomIn->setIcon( QgsApplication::getThemeIcon( "/mActionZoomIn.png" ) );
mActionZoomOut->setIcon( QgsApplication::getThemeIcon( "/mActionZoomOut.png" ) );
mActionRefreshView->setIcon( QgsApplication::getThemeIcon( "/mActionDraw.png" ) );
mActionUndo->setIcon( QgsApplication::getThemeIcon( "/mActionUndo.png" ) );
mActionRedo->setIcon( QgsApplication::getThemeIcon( "/mActionRedo.png" ) );
mActionAddImage->setIcon( QgsApplication::getThemeIcon( "/mActionAddImage.png" ) );
mActionAddNewMap->setIcon( QgsApplication::getThemeIcon( "/mActionAddMap.png" ) );
mActionAddNewLabel->setIcon( QgsApplication::getThemeIcon( "/mActionLabel.png" ) );
mActionAddNewLegend->setIcon( QgsApplication::getThemeIcon( "/mActionAddLegend.png" ) );
mActionAddNewScalebar->setIcon( QgsApplication::getThemeIcon( "/mActionScaleBar.png" ) );
mActionAddRectangle->setIcon( QgsApplication::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddTriangle->setIcon( QgsApplication::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddEllipse->setIcon( QgsApplication::getThemeIcon( "/mActionAddBasicShape.png" ) );
mActionAddArrow->setIcon( QgsApplication::getThemeIcon( "/mActionAddArrow.png" ) );
mActionAddTable->setIcon( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ) );
mActionSelectMoveItem->setIcon( QgsApplication::getThemeIcon( "/mActionSelectPan.png" ) );
mActionMoveItemContent->setIcon( QgsApplication::getThemeIcon( "/mActionMoveItemContent.png" ) );
mActionGroupItems->setIcon( QgsApplication::getThemeIcon( "/mActionGroupItems.png" ) );
mActionUngroupItems->setIcon( QgsApplication::getThemeIcon( "/mActionUngroupItems.png" ) );
mActionRaiseItems->setIcon( QgsApplication::getThemeIcon( "/mActionRaiseItems.png" ) );
mActionLowerItems->setIcon( QgsApplication::getThemeIcon( "/mActionLowerItems.png" ) );
mActionMoveItemsToTop->setIcon( QgsApplication::getThemeIcon( "/mActionMoveItemsToTop.png" ) );
mActionMoveItemsToBottom->setIcon( QgsApplication::getThemeIcon( "/mActionMoveItemsToBottom.png" ) );
mActionAlignLeft->setIcon( QgsApplication::getThemeIcon( "/mActionAlignLeft.png" ) );
mActionAlignHCenter->setIcon( QgsApplication::getThemeIcon( "/mActionAlignHCenter.png" ) );
mActionAlignRight->setIcon( QgsApplication::getThemeIcon( "/mActionAlignRight.png" ) );
mActionAlignTop->setIcon( QgsApplication::getThemeIcon( "/mActionAlignTop.png" ) );
mActionAlignVCenter->setIcon( QgsApplication::getThemeIcon( "/mActionAlignVCenter.png" ) );
mActionAlignBottom->setIcon( QgsApplication::getThemeIcon( "/mActionAlignBottom.png" ) );
}

void QgsComposer::setIconSizes( int size )
Expand Down
22 changes: 11 additions & 11 deletions src/app/legend/qgslegend.cpp
Expand Up @@ -674,13 +674,13 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
}
else if ( li->type() == QgsLegendItem::LEGEND_GROUP )
{
theMenu.addAction( QgisApp::getThemeIcon( "/mActionZoomToLayer.png" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionZoomToLayer.png" ),
tr( "Zoom to Group" ), this, SLOT( legendLayerZoom() ) );

// use QGisApp::removeLayer() to remove all selected layers+groups
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );

theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetCRS.png" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ),
tr( "&Set Group CRS" ), this, SLOT( legendGroupSetCRS() ) );
}

Expand Down Expand Up @@ -709,11 +709,11 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi
}
}

theMenu.addAction( QgisApp::getThemeIcon( "/folder_new.png" ), tr( "&Add New Group" ), this, SLOT( addGroupToCurrentItem() ) );
theMenu.addAction( QgisApp::getThemeIcon( "/mActionExpandTree.png" ), tr( "&Expand All" ), this, SLOT( expandAll() ) );
theMenu.addAction( QgisApp::getThemeIcon( "/mActionCollapseTree.png" ), tr( "&Collapse All" ), this, SLOT( collapseAll() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/folder_new.png" ), tr( "&Add New Group" ), this, SLOT( addGroupToCurrentItem() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionExpandTree.png" ), tr( "&Expand All" ), this, SLOT( expandAll() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionCollapseTree.png" ), tr( "&Collapse All" ), this, SLOT( collapseAll() ) );

QAction *updateDrawingOrderAction = theMenu.addAction( QgisApp::getThemeIcon( "/mUpdateDrawingOrder.png" ), tr( "&Update Drawing Order" ), this, SLOT( toggleDrawingOrderUpdate() ) );
QAction *updateDrawingOrderAction = theMenu.addAction( QgsApplication::getThemeIcon( "/mUpdateDrawingOrder.png" ), tr( "&Update Drawing Order" ), this, SLOT( toggleDrawingOrderUpdate() ) );
updateDrawingOrderAction->setCheckable( true );
updateDrawingOrderAction->setChecked( mUpdateDrawingOrder );

Expand All @@ -722,10 +722,10 @@ void QgsLegend::handleRightClickEvent( QTreeWidgetItem* item, const QPoint& posi

void QgsLegend::initPixmaps()
{
mPixmaps.mOriginalPixmap = QgisApp::getThemePixmap( "/mActionFileSmall.png" );
mPixmaps.mInOverviewPixmap = QgisApp::getThemePixmap( "/mActionInOverview.png" );
mPixmaps.mEditablePixmap = QgisApp::getThemePixmap( "/mIconEditable.png" );
mPixmaps.mProjectionErrorPixmap = QgisApp::getThemePixmap( "/mIconProjectionProblem.png" );
mPixmaps.mOriginalPixmap = QgsApplication::getThemePixmap( "/mActionFileSmall.png" );
mPixmaps.mInOverviewPixmap = QgsApplication::getThemePixmap( "/mActionInOverview.png" );
mPixmaps.mEditablePixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
mPixmaps.mProjectionErrorPixmap = QgsApplication::getThemePixmap( "/mIconProjectionProblem.png" );
}

Qt::CheckState QgsLegend::layerCheckState( QgsMapLayer * layer )
Expand Down
6 changes: 3 additions & 3 deletions src/app/legend/qgslegendgroup.cpp
Expand Up @@ -25,7 +25,7 @@ QgsLegendGroup::QgsLegendGroup( QTreeWidgetItem * theItem, QString theName )
mType = LEGEND_GROUP;
setFlags( Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
setCheckState( 0, Qt::Checked );
QIcon myIcon = QgisApp::getThemeIcon( "/mActionFolder.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mActionFolder.png" );
setIcon( 0, myIcon );
}
QgsLegendGroup::QgsLegendGroup( QTreeWidget* theListView, QString theString )
Expand All @@ -34,7 +34,7 @@ QgsLegendGroup::QgsLegendGroup( QTreeWidget* theListView, QString theString )
mType = LEGEND_GROUP;
setFlags( Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
setCheckState( 0, Qt::Checked );
QIcon myIcon = QgisApp::getThemeIcon( "/mActionFolder.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mActionFolder.png" );
setIcon( 0, myIcon );
}

Expand All @@ -43,7 +43,7 @@ QgsLegendGroup::QgsLegendGroup( QString name ): QgsLegendItem()
mType = LEGEND_GROUP;
setFlags( Qt::ItemIsEditable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsSelectable );
setCheckState( 0, Qt::Checked );
QIcon myIcon = QgisApp::getThemeIcon( + "/mActionFolder.png" );
QIcon myIcon = QgsApplication::getThemeIcon( + "/mActionFolder.png" );
setText( 0, name );
setIcon( 0, myIcon );
}
Expand Down
26 changes: 13 additions & 13 deletions src/app/legend/qgslegendlayer.cpp
Expand Up @@ -325,7 +325,7 @@ void QgsLegendLayer::updateIcon()
if ( theFile->isInOverview() )
{
// Overlay the overview icon on the default icon
QPixmap myPixmap = QgisApp::getThemePixmap( "/mIconOverview.png" );
QPixmap myPixmap = QgsApplication::getThemePixmap( "/mIconOverview.png" );
QPainter p( &newIcon );
p.drawPixmap( 0, 0, myPixmap );
p.end();
Expand All @@ -334,7 +334,7 @@ void QgsLegendLayer::updateIcon()
//editable
if ( theLayer->isEditable() )
{
QPixmap myPixmap = QgisApp::getThemePixmap( "/mIconEditable.png" );
QPixmap myPixmap = QgsApplication::getThemePixmap( "/mIconEditable.png" );
// use editable icon instead of the layer's type icon
newIcon = myPixmap;

Expand Down Expand Up @@ -371,15 +371,15 @@ QPixmap QgsLegendLayer::getOriginalPixmap()
switch ( vlayer->geometryType() )
{
case QGis::Point:
return QgisApp::getThemePixmap( "/mIconPointLayer.png" );
return QgsApplication::getThemePixmap( "/mIconPointLayer.png" );
case QGis::Line:
return QgisApp::getThemePixmap( "/mIconLineLayer.png" );
return QgsApplication::getThemePixmap( "/mIconLineLayer.png" );
case QGis::Polygon:
return QgisApp::getThemePixmap( "/mIconPolygonLayer.png" );
return QgsApplication::getThemePixmap( "/mIconPolygonLayer.png" );
case QGis::NoGeometry:
return QgisApp::getThemePixmap( "/mIconTableLayer.png" );
return QgsApplication::getThemePixmap( "/mIconTableLayer.png" );
default:
return QgisApp::getThemePixmap( "/mIconLayer.png" );
return QgsApplication::getThemePixmap( "/mIconLayer.png" );
}
}
else if ( theLayer->type() == QgsMapLayer::RasterLayer )
Expand All @@ -400,7 +400,7 @@ QPixmap QgsLegendLayer::getOriginalPixmap()
}

// undefined - should never reach this
return QgisApp::getThemePixmap( "/mIconLayer.png" );
return QgsApplication::getThemePixmap( "/mIconLayer.png" );
}

void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
Expand All @@ -409,7 +409,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
QAction *toggleEditingAction = QgisApp::instance()->actionToggleEditing();

// zoom to layer extent
theMenu.addAction( QgisApp::getThemeIcon( "/mActionZoomToLayer.png" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionZoomToLayer.png" ),
tr( "&Zoom to Layer Extent" ), legend(), SLOT( legendLayerZoom() ) );
if ( lyr->type() == QgsMapLayer::RasterLayer )
{
Expand All @@ -430,13 +430,13 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
showInOverviewAction->blockSignals( false );

// remove from canvas
theMenu.addAction( QgisApp::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionRemoveLayer.png" ), tr( "&Remove" ), QgisApp::instance(), SLOT( removeLayer() ) );

// set layer crs
theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetCRS.png" ), tr( "&Set Layer CRS" ), QgisApp::instance(), SLOT( setLayerCRS() ) );

// assign layer crs to project
theMenu.addAction( QgisApp::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionSetProjectCRS.png" ), tr( "Set &Project CRS from Layer" ), QgisApp::instance(), SLOT( setProjectCRSFromLayer() ) );

theMenu.addSeparator();

Expand All @@ -445,7 +445,7 @@ void QgsLegendLayer::addToPopupMenu( QMenu& theMenu )
QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( lyr );

// attribute table
theMenu.addAction( QgisApp::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ),
theMenu.addAction( QgsApplication::getThemeIcon( "/mActionOpenTable.png" ), tr( "&Open Attribute Table" ),
QgisApp::instance(), SLOT( attributeTable() ) );

// allow editing
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendpropertygroup.cpp
Expand Up @@ -22,7 +22,7 @@ QgsLegendPropertyGroup::QgsLegendPropertyGroup( QTreeWidgetItem* theLegendItem,
: QgsLegendItem( theLegendItem, theString )
{
mType = LEGEND_PROPERTY_GROUP;
QIcon myIcon = QgisApp::getThemeIcon( "/mIconProperties.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mIconProperties.png" );
setText( 0, theString );
setIcon( 0, myIcon );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/legend/qgslegendsymbologygroup.cpp
Expand Up @@ -23,7 +23,7 @@ QgsLegendSymbologyGroup::QgsLegendSymbologyGroup( QTreeWidgetItem * theItem, QSt
: QgsLegendItem( theItem, theString )
{
mType = LEGEND_SYMBOL_GROUP;
QIcon myIcon = QgisApp::getThemeIcon( "/mIconSymbology.png" );
QIcon myIcon = QgsApplication::getThemeIcon( "/mIconSymbology.png" );
setText( 0, theString );
setIcon( 0, myIcon );
}
Expand Down

0 comments on commit 008592b

Please sign in to comment.