[QGIS Commit] r9779 - in trunk/qgis/src: app/composer core/composer

svn_qgis at osgeo.org svn_qgis at osgeo.org
Sat Dec 13 03:34:46 EST 2008


Author: mhugent
Date: 2008-12-13 03:34:45 -0500 (Sat, 13 Dec 2008)
New Revision: 9779

Modified:
   trunk/qgis/src/app/composer/qgscomposerscalebarwidget.cpp
   trunk/qgis/src/core/composer/qgscomposerscalebar.cpp
   trunk/qgis/src/core/composer/qgscomposerscalebar.h
Log:
Pass untranslated scale bar stylename to QgsComposerScaleBar. Otherwise it is a problem if the translation is not consistent in QgsComposerScaleBarWidget and QgsComposerScaleBar

Modified: trunk/qgis/src/app/composer/qgscomposerscalebarwidget.cpp
===================================================================
--- trunk/qgis/src/app/composer/qgscomposerscalebarwidget.cpp	2008-12-13 01:28:05 UTC (rev 9778)
+++ trunk/qgis/src/app/composer/qgscomposerscalebarwidget.cpp	2008-12-13 08:34:45 UTC (rev 9779)
@@ -282,7 +282,36 @@
     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();
 }
 

Modified: trunk/qgis/src/core/composer/qgscomposerscalebar.cpp
===================================================================
--- trunk/qgis/src/core/composer/qgscomposerscalebar.cpp	2008-12-13 01:28:05 UTC (rev 9778)
+++ trunk/qgis/src/core/composer/qgscomposerscalebar.cpp	2008-12-13 08:34:45 UTC (rev 9779)
@@ -197,32 +197,32 @@
   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 );
   }

Modified: trunk/qgis/src/core/composer/qgscomposerscalebar.h
===================================================================
--- trunk/qgis/src/core/composer/qgscomposerscalebar.h	2008-12-13 01:28:05 UTC (rev 9778)
+++ trunk/qgis/src/core/composer/qgscomposerscalebar.h	2008-12-13 08:34:45 UTC (rev 9779)
@@ -83,7 +83,7 @@
     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*/



More information about the QGIS-commit mailing list