Skip to content

Commit

Permalink
Fix untranslated message when downloading wms legend graphics, also
Browse files Browse the repository at this point in the history
improve message when total size is unknown (-1)
  • Loading branch information
nyalldawson committed Mar 9, 2021
1 parent bd3ae11 commit f9a6e33
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/core/layertree/qgslayertreemodellegendnode.cpp
Expand Up @@ -37,6 +37,7 @@
#include "qgsexpression.h"
#include "qgstextrenderer.h"
#include "qgssettings.h"
#include "qgsfileutils.h"

#include <QBuffer>

Expand Down Expand Up @@ -1287,7 +1288,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();
}
Expand Down

0 comments on commit f9a6e33

Please sign in to comment.