Skip to content

Commit

Permalink
Pass untranslated scale bar stylename to QgsComposerScaleBar. Otherwi…
Browse files Browse the repository at this point in the history
…se it is a problem if the translation is not consistent in QgsComposerScaleBarWidget and QgsComposerScaleBar

git-svn-id: http://svn.osgeo.org/qgis/trunk@9779 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Dec 13, 2008
1 parent 70f3329 commit 30c25c7
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 9 deletions.
31 changes: 30 additions & 1 deletion src/app/composer/qgscomposerscalebarwidget.cpp
Expand Up @@ -282,7 +282,36 @@ void QgsComposerScaleBarWidget::on_mStyleComboBox_currentIndexChanged( const QSt
return;
}

mComposerScaleBar->setStyle( text );
QString untranslatedStyleName;
if(text == tr("Single Box"))
{
untranslatedStyleName = "Single Box";
}
else if(text == tr("Double Box"))
{
untranslatedStyleName = "Double Box";
}
else if(text == tr( "Line Ticks Middle" ))
{
untranslatedStyleName = "Line Ticks Middle";
}
else if(text == tr("Line Ticks Middle"))
{
untranslatedStyleName = "Line Ticks Middle";
}
else if(text == tr( "Line Ticks Down" ))
{
untranslatedStyleName = "Line Ticks Down";
}
else if(text == tr( "Line Ticks Up"))
{
untranslatedStyleName = "Line Ticks Up";
}
else if(text == tr( "Numeric"))
{
untranslatedStyleName = "Numeric";
}
mComposerScaleBar->setStyle(untranslatedStyleName);
mComposerScaleBar->update();
}

Expand Down
14 changes: 7 additions & 7 deletions src/core/composer/qgscomposerscalebar.cpp
Expand Up @@ -197,32 +197,32 @@ void QgsComposerScaleBar::setStyle( const QString& styleName )
mStyle = 0;

//switch depending on style name
if ( styleName == tr( "Single Box" ) )
if ( styleName == "Single Box")
{
mStyle = new QgsSingleBoxScaleBarStyle( this );
}
else if ( styleName == tr( "Double Box" ) )
else if ( styleName == "Double Box")
{
mStyle = new QgsDoubleBoxScaleBarStyle( this );
}
else if ( styleName == tr( "Line Ticks Middle" ) || styleName == tr( "Line Ticks Down" ) || styleName == tr( "Line Ticks Up" ) )
else if ( styleName == "Line Ticks Middle" || styleName == "Line Ticks Down" || styleName == "Line Ticks Up" )
{
QgsTicksScaleBarStyle* tickStyle = new QgsTicksScaleBarStyle( this );
if ( styleName == tr( "Line Ticks Middle" ) )
if ( styleName == "Line Ticks Middle")
{
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksMiddle );
}
else if ( styleName == tr( "Line Ticks Down" ) )
else if ( styleName == "Line Ticks Down")
{
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksDown );
}
else if ( styleName == tr( "Line Ticks Up" ) )
else if ( styleName == "Line Ticks Up")
{
tickStyle->setTickPosition( QgsTicksScaleBarStyle::TicksUp );
}
mStyle = tickStyle;
}
else if ( styleName == tr( "Numeric" ) )
else if ( styleName == "Numeric")
{
mStyle = new QgsNumericScaleBarStyle( this );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposerscalebar.h
Expand Up @@ -83,7 +83,7 @@ class CORE_EXPORT QgsComposerScaleBar: public QObject, public QgsComposerItem
void applyDefaultSettings();

/**Sets style by name
possibilities are: */
@param styleName (untranslated) style name. Possibilities are: 'Single Box', 'Double Box', 'Line Ticks Middle', 'Line Ticks Down', 'Line Ticks Up', 'Numeric'*/
void setStyle( const QString& styleName );

/**Returns style name*/
Expand Down

0 comments on commit 30c25c7

Please sign in to comment.