r23483 by jghali - Replace deprecated QString::sprintf() by QString::asprintf()
scribus-commit
scribus-commit at lists.scribus.net
Fri Mar 6 01:57:24 UTC 2020
Author: jghali
Date: Fri Mar 6 01:57:24 2020
New Revision: 23483
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23483
Log:
Replace deprecated QString::sprintf() by QString::asprintf()
Modified:
trunk/Scribus/scribus/exif.cpp
trunk/Scribus/scribus/fonts/ftface.cpp
trunk/Scribus/scribus/fonts/scface_ttf.cpp
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/ui/bookmwin.cpp
trunk/Scribus/scribus/ui/charzoom.cpp
trunk/Scribus/scribus/ui/charzoom.h
trunk/Scribus/scribus/ui/imageinfodialog.cpp
trunk/Scribus/scribus/util_formats.cpp
Modified: trunk/Scribus/scribus/exif.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/exif.cpp
==============================================================================
--- trunk/Scribus/scribus/exif.cpp (original)
+++ trunk/Scribus/scribus/exif.cpp Fri Mar 6 01:57:24 2020
@@ -558,7 +558,7 @@
if ( c != '\0' && c != ' ' )
{
//strncpy(ImageInfo.Comments, (const char*)(a+ValuePtr), 199);
- UserComment.sprintf ( "%s", ( const char* ) ( a+ValuePtr ) );
+ UserComment = QString::asprintf ( "%s", ( const char* ) ( a+ValuePtr ) );
break;
}
}
@@ -566,7 +566,7 @@
else
{
//strncpy(ImageInfo.Comments, (const char*)ValuePtr, 199);
- UserComment.sprintf ( "%s", ( const char* ) ValuePtr );
+ UserComment = QString::asprintf ( "%s", ( const char* ) ValuePtr );
}
break;
Modified: trunk/Scribus/scribus/fonts/ftface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/fonts/ftface.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/ftface.cpp (original)
+++ trunk/Scribus/scribus/fonts/ftface.cpp Fri Mar 6 01:57:24 2020
@@ -346,7 +346,7 @@
glEncoding.glyphName = adobeGlyphName(charcode);
else
glEncoding.glyphName = QString(reinterpret_cast<char*>(buf));
- glEncoding.toUnicode = QString().sprintf("%04lX", charcode);
+ glEncoding.toUnicode = QString::asprintf("%04lX", charcode);
glyphList.insert(gindex, glEncoding);
charcode = FT_Get_Next_Char(face, charcode, &gindex);
@@ -379,7 +379,7 @@
ScFace::GlyphEncoding glEncoding;
glEncoding.charcode = static_cast<ScFace::ucs4_type>(charcode);
glEncoding.glyphName = glyphName;
- glEncoding.toUnicode = QString().sprintf("%04lX", charcode);
+ glEncoding.toUnicode = QString::asprintf("%04lX", charcode);
if ((charcode == 0) && glyphName.startsWith("uni"))
{
QString uniHexStr = uniGlyphNameToUnicode(glyphName);
Modified: trunk/Scribus/scribus/fonts/scface_ttf.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/fonts/scface_ttf.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scface_ttf.cpp (original)
+++ trunk/Scribus/scribus/fonts/scface_ttf.cpp Fri Mar 6 01:57:24 2020
@@ -92,7 +92,7 @@
ScFace::GlyphEncoding glEncoding;
glEncoding.charcode = charcode;
glEncoding.glyphName = adobeGlyphName(charcode);
- glEncoding.toUnicode = QString().sprintf("%04lX", charcode);
+ glEncoding.toUnicode = QString::asprintf("%04lX", charcode);
GList.insert(gindex, glEncoding);
charcode = FT_Get_Next_Char(face, charcode, &gindex );
}
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Fri Mar 6 01:57:24 2020
@@ -1846,18 +1846,16 @@
PutDoc("[ ");
QList<uint> keys = gl.uniqueKeys();
- QList<uint>::iterator git;
bool seenNotDef = false;
- for (git = keys.begin(); git != keys.end(); ++git)
+ for (auto git = keys.begin(); git != keys.end(); ++git)
{
uint gid = result.encoding == Encode_Subset? glyphmap[*git] : *git;
if (gid > 0 || !seenNotDef)
{
seenNotDef |= (gid == 0);
- PutDoc(Pdf::toPdf(gid)+" ["+Pdf::toPdf(static_cast<int>(face.glyphWidth(*git)* 1000))+"] " );
- QString tmp, tmp2;
- tmp.sprintf("%04X", gid);
- tmp2 = gl.value(*git).toUnicode;
+ PutDoc(Pdf::toPdf(gid) + " [" + Pdf::toPdf(static_cast<int>(face.glyphWidth(*git) * 1000)) + "] " );
+ QString tmp = QString::asprintf("%04X", gid);
+ QString tmp2 = gl.value(*git).toUnicode;
toUnicodeMap += "<" + Pdf::toAscii(tmp)+ "> <" + Pdf::toAscii(tmp2) + ">\n";
toUnicodeMapCounter++;
if (toUnicodeMapCounter == 100)
@@ -1993,9 +1991,8 @@
startOfSeq = false;
}
PutDoc(Pdf::toName(glEncoding.glyphName)+" ");
- QString tmp, tmp2;
- tmp.sprintf("%02X", ww2);
- tmp2 = glEncoding.toUnicode;
+ QString tmp = QString::asprintf("%02X", ww2);
+ QString tmp2 = glEncoding.toUnicode;
toUnicodeMap += "<" + Pdf::toAscii(tmp) + "> <" + Pdf::toAscii(tmp2) + ">\n";
//QString("<%1> <%2>\n").arg(tmp).arg((tmp2));
toUnicodeMapCounter++;
Modified: trunk/Scribus/scribus/ui/bookmwin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/ui/bookmwin.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/bookmwin.cpp (original)
+++ trunk/Scribus/scribus/ui/bookmwin.cpp Fri Mar 6 01:57:24 2020
@@ -92,8 +92,7 @@
QString BookMItem::key(int, bool) const
{
- QString tmp;
- tmp.sprintf("%5d", ItemNr);
+ QString tmp = QString::asprintf("%5d", ItemNr);
return tmp;
}
Modified: trunk/Scribus/scribus/ui/charzoom.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/ui/charzoom.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/charzoom.cpp (original)
+++ trunk/Scribus/scribus/ui/charzoom.cpp Fri Mar 6 01:57:24 2020
@@ -20,11 +20,11 @@
setMinimumSize(sizex, sizey);
setMaximumSize(sizex, sizey);
- pixm = QPixmap(size, size);
+ m_pixm = QPixmap(size, size);
QImage pix(size, size, QImage::Format_ARGB32_Premultiplied);
ScPainter *p = new ScPainter(&pix, size, size);
p->clear();
- pixm.fill(Qt::white);
+ m_pixm.fill(Qt::white);
QTransform chma;
chma.scale(4.8, 4.8);
@@ -42,11 +42,10 @@
p->end();
}
delete p;
- pixm=QPixmap::fromImage(pix);
+ m_pixm = QPixmap::fromImage(pix);
- QString tmp;
- tmp.sprintf("%04X", currentChar);
- valu = "0x"+tmp;
+ QString tmp = QString::asprintf("%04X", currentChar);
+ m_value = "0x" + tmp;
}
void CharZoom::paintEvent(QPaintEvent *)
@@ -55,8 +54,8 @@
p.begin(this);
p.setPen(Qt::black);
p.setBrush(Qt::NoBrush);
- p.drawRect(0, 0, width()-1, height()-1);
- p.drawPixmap(1, 1, pixm);
- p.drawText(5, height()-3, valu);
+ p.drawRect(0, 0, width() - 1, height() - 1);
+ p.drawPixmap(1, 1, m_pixm);
+ p.drawText(5, height() - 3, m_value);
p.end();
}
Modified: trunk/Scribus/scribus/ui/charzoom.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/ui/charzoom.h
==============================================================================
--- trunk/Scribus/scribus/ui/charzoom.h (original)
+++ trunk/Scribus/scribus/ui/charzoom.h Fri Mar 6 01:57:24 2020
@@ -19,12 +19,13 @@
public:
CharZoom(QWidget* parent, uint currentChar, const ScFace& face);
~CharZoom() {};
+
private:
void paintEvent(QPaintEvent *);
- //! \brief Pixmap generated in constructor
- QPixmap pixm;
+ //! \brief pixmap generated in constructor
+ QPixmap m_pixm;
//! \brief A hex value as string
- QString valu;
+ QString m_value;
};
#endif
Modified: trunk/Scribus/scribus/ui/imageinfodialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/ui/imageinfodialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/imageinfodialog.cpp (original)
+++ trunk/Scribus/scribus/ui/imageinfodialog.cpp Fri Mar 6 01:57:24 2020
@@ -103,9 +103,9 @@
if (info->exifInfo.ExposureTime != 0)
{
float exposureTime = info->exifInfo.ExposureTime;
- tag = QString().sprintf("%6.3f", exposureTime);
+ tag = QString::asprintf("%6.3f", exposureTime);
if ((exposureTime > 0.0) && (exposureTime <= 0.5))
- tag += QString().sprintf(" (1/%d)", (int)(0.5 + 1/exposureTime) );
+ tag += QString::asprintf(" (1/%d)", (int)(0.5 + 1/exposureTime) );
}
Text7 = Text8 = nullptr;
ExposureTime = nullptr;
@@ -117,11 +117,11 @@
layout2->addWidget( ExposureTime, a+2, 1 );
Text7 = new QLabel( "", ExGroup);
layout2->addWidget( Text7, a+3, 0 );
- ApertureFNumber = new QLabel(QString().sprintf("f/%3.1f", info->exifInfo.ApertureFNumber), ExGroup);
+ ApertureFNumber = new QLabel(QString::asprintf("f/%3.1f", info->exifInfo.ApertureFNumber), ExGroup);
layout2->addWidget( ApertureFNumber, a+3, 1 );
Text8 = new QLabel( "", ExGroup);
layout2->addWidget( Text8, a+4, 0 );
- ISOequivalent = new QLabel(QString().sprintf("%2d", info->exifInfo.ISOequivalent), ExGroup);
+ ISOequivalent = new QLabel(QString::asprintf("%2d", info->exifInfo.ISOequivalent), ExGroup);
layout2->addWidget( ISOequivalent, a+4, 1 );
}
ImageInfoDialogLayout->addWidget(ExGroup);
Modified: trunk/Scribus/scribus/util_formats.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23483&path=/trunk/Scribus/scribus/util_formats.cpp
==============================================================================
--- trunk/Scribus/scribus/util_formats.cpp (original)
+++ trunk/Scribus/scribus/util_formats.cpp Fri Mar 6 01:57:24 2020
@@ -362,7 +362,6 @@
QStringList strl;
strl << "psd";
return strl.contains(ext, Qt::CaseInsensitive);
-// return (QString::compare("psd", ext, Qt::CaseInsensitive) == 0);
}
bool extensionIndicatesJPEG(const QString &ext)
More information about the scribus-commit
mailing list