summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-10-13 16:12:59 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-10-13 16:12:59 (GMT)
commit19222df231d65c7193499a5acbfda42a3e726a96 (patch)
tree8fa2396bea58dbd0fc23a8429289e7a3e750b8ca
parent861e5adb6ad8331a9fa4f56f2533eb4b54fc76c5 (diff)
Make labels in statusbar localizable, use localized ones for size calculation
-rw-r--r--src/apps/marble-qt/QtMainWindow.cpp31
1 files changed, 8 insertions, 23 deletions
diff --git a/src/apps/marble-qt/QtMainWindow.cpp b/src/apps/marble-qt/QtMainWindow.cpp
index c024b56..ba8eb46 100644
--- a/src/apps/marble-qt/QtMainWindow.cpp
+++ b/src/apps/marble-qt/QtMainWindow.cpp
@@ -84,14 +84,6 @@
#include "DataMigration.h"
#include "TileCoordsPyramid.h"
-namespace
-{
- const char POSITION_STRING[] = "Position:";
- const char DISTANCE_STRING[] = "Altitude:";
- const char ZOOM_STRING[] = "Zoom:";
- const char DATETIME_STRING[] = "Time:";
-}
-
using namespace Marble;
/* TRANSLATOR Marble::MainWindow */
@@ -957,20 +949,16 @@ void MainWindow::showDateTime()
void MainWindow::updateStatusBar()
{
if ( m_positionLabel )
- m_positionLabel->setText( QString( "%1 %2" ).
- arg( tr( POSITION_STRING ) ).arg( m_position ) );
+ m_positionLabel->setText(tr("Position:") + QLatin1Char(' ') + m_position);
if ( m_distanceLabel )
- m_distanceLabel->setText( QString( "%1 %2" )
- .arg( tr( DISTANCE_STRING ) ).arg( m_distance ) );
+ m_distanceLabel->setText(tr("Altitude:") + QLatin1Char(' ') + m_distance);
if ( m_zoomLabel )
- m_zoomLabel->setText( QString( "%1 %2" )
- .arg( tr( ZOOM_STRING ) ).arg( m_zoom ) );
+ m_zoomLabel->setText(tr("Zoom:") + QLatin1Char(' ') + m_zoom);
if ( m_clockLabel )
- m_clockLabel->setText( QString( "%1 %2" )
- .arg( tr( DATETIME_STRING ) ).arg( m_clock ) );
+ m_clockLabel->setText(tr("Time:") + QLatin1Char(' ') + m_clock);
switch ( m_configDialog->angleUnit() ) {
case DMSDegree:
@@ -1038,8 +1026,7 @@ void MainWindow::setupStatusBar()
m_positionLabel = new QLabel( );
m_positionLabel->setIndent( 5 );
// UTM syntax is used in the template string, as it is longer than the lon/lat one
- QString templatePositionString =
- QString( "%1 00Z 000000.00 m E, 00000000.00 m N_" ).arg(POSITION_STRING);
+ QString templatePositionString = tr("Position:") + QLatin1String(" 00Z 000000.00 m E, 00000000.00 m N_");
int maxPositionWidth = fontMetrics().boundingRect(templatePositionString).width()
+ 2 * m_positionLabel->margin() + 2 * m_positionLabel->indent();
m_positionLabel->setFixedWidth( maxPositionWidth );
@@ -1047,8 +1034,7 @@ void MainWindow::setupStatusBar()
m_distanceLabel = new QLabel( );
m_distanceLabel->setIndent( 5 );
- QString templateDistanceString =
- QString( "%1 00.000,0 mu" ).arg(DISTANCE_STRING);
+ QString templateDistanceString = tr("Altitude:") + QLatin1String(" 00.000,0 mu");
int maxDistanceWidth = fontMetrics().boundingRect(templateDistanceString).width()
+ 2 * m_distanceLabel->margin() + 2 * m_distanceLabel->indent();
m_distanceLabel->setFixedWidth( maxDistanceWidth );
@@ -1056,8 +1042,7 @@ void MainWindow::setupStatusBar()
m_zoomLabel = new QLabel( );
m_zoomLabel->setIndent( 5 );
- QString templateZoomString =
- QString( "%1 00" ).arg(ZOOM_STRING);
+ QString templateZoomString = tr("Zoom:") + QLatin1String(" 00");
int maxZoomWidth = fontMetrics().boundingRect(templateZoomString).width()
+ 2 * m_zoomLabel->margin() + 2 * m_zoomLabel->indent();
m_zoomLabel->setFixedWidth( maxZoomWidth );
@@ -1065,7 +1050,7 @@ void MainWindow::setupStatusBar()
m_clockLabel = new QLabel( );
m_clockLabel->setIndent( 5 );
- QString templateDateTimeString = QString( "%1 %2" ).arg( DATETIME_STRING , QLocale().toString( QDateTime::fromString ( "01:01:1000", "dd:mm:yyyy"), QLocale::ShortFormat ) );
+ QString templateDateTimeString = tr("Time:") + QLatin1Char(' ') + QLocale().toString(QDateTime::fromString( "01:01:1000", "dd:mm:yyyy"), QLocale::ShortFormat);
int maxDateTimeWidth = fontMetrics().boundingRect( templateDateTimeString ).width()
+ 2 * m_clockLabel->margin() + 2 * m_clockLabel->indent();
m_clockLabel->setFixedWidth( maxDateTimeWidth );