mirror of
https://github.com/clementine-player/Clementine
synced 2025-02-02 20:36:44 +01:00
Merge pull request #6507 from jonaski/sprintf
Replace use of QString::sprintf with QString::asprintf
This commit is contained in:
commit
7d2c622d0f
@ -98,10 +98,11 @@ QString PrettyTime(int seconds, bool always_show_hours) {
|
||||
|
||||
QString ret;
|
||||
if (hours || always_show_hours)
|
||||
ret.sprintf("%d:%02d:%02d", hours, minutes,
|
||||
seconds); // NOLINT(runtime/printf)
|
||||
ret = QString::asprintf("%d:%02d:%02d", hours, minutes,
|
||||
seconds); // NOLINT(runtime/printf)
|
||||
else
|
||||
ret.sprintf("%d:%02d", minutes, seconds); // NOLINT(runtime/printf)
|
||||
ret = QString::asprintf("%d:%02d", minutes,
|
||||
seconds); // NOLINT(runtime/printf)
|
||||
|
||||
return ret;
|
||||
}
|
||||
@ -165,15 +166,18 @@ QString PrettySize(quint64 bytes) {
|
||||
if (bytes <= 1000)
|
||||
ret = QString::number(bytes) + " bytes";
|
||||
else if (bytes <= 1000 * 1000)
|
||||
ret.sprintf("%.1f KB",
|
||||
static_cast<float>(bytes) / 1000); // NOLINT(runtime/printf)
|
||||
ret = QString::asprintf(
|
||||
"%.1f KB",
|
||||
static_cast<float>(bytes) / 1000); // NOLINT(runtime/printf)
|
||||
else if (bytes <= 1000 * 1000 * 1000)
|
||||
ret.sprintf("%.1f MB", static_cast<float>(bytes) /
|
||||
(1000 * 1000)); // NOLINT(runtime/printf)
|
||||
ret = QString::asprintf(
|
||||
"%.1f MB",
|
||||
static_cast<float>(bytes) / (1000 * 1000)); // NOLINT(runtime/printf)
|
||||
else
|
||||
ret.sprintf("%.1f GB",
|
||||
static_cast<float>(bytes) /
|
||||
(1000 * 1000 * 1000)); // NOLINT(runtime/printf)
|
||||
ret = QString::asprintf(
|
||||
"%.1f GB",
|
||||
static_cast<float>(bytes) /
|
||||
(1000 * 1000 * 1000)); // NOLINT(runtime/printf)
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -700,7 +700,7 @@ QList<QUrl> MacDeviceLister::MakeDeviceUrls(const QString& serial) {
|
||||
if (IsMTPSerial(serial)) {
|
||||
const MTPDevice& device = mtp_devices_[serial];
|
||||
QString str;
|
||||
str.sprintf("gphoto2://usb-%d-%d/", device.bus, device.address);
|
||||
str = QString::asprintf("gphoto2://usb-%d-%d/", device.bus, device.address);
|
||||
QUrlQuery url_query;
|
||||
url_query.addQueryItem("vendor", device.vendor);
|
||||
url_query.addQueryItem("vendor_id", QString::number(device.vendor_id));
|
||||
|
@ -159,7 +159,7 @@ void PlaybackSettingsPage::Save() {
|
||||
void PlaybackSettingsPage::RgPreampChanged(int value) {
|
||||
float db = float(value) / 10 - 15;
|
||||
QString db_str;
|
||||
db_str.sprintf("%+.1f dB", db);
|
||||
db_str = QString::asprintf("%+.1f dB", db);
|
||||
ui_->replaygain_preamp_label->setText(db_str);
|
||||
}
|
||||
|
||||
|
@ -137,9 +137,9 @@ void StyleHelper::verticalGradient(QPainter* painter, const QRect& spanRect,
|
||||
if (StyleHelper::usePixmapCache()) {
|
||||
QString key;
|
||||
QColor keyColor = baseColor(lightColored);
|
||||
key.sprintf("mh_vertical %d %d %d %d %d", spanRect.width(),
|
||||
spanRect.height(), clipRect.width(), clipRect.height(),
|
||||
keyColor.rgb());
|
||||
key = QString::asprintf("mh_vertical %d %d %d %d %d", spanRect.width(),
|
||||
spanRect.height(), clipRect.width(),
|
||||
clipRect.height(), keyColor.rgb());
|
||||
;
|
||||
|
||||
QPixmap pixmap;
|
||||
|
Loading…
x
Reference in New Issue
Block a user