Merge bitcoin-core/gui#250: scripted-diff: Drop redundant QString calls

def1e64bb4 scripted-diff: Drop redundant QString calls (Hennadii Stepanov)

Pull request description:

  The return type of `QObject::tr` function _is_ `QString` 🐅

ACKs for top commit:
  jarolrod:
    ACK def1e64bb4, tested on macOS 10.14.6 Qt 5.15.2

Tree-SHA512: ef405c87a30d6965f6887511d8666b6da57d258ca07833a3fa2dc9fd147d0539d33c57f7551ee13c1dd8024d6057139595c6ce5d088dd6efd7aa13db2a3eebdb
This commit is contained in:
MarcoFalke 2021-03-15 09:05:08 +01:00
commit 6bc51af5c2
No known key found for this signature in database
GPG key ID: D2EA4850E7528B25

View file

@ -683,13 +683,13 @@ QString formatDurationStr(int secs)
int seconds = secs % 60; int seconds = secs % 60;
if (days) if (days)
strList.append(QString(QObject::tr("%1 d")).arg(days)); strList.append(QObject::tr("%1 d").arg(days));
if (hours) if (hours)
strList.append(QString(QObject::tr("%1 h")).arg(hours)); strList.append(QObject::tr("%1 h").arg(hours));
if (mins) if (mins)
strList.append(QString(QObject::tr("%1 m")).arg(mins)); strList.append(QObject::tr("%1 m").arg(mins));
if (seconds || (!days && !hours && !mins)) if (seconds || (!days && !hours && !mins))
strList.append(QString(QObject::tr("%1 s")).arg(seconds)); strList.append(QObject::tr("%1 s").arg(seconds));
return strList.join(" "); return strList.join(" ");
} }
@ -712,12 +712,12 @@ QString formatPingTime(std::chrono::microseconds ping_time)
{ {
return (ping_time == std::chrono::microseconds::max() || ping_time == 0us) ? return (ping_time == std::chrono::microseconds::max() || ping_time == 0us) ?
QObject::tr("N/A") : QObject::tr("N/A") :
QString(QObject::tr("%1 ms")).arg(QString::number((int)(count_microseconds(ping_time) / 1000), 10)); QObject::tr("%1 ms").arg(QString::number((int)(count_microseconds(ping_time) / 1000), 10));
} }
QString formatTimeOffset(int64_t nTimeOffset) QString formatTimeOffset(int64_t nTimeOffset)
{ {
return QString(QObject::tr("%1 s")).arg(QString::number((int)nTimeOffset, 10)); return QObject::tr("%1 s").arg(QString::number((int)nTimeOffset, 10));
} }
QString formatNiceTimeOffset(qint64 secs) QString formatNiceTimeOffset(qint64 secs)
@ -760,13 +760,13 @@ QString formatNiceTimeOffset(qint64 secs)
QString formatBytes(uint64_t bytes) QString formatBytes(uint64_t bytes)
{ {
if(bytes < 1024) if(bytes < 1024)
return QString(QObject::tr("%1 B")).arg(bytes); return QObject::tr("%1 B").arg(bytes);
if(bytes < 1024 * 1024) if(bytes < 1024 * 1024)
return QString(QObject::tr("%1 KB")).arg(bytes / 1024); return QObject::tr("%1 KB").arg(bytes / 1024);
if(bytes < 1024 * 1024 * 1024) if(bytes < 1024 * 1024 * 1024)
return QString(QObject::tr("%1 MB")).arg(bytes / 1024 / 1024); return QObject::tr("%1 MB").arg(bytes / 1024 / 1024);
return QString(QObject::tr("%1 GB")).arg(bytes / 1024 / 1024 / 1024); return QObject::tr("%1 GB").arg(bytes / 1024 / 1024 / 1024);
} }
qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) { qreal calculateIdealFontSize(int width, const QString& text, QFont font, qreal minPointSize, qreal font_size) {