Commit 853e135c authored by David Redondo's avatar David Redondo 🏎
Browse files

Port away from QString::sprintf

parent 567d49f5
......@@ -598,10 +598,10 @@ void CKCmFontInst::print(bool all)
str << (*it).family << Qt::endl
<< (*it).styleInfo << Qt::endl;
args << "--embed" << QString().sprintf("0x%x", (unsigned int)window()->winId())
args << "--embed" << QStringLiteral("0x%1").arg((unsigned int)window()->winId(), 0, 16)
<< "--qwindowtitle" << title
<< "--qwindowicon" << "preferences-desktop-font-installer"
<< "--size" << QString().setNum(constSizes[dlg.chosenSize() < 6 ? dlg.chosenSize() : 2])
<< "--size" << QString::number(constSizes[dlg.chosenSize() < 6 ? dlg.chosenSize() : 2])
<< "--listfile" << tmpFile.fileName()
<< "--deletefile";
}
......@@ -613,10 +613,10 @@ void CKCmFontInst::print(bool all)
}
else
{
args << "--embed" << QString().sprintf("0x%x", (unsigned int)window()->winId())
args << "--embed" << QStringLiteral("0x%1").arg((unsigned int)window()->winId(), 0, 16)
<< "--qwindowtitle" << title
<< "--qwindowicon" << "preferences-desktop-font-installer"
<< "--size" << QString().setNum(constSizes[dlg.chosenSize()<6 ? dlg.chosenSize() : 2]);
<< "--size" << QString::number(constSizes[dlg.chosenSize()<6 ? dlg.chosenSize() : 2]);
for(; it!=end; ++it)
args << "--pfont" << QString((*it).family.toUtf8()+','+QString().setNum((*it).styleInfo));
......
......@@ -347,12 +347,7 @@ quint32 createStyleVal(const QString &name)
QString styleValToStr(quint32 style)
{
QString str;
int weight, width, slant;
decomposeStyleVal(style, weight, width, slant);
str.sprintf("0X%02X%02X%02X\n", weight, width, slant);
return str;
return QStringLiteral("0X%1\n").arg(style, 6, 16, QLatin1Char('0')).toUpper();
}
void decomposeStyleVal(quint32 styleInfo, int &weight, int &width, int &slant)
......
......@@ -172,7 +172,7 @@ void CCharTip::showTip()
details+="<tr><td align=\"right\"><b>"+i18n("Category")+"&nbsp;</b></td><td>"+
toStr(cat)+"</td></tr>";
details+="<tr><td align=\"right\"><b>"+i18n("UCS-4")+"&nbsp;</b></td><td>"+
QString().sprintf("U+%4.4X", itsItem.ucs4)+"&nbsp;</td></tr>";
"U+"+QStringLiteral("%1").arg(itsItem.ucs4, 4, 16)+"&nbsp;</td></tr>";
QString str(QString::fromUcs4(&(itsItem.ucs4), 1));
details+="<tr><td align=\"right\"><b>"+i18n("UTF-16")+"&nbsp;</b></td><td>";
......@@ -183,7 +183,7 @@ void CCharTip::showTip()
{
if(i)
details+=' ';
details+=QString().sprintf("0x%4.4X", utf16[i]);
details+=QStringLiteral("0x%1").arg(utf16[i], 4, 16);
}
details+="</td></tr>";
details+="<tr><td align=\"right\"><b>"+i18n("UTF-8")+"&nbsp;</b></td><td>";
......@@ -194,7 +194,7 @@ void CCharTip::showTip()
{
if(i)
details+=' ';
details+=QString().sprintf("0x%2.2X", (unsigned char)(utf8.constData()[i]));
details+=QStringLiteral("0x%1").arg((unsigned char)(utf8.constData()[i]), 2, 16);
}
details+="</td></tr>";
......@@ -204,7 +204,7 @@ void CCharTip::showTip()
(0xE000 <= itsItem.ucs4 && itsItem.ucs4 <= 0xFFFD) ||
(0x10000 <= itsItem.ucs4 && itsItem.ucs4 <= 0x10FFFF))
details+="<tr><td align=\"right\"><b>"+i18n("XML Decimal Entity")+"&nbsp;</b></td><td>"+
QString().sprintf("&#<b></b>%d;", itsItem.ucs4)+"</td></tr>";
"&#<b></b>"+QString::number(itsItem.ucs4)+";</td></tr>";
details+="</table>";
itsLabel->setText(details);
......
......@@ -413,7 +413,7 @@ void CFontViewPart::install()
if (title.isEmpty())
title = QCoreApplication::applicationName();
args << "--embed" << QString().sprintf("0x%x", (unsigned int)(itsFrame->window()->winId()))
args << "--embed" << QStringLiteral("0x%1").arg((unsigned int)itsFrame->window()->winId(), 0, 16)
<< "--qwindowtitle" << title
<< "--qwindowicon" << "kfontview"
<< url().toDisplayString();
......@@ -468,7 +468,7 @@ void CFontViewPart::print()
if(!itsFontDetails.family.isEmpty())
{
args << "--embed" << QString().sprintf("0x%x", (unsigned int)(itsFrame->window()->winId()))
args << "--embed" << QStringLiteral("0x%1").arg((unsigned int)itsFrame->window()->winId(), 0, 16)
<< "--qwindowtitle" << title
<< "--qwindowicon" << "kfontview"
<< "--size" << "0"
......@@ -476,7 +476,7 @@ void CFontViewPart::print()
}
#ifdef KFI_PRINT_APP_FONTS
else
args << "--embed" << QString().sprintf("0x%x", (unsigned int)(itsFrame->window()->winId()))
args << "--embed" << QStringLiteral("0x%1").arg((unsigned int)itsFrame->window()->winId(), 0, 16)
<< "--qwindowtitle" << title
<< "--qwindowicon" << "kfontview"
<< "--size " << "0"
......
......@@ -223,15 +223,10 @@ static void applyQtSettings( KSharedConfigPtr kglobalcfg, QSettings& settings )
static void addColorDef(QString& s, const char* n, const QColor& col)
{
QString tmp;
tmp.sprintf("#define %s #%02x%02x%02x\n",
n, col.red(), col.green(), col.blue());
s += tmp;
s += QStringLiteral("#define %1 ").arg(QString::fromUtf8(n));
s += col.name().toLower();
}
// -----------------------------------------------------------------------------
static void copyFile(QFile& tmp, QString const& filename, bool )
......
......@@ -94,7 +94,7 @@ char * safeSmsGenerateClientID( SmsConn /*c*/ )
(1 would be IP, 2 would be DEC-NET format) */
char hostname[ 256 ];
if( gethostname( hostname, 255 ) != 0 )
my_addr->sprintf("0%.8x", KRandom::random());
*my_addr = QStringLiteral("0%1").arg(KRandom::random(), 8, 16);
else {
// create some kind of hash for the hostname
int addr[ 4 ] = { 0, 0, 0, 0 };
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment