Skip to content

Commit

Permalink
Add icons for GPS toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 4, 2022
1 parent dd47e25 commit 6af57f7
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
5 changes: 5 additions & 0 deletions images/images.qrc
Expand Up @@ -966,6 +966,11 @@
<file>themes/default/mIconFonts.svg</file>
<file>themes/default/mActionNewFileGeodatabase.svg</file>
<file>themes/default/mIconBrowserRelations.svg</file>
<file>themes/default/gpsicons/mIconGpsConnect.svg</file>
<file>themes/default/gpsicons/mIconGpsDisconnect.svg</file>
<file>themes/default/gpsicons/mActionRecenter.svg</file>
<file>themes/default/gpsicons/mActionReset.svg</file>
<file>themes/default/gpsicons/mActionAddTrackPoint.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
1 change: 1 addition & 0 deletions images/themes/default/gpsicons/mActionAddTrackPoint.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/gpsicons/mActionRecenter.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/gpsicons/mActionReset.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/gpsicons/mIconGpsConnect.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions images/themes/default/gpsicons/mIconGpsDisconnect.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 19 additions & 6 deletions src/app/gps/qgsgpstoolbar.cpp
Expand Up @@ -38,7 +38,9 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can

mWgs84CRS = QgsCoordinateReferenceSystem::fromOgcWmsCrs( QStringLiteral( "EPSG:4326" ) );

mConnectAction = new QAction( tr( "Connect" ), this );
mConnectAction = new QAction( tr( "Connect GPS" ), this );
mConnectAction->setToolTip( tr( "Connect to GPS" ) );
mConnectAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/gpsicons/mIconGpsConnect.svg" ) ) );
mConnectAction->setCheckable( true );
addAction( mConnectAction );

Expand All @@ -52,6 +54,7 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can

mRecenterAction = new QAction( tr( "Recenter" ) );
mRecenterAction->setToolTip( tr( "Recenter map on GPS location" ) );
mRecenterAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/gpsicons/mActionRecenter.svg" ) ) );
mRecenterAction->setEnabled( false );

connect( mRecenterAction, &QAction::triggered, this, [ = ]
Expand All @@ -77,20 +80,24 @@ QgsGpsToolBar::QgsGpsToolBar( QgsAppGpsConnection *connection, QgsMapCanvas *can

mAddTrackPointAction = new QAction( tr( "Add Track Point" ), this );
mAddTrackPointAction->setEnabled( false );
mAddTrackPointAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/gpsicons/mActionAddTrackPoint.svg" ) ) );
connect( mAddTrackPointAction, &QAction::triggered, this, &QgsGpsToolBar::addVertexClicked );
addAction( mAddTrackPointAction );

mAddFeatureAction = new QAction( tr( "Add Feature" ), this );
mAddFeatureAction = new QAction( tr( "Create Feature" ), this );
mAddFeatureAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionCaptureLine.svg" ) ) );
connect( mAddFeatureAction, &QAction::triggered, this, &QgsGpsToolBar::addFeatureClicked );
addAction( mAddFeatureAction );

mResetFeatureAction = new QAction( tr( "Reset Feature" ), this );
mResetFeatureAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/gpsicons/mActionReset.svg" ) ) );
connect( mResetFeatureAction, &QAction::triggered, this, &QgsGpsToolBar::resetFeatureClicked );
addAction( mResetFeatureAction );

addSeparator();

mShowInfoAction = new QAction( tr( "Information" ) );
mShowInfoAction->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionPropertiesWidget.svg" ) ) );
mShowInfoAction->setToolTip( tr( "Show GPS Information Panel" ) );
mShowInfoAction->setCheckable( true );
addAction( mShowInfoAction );
Expand Down Expand Up @@ -198,7 +205,8 @@ void QgsGpsToolBar::updateCloseFeatureButton( QgsMapLayer *lyr )
mLastLayer = vlayer;
}

QString buttonLabel = tr( "&Add Feature" );
QString buttonLabel = tr( "Create Feature" );
QString icon = QStringLiteral( "mActionCaptureLine.svg" );;
if ( vlayer )
{
QgsVectorDataProvider *provider = vlayer->dataProvider();
Expand All @@ -210,15 +218,18 @@ void QgsGpsToolBar::updateCloseFeatureButton( QgsMapLayer *lyr )
switch ( layerGeometryType )
{
case QgsWkbTypes::PointGeometry:
buttonLabel = tr( "&Add Point" );
buttonLabel = tr( "Create Point Feature" );
icon = QStringLiteral( "mActionCapturePoint.svg" );
break;

case QgsWkbTypes::LineGeometry:
buttonLabel = tr( "&Add Line" );
buttonLabel = tr( "Create Line Feature" );
icon = QStringLiteral( "mActionCaptureLine.svg" );
break;

case QgsWkbTypes::PolygonGeometry:
buttonLabel = tr( "&Add Polygon" );
buttonLabel = tr( "Create Polygon Feature" );
icon = QStringLiteral( "mActionCapturePolygon.svg" );
break;

case QgsWkbTypes::UnknownGeometry:
Expand All @@ -234,6 +245,8 @@ void QgsGpsToolBar::updateCloseFeatureButton( QgsMapLayer *lyr )
mAddFeatureAction->setEnabled( false );
}
mAddFeatureAction->setText( buttonLabel );
mAddFeatureAction->setIcon( QgsApplication::getThemeIcon( icon ) );
mAddFeatureAction->setToolTip( buttonLabel );
}

void QgsGpsToolBar::layerEditStateChanged()
Expand Down

0 comments on commit 6af57f7

Please sign in to comment.