Skip to content

Commit

Permalink
Merge #250: scripted-diff: Drop redundant QString calls
Browse files Browse the repository at this point in the history
def1e64 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 def1e64, tested on macOS 10.14.6 Qt 5.15.2

Tree-SHA512: ef405c87a30d6965f6887511d8666b6da57d258ca07833a3fa2dc9fd147d0539d33c57f7551ee13c1dd8024d6057139595c6ce5d088dd6efd7aa13db2a3eebdb
  • Loading branch information
MarcoFalke committed Mar 15, 2021
2 parents 16209b1 + def1e64 commit 6bc51af
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,13 +683,13 @@ QString formatDurationStr(int secs)
int seconds = secs % 60;

if (days)
strList.append(QString(QObject::tr("%1 d")).arg(days));
strList.append(QObject::tr("%1 d").arg(days));
if (hours)
strList.append(QString(QObject::tr("%1 h")).arg(hours));
strList.append(QObject::tr("%1 h").arg(hours));
if (mins)
strList.append(QString(QObject::tr("%1 m")).arg(mins));
strList.append(QObject::tr("%1 m").arg(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(" ");
}
Expand All @@ -712,12 +712,12 @@ QString formatPingTime(std::chrono::microseconds ping_time)
{
return (ping_time == std::chrono::microseconds::max() || ping_time == 0us) ?
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)
{
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)
Expand Down Expand Up @@ -760,13 +760,13 @@ QString formatNiceTimeOffset(qint64 secs)
QString formatBytes(uint64_t bytes)
{
if(bytes < 1024)
return QString(QObject::tr("%1 B")).arg(bytes);
return QObject::tr("%1 B").arg(bytes);
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)
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) {
Expand Down

0 comments on commit 6bc51af

Please sign in to comment.