Replace use of QString::sprintf
This commit is contained in:
@@ -196,9 +196,8 @@ static void verticalGradientHelper(QPainter *p, const QRect &spanRect, const QRe
|
|||||||
void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
void StyleHelper::verticalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
||||||
|
|
||||||
if (StyleHelper::usePixmapCache()) {
|
if (StyleHelper::usePixmapCache()) {
|
||||||
QString key;
|
|
||||||
QColor keyColor = baseColor(lightColored);
|
QColor keyColor = baseColor(lightColored);
|
||||||
key.sprintf("mh_vertical %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb());
|
QString key = QString::asprintf("mh_vertical %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb());
|
||||||
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
if (!QPixmapCache::find(key, &pixmap)) {
|
if (!QPixmapCache::find(key, &pixmap)) {
|
||||||
@@ -253,9 +252,8 @@ static void horizontalGradientHelper(QPainter *p, const QRect &spanRect, const Q
|
|||||||
void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
void StyleHelper::horizontalGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect, bool lightColored) {
|
||||||
|
|
||||||
if (StyleHelper::usePixmapCache()) {
|
if (StyleHelper::usePixmapCache()) {
|
||||||
QString key;
|
|
||||||
QColor keyColor = baseColor(lightColored);
|
QColor keyColor = baseColor(lightColored);
|
||||||
key.sprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb(), spanRect.x());
|
QString key = QString::asprintf("mh_horizontal %d %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), keyColor.rgb(), spanRect.x());
|
||||||
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
if (!QPixmapCache::find(key, &pixmap)) {
|
if (!QPixmapCache::find(key, &pixmap)) {
|
||||||
@@ -294,8 +292,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
|||||||
QRect r = option->rect;
|
QRect r = option->rect;
|
||||||
int size = qMin(r.height(), r.width());
|
int size = qMin(r.height(), r.width());
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
QString pixmapName;
|
QString pixmapName = QString::asprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio);
|
||||||
pixmapName.sprintf("StyleHelper::drawArrow-%d-%d-%d-%f", element, size, enabled, devicePixelRatio);
|
|
||||||
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
if (!QPixmapCache::find(pixmapName, &pixmap)) {
|
||||||
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
|
QImage image(size * devicePixelRatio, size * devicePixelRatio, QImage::Format_ARGB32_Premultiplied);
|
||||||
image.fill(Qt::transparent);
|
image.fill(Qt::transparent);
|
||||||
@@ -336,8 +333,7 @@ void StyleHelper::drawArrow(QStyle::PrimitiveElement element, QPainter *painter,
|
|||||||
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) {
|
void StyleHelper::menuGradient(QPainter *painter, const QRect &spanRect, const QRect &clipRect) {
|
||||||
|
|
||||||
if (StyleHelper::usePixmapCache()) {
|
if (StyleHelper::usePixmapCache()) {
|
||||||
QString key;
|
QString key = QString::asprintf("mh_menu %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb());
|
||||||
key.sprintf("mh_menu %d %d %d %d %d", spanRect.width(), spanRect.height(), clipRect.width(), clipRect.height(), StyleHelper::baseColor().rgb());
|
|
||||||
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
if (!QPixmapCache::find(key, &pixmap)) {
|
if (!QPixmapCache::find(key, &pixmap)) {
|
||||||
|
|||||||
@@ -119,8 +119,8 @@ QString PrettyTime(int seconds) {
|
|||||||
seconds %= 60;
|
seconds %= 60;
|
||||||
|
|
||||||
QString ret;
|
QString ret;
|
||||||
if (hours) ret.sprintf("%d:%02d:%02d", hours, minutes, seconds);
|
if (hours) ret = QString("%d:%02d:%02d").arg(hours).arg(minutes).arg(seconds);
|
||||||
else ret.sprintf("%d:%02d", minutes, seconds);
|
else ret = QString("%d:%02d").arg(minutes).arg(seconds);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -186,11 +186,11 @@ QString PrettySize(quint64 bytes) {
|
|||||||
if (bytes <= 1000)
|
if (bytes <= 1000)
|
||||||
ret = QString::number(bytes) + " bytes";
|
ret = QString::number(bytes) + " bytes";
|
||||||
else if (bytes <= 1000 * 1000)
|
else if (bytes <= 1000 * 1000)
|
||||||
ret.sprintf("%.1f KB", float(bytes) / 1000);
|
ret = QString("%.1f KB").arg(float(bytes) / 1000);
|
||||||
else if (bytes <= 1000 * 1000 * 1000)
|
else if (bytes <= 1000 * 1000 * 1000)
|
||||||
ret.sprintf("%.1f MB", float(bytes) / (1000 * 1000));
|
ret = QString("%.1f MB").arg(float(bytes) / (1000 * 1000));
|
||||||
else
|
else
|
||||||
ret.sprintf("%.1f GB", float(bytes) / (1000 * 1000 * 1000));
|
ret = QString("%.1f GB").arg(float(bytes) / (1000 * 1000 * 1000));
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
|||||||
@@ -220,8 +220,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
|
|||||||
// Get the total number of F.. directories
|
// Get the total number of F.. directories
|
||||||
int total_musicdirs = 0;
|
int total_musicdirs = 0;
|
||||||
for ( ; ; ++total_musicdirs) {
|
for ( ; ; ++total_musicdirs) {
|
||||||
QString dir;
|
QString dir = QString("/iTunes_Control/Music/F%02d").arg(total_musicdirs);
|
||||||
dir.sprintf("/iTunes_Control/Music/F%02d", total_musicdirs);
|
|
||||||
|
|
||||||
if (!Exists(dir))
|
if (!Exists(dir))
|
||||||
break;
|
break;
|
||||||
@@ -234,8 +233,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
|
|||||||
|
|
||||||
// Pick one at random
|
// Pick one at random
|
||||||
const int dir_num = qrand() % total_musicdirs;
|
const int dir_num = qrand() % total_musicdirs;
|
||||||
QString dir;
|
QString dir = QString("/iTunes_Control/Music/F%02d").arg(dir_num);
|
||||||
dir.sprintf("/iTunes_Control/Music/F%02d", dir_num);
|
|
||||||
|
|
||||||
if (!Exists(dir)) {
|
if (!Exists(dir)) {
|
||||||
qLog(Warning) << "Music directory doesn't exist:" << dir;
|
qLog(Warning) << "Music directory doesn't exist:" << dir;
|
||||||
@@ -252,7 +250,7 @@ QString iMobileDeviceConnection::GetUnusedFilename(Itdb_iTunesDB *itdb, const So
|
|||||||
static const int kRandMax = 999999;
|
static const int kRandMax = 999999;
|
||||||
QString filename;
|
QString filename;
|
||||||
forever {
|
forever {
|
||||||
filename.sprintf("libgpod%06d", qrand() % kRandMax);
|
filename = QString("libgpod%06d").arg(qrand() % kRandMax);
|
||||||
filename += "." + extension;
|
filename += "." + extension;
|
||||||
|
|
||||||
if (!Exists(dir + "/" + filename))
|
if (!Exists(dir + "/" + filename))
|
||||||
|
|||||||
@@ -526,8 +526,7 @@ void BackendSettingsPage::DeviceStringChanged() {
|
|||||||
void BackendSettingsPage::RgPreampChanged(int value) {
|
void BackendSettingsPage::RgPreampChanged(int value) {
|
||||||
|
|
||||||
float db = float(value) / 10 - 15;
|
float db = float(value) / 10 - 15;
|
||||||
QString db_str;
|
QString db_str = QString("%+.1f dB").arg(db);
|
||||||
db_str.sprintf("%+.1f dB", db);
|
|
||||||
ui_->label_replaygainpreamp->setText(db_str);
|
ui_->label_replaygainpreamp->setText(db_str);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -490,8 +490,7 @@ void FancyTabWidget::paintEvent(QPaintEvent *pe) {
|
|||||||
QRect backgroundRect = rect();
|
QRect backgroundRect = rect();
|
||||||
backgroundRect.setWidth(tabBar()->width());
|
backgroundRect.setWidth(tabBar()->width());
|
||||||
|
|
||||||
QString key;
|
QString key = QString::asprintf("mh_vertical %d %d %d %d %d", backgroundRect.width(), backgroundRect.height(), bg_color_.rgb(), (bg_gradient_ ? 1 : 0), (background_pixmap_.isNull() ? 0 : 1));
|
||||||
key.sprintf("mh_vertical %d %d %d %d %d", backgroundRect.width(), backgroundRect.height(), bg_color_.rgb(), (bg_gradient_ ? 1 : 0), (background_pixmap_.isNull() ? 0 : 1));
|
|
||||||
|
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
if (!QPixmapCache::find(key, &pixmap)) {
|
if (!QPixmapCache::find(key, &pixmap)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user