Use less operations when building strings

This commit is contained in:
Chocobo1 2019-05-27 16:19:24 +08:00
parent 0fe9cd05c4
commit 49df1cd3c7
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 23 additions and 22 deletions

View file

@ -402,11 +402,9 @@ void AddNewTorrentDialog::updateDiskSpaceLabel()
}
}
QString sizeString = torrentSize ? Utils::Misc::friendlyUnit(torrentSize) : QString(tr("Not Available", "This size is unavailable."));
sizeString += " (";
sizeString += tr("Free space on disk: %1").arg(Utils::Misc::friendlyUnit(Utils::Fs::freeDiskSpaceOnPath(
m_ui->savePath->selectedPath())));
sizeString += ')';
const QString sizeString = tr("%1 (Free space on disk: %2)").arg(
((torrentSize > 0) ? Utils::Misc::friendlyUnit(torrentSize) : tr("Not available", "This size is unavailable."))
, Utils::Misc::friendlyUnit(Utils::Fs::freeDiskSpaceOnPath(m_ui->savePath->selectedPath())));
m_ui->labelSizeData->setText(sizeString);
}