r21952 by craig - Clazy part 10: Use QString midRef instead of mid where possible
scribus-commit
scribus-commit at lists.scribus.net
Fri Apr 21 15:15:41 UTC 2017
Author: craig
Date: Fri Apr 21 15:15:40 2017
New Revision: 21952
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21952
Log:
Clazy part 10: Use QString midRef instead of mid where possible
Modified:
trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
trunk/Scribus/scribus/plugins/import/ai/importai.cpp
trunk/Scribus/scribus/sccolor.cpp
trunk/Scribus/scribus/ui/annot.cpp
trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21952&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp (original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp Fri Apr 21 15:15:40 2017
@@ -88,7 +88,7 @@
for (int a = 2; a < tmp.length(); a += 2)
{
bool ok;
- ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
+ ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
psdata.resize(psdata.size()+1);
psdata[psdata.size()-1] = data;
}
@@ -415,7 +415,7 @@
for (int a = 2; a < tmp.length(); a += 2)
{
bool ok;
- ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
+ ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
psdata.resize(psdata.size()+1);
psdata[psdata.size()-1] = data;
}
@@ -432,7 +432,7 @@
for (int a = 2; a < tmp.length(); a += 2)
{
bool ok;
- ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
+ ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
psdata.resize(psdata.size()+1);
psdata[psdata.size()-1] = data;
}
@@ -1230,7 +1230,7 @@
for (int a = 0; a < tmp.length(); a += 2)
{
bool ok;
- ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
+ ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
psdata.resize(psdata.size()+1);
psdata[psdata.size()-1] = data;
}
@@ -1364,7 +1364,7 @@
for (int a = 0; a < tmp.length(); a += 2)
{
bool ok;
- ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
+ ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
psdata.resize(psdata.size()+1);
psdata[psdata.size()-1] = data;
}
Modified: trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21952&path=/trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/docxim/docxim.cpp Fri Apr 21 15:15:40 2017
@@ -681,9 +681,9 @@
else
{
QStringList slist = PrefsManager::instance()->appPrefs.fontPrefs.AvailFonts.fontMap[it.current().family()];
- slist.sort();
if (slist.count() > 0)
{
+ slist.sort();
int reInd = slist.indexOf("Regular");
if (reInd < 0)
fontName = it.current().family() + " " + slist[0];
@@ -698,13 +698,11 @@
if (!PrefsManager::instance()->appPrefs.fontPrefs.GFontSub.contains(fontName))
{
qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
- MissingFont *dia = new MissingFont(0, fontName, m_Doc);
- dia->exec();
- QString fontNameR = dia->getReplacementFont();
- delete dia;
+ MissingFont dia(0, fontName, m_Doc);
+ static_cast<void>(dia.exec());
qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
- PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = fontNameR;
- fontName = fontNameR;
+ PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName] = dia.getReplacementFont();
+ fontName = dia.getReplacementFont();
}
else
fontName = PrefsManager::instance()->appPrefs.fontPrefs.GFontSub[fontName];
Modified: trunk/Scribus/scribus/plugins/import/ai/importai.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21952&path=/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/ai/importai.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/ai/importai.cpp Fri Apr 21 15:15:40 2017
@@ -1409,7 +1409,7 @@
{
if (data.contains("~>"))
{
- dataString += data.mid(1);
+ dataString += data.midRef(1);
dataMode = false;
QByteArray fData;
decodeA85(fData, dataString);
@@ -1469,7 +1469,7 @@
}
else
{
- dataString += data.mid(1);
+ dataString += data.midRef(1);
}
return;
}
@@ -3019,7 +3019,7 @@
for (int a = 1; a < tmp.length(); a += 2)
{
bool ok;
- ushort data = tmp.mid(a, 2).toUShort(&ok, 16);
+ ushort data = tmp.midRef(a, 2).toUShort(&ok, 16);
psdata[dataPointer++] = data;
}
}
Modified: trunk/Scribus/scribus/sccolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21952&path=/trunk/Scribus/scribus/sccolor.cpp
==============================================================================
--- trunk/Scribus/scribus/sccolor.cpp (original)
+++ trunk/Scribus/scribus/sccolor.cpp Fri Apr 21 15:15:40 2017
@@ -295,17 +295,17 @@
bool ok;
if (name.length () == 9)
{
- int c = name.mid(1,2).toInt(&ok, 16);
- int m = name.mid(3,2).toInt(&ok, 16);
- int y = name.mid(5,2).toInt(&ok, 16);
- int k = name.mid(7,2).toInt(&ok, 16);
+ int c = name.midRef(1,2).toInt(&ok, 16);
+ int m = name.midRef(3,2).toInt(&ok, 16);
+ int y = name.midRef(5,2).toInt(&ok, 16);
+ int k = name.midRef(7,2).toInt(&ok, 16);
setColor(c, m, y, k);
}
else if (name.length () == 7)
{
- int r = name.mid(1,2).toInt(&ok, 16);
- int g = name.mid(3,2).toInt(&ok, 16);
- int b = name.mid(5,2).toInt(&ok, 16);
+ int r = name.midRef(1,2).toInt(&ok, 16);
+ int g = name.midRef(3,2).toInt(&ok, 16);
+ int b = name.midRef(5,2).toInt(&ok, 16);
setColorRGB(r, g, b);
}
}
Modified: trunk/Scribus/scribus/ui/annot.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21952&path=/trunk/Scribus/scribus/ui/annot.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/annot.cpp (original)
+++ trunk/Scribus/scribus/ui/annot.cpp Fri Apr 21 15:15:40 2017
@@ -776,7 +776,7 @@
if (pfol.count() > 1)
{
tm2 = pfol[0].simplified();
- tm += tm2.mid(1, tm2.length()-2);
+ tm += tm2.midRef(1, tm2.length()-2);
for (int cfx = 1; cfx < pfol.count(); ++cfx)
{
tm2 = pfol[cfx].simplified();
Modified: trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21952&path=/trunk/Scribus/scribus/ui/pagepalette_widgets.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/pagepalette_widgets.cpp (original)
+++ trunk/Scribus/scribus/ui/pagepalette_widgets.cpp Fri Apr 21 15:15:40 2017
@@ -304,7 +304,7 @@
int st = str.indexOf(" ");
int en = str.indexOf(" ", st+1);
tmp = str.mid(en+1);
- int dr = str.mid(st, en-st).toInt();
+ int dr = str.midRef(st, en-st).toInt();
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
if ((a == -1) || (b == -1))
@@ -547,7 +547,7 @@
{
int st = str.indexOf(" ");
int en = str.indexOf(" ", st+1);
- emit DelPage(str.mid(st, en-st).toInt());
+ emit DelPage(str.midRef(st, en-st).toInt());
}
if (str.startsWith("1"))
{
More information about the scribus-commit
mailing list