Skip to content
Permalink
Browse files

Fix untranslated message when downloading wms legend graphics, also

improve message when total size is unknown (-1)

(cherry picked from commit f9a6e33)
  • Loading branch information
nyalldawson committed Mar 19, 2021
1 parent d38c70b commit b18953242cd52ac570e55ec13a586fa47b56cfc0
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/core/layertree/qgslayertreemodellegendnode.cpp
@@ -35,6 +35,7 @@
#include "qgsexpression.h"
#include "qgstextrenderer.h"
#include "qgssettings.h"
#include "qgsfileutils.h"


QgsLayerTreeModelLegendNode::QgsLayerTreeModelLegendNode( QgsLayerTreeLayer *nodeL, QObject *parent )
@@ -1175,7 +1176,8 @@ QImage QgsWmsLegendNode::renderMessage( const QString &msg ) const

void QgsWmsLegendNode::getLegendGraphicProgress( qint64 cur, qint64 tot )
{
QString msg = QStringLiteral( "Downloading... %1/%2" ).arg( cur ).arg( tot );
const QString msg = tot > 0 ? tr( "Downloading: %1% (%2)" ).arg( static_cast< int >( std::round( 100 * cur / tot ) ) ).arg( QgsFileUtils::representFileSize( tot ) )
: tr( "Downloading: %1" ).arg( QgsFileUtils::representFileSize( cur ) );
mImage = renderMessage( msg );
emit dataChanged();
}

0 comments on commit b189532

Please sign in to comment.