Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 24867 → Rev 24868

/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegenerator.cpp
5,6 → 5,12
for which a new license (GPL+exception) is in place.
*/
 
#include <QDebug>
#include <QRegularExpression>
#include <QStandardItemModel>
#include <QTextStream>
#include <QThread>
#include <QTimer>
 
#include "../formatidlist.h"
#include "barcodegenerator.h"
16,16 → 22,12
#include "ui/colorsandfills.h"
#include "undomanager.h"
 
#include <QDebug>
#include <QTextStream>
#include <QStandardItemModel>
#include <QTimer>
#include <QThread>
 
 
BarcodeType::BarcodeType(const QString &cmd, const QString &exa, const QString &exaop)
: command(cmd),
exampleContents(exa),
exampleOptions(exaop)
: command(cmd),
exampleContents(exa),
exampleOptions(exaop)
{
 
}
64,20 → 66,22
QString bwipp = ts.readAll();
f.close();
 
QRegExp rx(
QRegularExpression rx(
"[\\r\\n]+% --BEGIN (RESOURCE|RENDERER|ENCODER) ([\\w-]+)--[\\r\\n]+"
"(.*[\\r\\n]+)?"
"(%%BeginResource.*[\\r\\n]+)"
"% --END \\1 \\2--[\\r\\n]+");
rx.setMinimal(true);
int pos = 0;
while ( (pos = rx.indexIn(bwipp, pos)) != -1 )
"% --END \\1 \\2--[\\r\\n]+",
QRegularExpression::InvertedGreedinessOption);
QRegularExpressionMatch match = rx.match(bwipp);
int n = 0;
int pos = match.capturedStart(n);
while ( pos >= 0 )
{
int len = rx.matchedLength();
QString restype = rx.cap(1);
QString resname = rx.cap(2);
QString reshead = rx.cap(3);
QString resbody = rx.cap(4);
int len = match.capturedLength();
QString restype = match.captured(1);
QString resname = match.captured(2);
QString reshead = match.captured(3);
QString resbody = match.captured(4);
 
resbodys[resname] = resbody;
 
100,7 → 104,7
encoderlist.append(resname);
}
}
pos += len;
pos = match.capturedStart(n++);
}
 
foreach (const QString& enc, encoderlist)
457,62 → 461,62
 
if (ui.includetextCheck->isChecked())
{
if (!opts.contains(QRegExp("\\bincludetext\\b")))
if (!opts.contains(QRegularExpression("\\bincludetext\\b")))
opts.append(" includetext");
}
else
{
opts.replace(QRegExp("\\bincludetext\\b")," ");
opts.replace(QRegularExpression("\\bincludetext\\b")," ");
}
 
if (ui.guardwhitespaceCheck->isChecked())
{
if (!opts.contains(QRegExp("\\bguardwhitespace\\b")))
if (!opts.contains(QRegularExpression("\\bguardwhitespace\\b")))
opts.append(" guardwhitespace");
}
else
{
opts.replace(QRegExp("\\bguardwhitespace\\b")," ");
opts.replace(QRegularExpression("\\bguardwhitespace\\b")," ");
}
 
if (ui.includecheckCheck->isChecked())
{
if (!opts.contains(QRegExp("\\bincludecheck\\b")))
if (!opts.contains(QRegularExpression("\\bincludecheck\\b")))
opts.append(" includecheck");
}
else
{
opts.replace(QRegExp("\\bincludecheck\\b")," ");
opts.replace(QRegularExpression("\\bincludecheck\\b")," ");
}
 
if (ui.includecheckintextCheck->isChecked())
{
if (!opts.contains(QRegExp("\\bincludecheckintext\\b")))
if (!opts.contains(QRegularExpression("\\bincludecheckintext\\b")))
opts.append(" includecheckintext");
}
else
{
opts.replace(QRegExp("\\bincludecheckintext\\b")," ");
opts.replace(QRegularExpression("\\bincludecheckintext\\b")," ");
}
 
if (ui.parseCheck->isChecked())
{
if (!opts.contains(QRegExp("\\bparse\\b")))
if (!opts.contains(QRegularExpression("\\bparse\\b")))
opts.append(" parse");
}
else
{
opts.replace(QRegExp("\\bparse\\b")," ");
opts.replace(QRegularExpression("\\bparse\\b")," ");
}
 
if (ui.parsefncCheck->isChecked())
{
if (!opts.contains(QRegExp("\\bparsefnc\\b")))
if (!opts.contains(QRegularExpression("\\bparsefnc\\b")))
opts.append(" parsefnc");
}
else
{
opts.replace(QRegExp("\\bparsefnc\\b")," ");
opts.replace(QRegularExpression("\\bparsefnc\\b")," ");
}
 
QString enc = map[ui.bcCombo->currentText()].command;
521,14 → 525,14
if (ui.formatCombo->currentIndex() != 0)
{
QString t = ui.formatCombo->currentText();
if (!opts.contains(QRegExp("\\b" + QRegExp::escape(vlbl) + "=.*\\b")))
if (!opts.contains(QRegularExpression("\\b" + QRegularExpression::escape(vlbl) + "=.*\\b")))
opts.append(" " + vlbl + "=" + t);
else
opts.replace(QRegExp("\\b" + QRegExp::escape(vlbl) + "=\\S*\\b"), vlbl + "=" + t);
opts.replace(QRegularExpression("\\b" + QRegularExpression::escape(vlbl) + "=\\S*\\b"), vlbl + "=" + t);
}
else
{
opts.replace(QRegExp("\\b" + QRegExp::escape(vlbl) + "=\\S*\\b"), " ");
opts.replace(QRegularExpression("\\b" + QRegularExpression::escape(vlbl) + "=\\S*\\b"), " ");
}
 
if (ui.eccCombo->currentIndex() != 0)
537,11 → 541,11
if (!opts.contains(QRegExp("\\beclevel=.*\\b")))
opts.append(" eclevel=" + t);
else
opts.replace(QRegExp("\\beclevel=\\S*\\b"), "eclevel=" + t);
opts.replace(QRegularExpression("\\beclevel=\\S*\\b"), "eclevel=" + t);
}
else
{
opts.replace(QRegExp("\\beclevel=\\S*\\b")," ");
opts.replace(QRegularExpression("\\beclevel=\\S*\\b")," ");
}
 
ui.optionsEdit->blockSignals(true);
/trunk/Scribus/scribus/plugins/barcodegenerator/barcodegeneratorrenderthread.cpp
12,6 → 12,7
#include "util_ghostscript.h"
 
#include <QDir>
#include <QRegularExpression>
#include <QTextStream>
#include <QThread>
 
88,10 → 89,10
QTextStream ts(&f);
QString err = ts.readAll();
f.close();
QRegExp rx("[\\r\\n]+BWIPP ERROR: [^\\s]+ (.*)[\\r\\n$]+");
rx.setMinimal(true);
if (rx.indexIn(err) != -1)
errorMsg=rx.cap(1).trimmed();
QRegularExpression rx("[\\r\\n]+BWIPP ERROR: [^\\s]+ (.*)[\\r\\n$]+", QRegularExpression::InvertedGreedinessOption);
QRegularExpressionMatch match = rx.match(err);
if (match.hasMatch())
errorMsg = match.captured(1).trimmed();
}
}
}
/trunk/Scribus/scribus/plugins/export/svgexplugin/svgexplugin.cpp
1485,7 → 1485,7
 
QString SVGExPlug::handleGlyph(uint gid, const ScFace& font)
{
QString glName = QString("Gl%1%2").arg(font.psName().simplified().replace(QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )).arg(gid);
QString glName = QString("Gl%1%2").arg(font.psName().simplified().replace(QRegularExpression("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%]"), "_" )).arg(gid);
if (m_glyphNames.contains(glName))
return glName;
FPointArray pts = font.glyphOutline(gid);
/trunk/Scribus/scribus/plugins/gettext/textfilter/textfilter.cpp
4,21 → 4,24
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "textfilter.h"
 
#include <QByteArray>
#include <QFile>
#include <QFileInfo>
#include <QMap>
#include <QRegularExpression>
#include <QString>
#include <QStringList>
#include <QTextCodec>
#include <QRegExp>
#include <QMap>
#include <QToolTip>
#include "prefsmanager.h"
#include "prefsfile.h"
 
#include <vector>
 
#include "gtframestyle.h"
#include "gtparagraphstyle.h"
#include "prefsfile.h"
#include "prefsmanager.h"
#include "textfilter.h"
#include "tfdia.h"
 
QString FileFormatName()
98,8 → 101,7
if (useRegexp)
replace(&replaceWith);
QString pstyle = (*filters)[i]->getPStyleName();
QRegExp rx = QRegExp(regExp);
rx.setMinimal(true);
QRegularExpression rx(regExp, QRegularExpression::InvertedGreedinessOption);
switch (action)
{
case REMOVE:
150,7 → 152,7
int moreThan = (*filters)[j]->getMoreThan();
int style = (*filters)[j]->getStyle();
bool removeMatch = (*filters)[j]->removeMatch();
QRegExp rx = QRegExp(regExp);
QRegularExpression rx(regExp);
if (!pstyle.isEmpty())
{
switch (action)
/trunk/Scribus/scribus/plugins/import/ai/importai.cpp
2445,9 → 2445,9
ScTextStream gVals(&Cdata, QIODevice::ReadOnly);
gVals >> textFont >> textSize;
textFont.remove(0, 2);
QString family = textFont;
QString ret = "";
family.replace( QRegExp( "'" ) , QChar( ' ' ) );
QString family(textFont);
QString ret;
family.replace( QRegularExpression( "'" ) , QChar( ' ' ) );
textFont = m_Doc->itemToolPrefs().textFont;
bool found = false;
SCFontsIterator it(PrefsManager::instance().appPrefs.fontPrefs.AvailFonts);
/trunk/Scribus/scribus/plugins/import/cgm/importcgm.cpp
265,7 → 265,7
{
PageItem* group = m_Doc->groupObjectsList(Elements);
if (!pictName.isEmpty())
group->setItemName(group->generateUniqueCopyName(pictName, false).replace( QRegExp("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%\\.]"), "_" ));
group->setItemName(group->generateUniqueCopyName(pictName, false).replace( QRegularExpression("[\\s\\/\\{\\[\\]\\}\\<\\>\\(\\)\\%\\.]"), "_" ));
}
m_Doc->DoDrawing = true;
m_Doc->scMW()->setScriptRunning(false);
/trunk/Scribus/scribus/plugins/import/drw/importdrw.cpp
711,7 → 711,7
ds >> chData;
}
fontName = fontName.trimmed();
fontName.replace( QRegExp( "'" ) , QChar( ' ' ) );
fontName.replace( QRegularExpression( "'" ) , QChar( ' ' ) );
{
textFont = m_Doc->itemToolPrefs().textFont;
bool found = false;
/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
1007,7 → 1007,7
mat.scale(sx, sy);
if (!textArea.isEmpty())
{
QStringList points = textArea.replace( QRegExp(","), " ").simplified().split( ' ', Qt::SkipEmptyParts );
QStringList points = textArea.replace( QRegularExpression(","), " ").simplified().split( ' ', Qt::SkipEmptyParts );
texAreaPoints.append(QPointF(ScCLocale::toDoubleC(points[0]), ScCLocale::toDoubleC(points[1])));
texAreaPoints.append(QPointF(ScCLocale::toDoubleC(points[2]), ScCLocale::toDoubleC(points[3])));
texAreaPoints = mat.map(texAreaPoints);
1997,7 → 1997,7
if (!object.attribute( "svg:viewBox" ).isEmpty())
{
QString viewbox( object.attribute( "svg:viewBox" ) );
QStringList points = viewbox.replace( QRegExp(","), " ").simplified().split( ' ', Qt::SkipEmptyParts );
QStringList points = viewbox.replace( QRegularExpression(","), " ").simplified().split( ' ', Qt::SkipEmptyParts );
*x = ScCLocale::toDoubleC(points[0]);
*y = ScCLocale::toDoubleC(points[1]);
*w = ScCLocale::toDoubleC(points[2]);
2670,7 → 2670,7
if (actStyle.markerViewBox.valid)
{
QString viewbox = actStyle.markerViewBox.value;
QStringList points = viewbox.replace( QRegExp(","), " ").simplified().split( ' ', Qt::SkipEmptyParts );
QStringList points = viewbox.replace( QRegularExpression(","), " ").simplified().split( ' ', Qt::SkipEmptyParts );
tmpOStyle.markerViewBox = QRectF(ScCLocale::toDoubleC(points[0]), ScCLocale::toDoubleC(points[1]), ScCLocale::toDoubleC(points[2]), ScCLocale::toDoubleC(points[3]));
}
else
2854,8 → 2854,8
 
bool OdgPlug::parseEnhPath(const QString& svgPath, FPointArray &result, bool &fill, bool &stroke)
{
QString d = svgPath;
d = d.replace( QRegExp( "," ), " ");
QString d(svgPath);
d = d.replace( QRegularExpression( "," ), " ");
bool ret = false;
fill = true;
stroke = true;
/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
1453,7 → 1453,7
if (!object.attribute( "svg:viewBox" ).isEmpty())
{
QString viewbox( object.attribute( "svg:viewBox" ) );
QStringList points = viewbox.replace( QRegExp(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
QStringList points = viewbox.replace( QRegularExpression(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
*x = ScCLocale::toDoubleC(points[0]);
*y = ScCLocale::toDoubleC(points[1]);
*w = ScCLocale::toDoubleC(points[2]);
1571,8 → 1571,8
 
bool OODPlug::parseSVG(const QString &s, FPointArray *ite)
{
QString d = s;
d = d.replace( QRegExp( "," ), " ");
QString d(s);
d = d.replace( QRegularExpression( "," ), " ");
bool ret = false;
if (!d.isEmpty())
{
/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
926,7 → 926,7
bool ShapePlug::parseSVG( const QString &s, FPointArray *ite )
{
QString d = s;
d = d.replace( QRegExp( "," ), " ");
d = d.replace( QRegularExpression( "," ), " ");
bool ret = false;
if (!d.isEmpty())
{
/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
266,7 → 266,7
if (!docElem.attribute("viewBox").isEmpty())
{
QString viewbox(docElem.attribute("viewBox"));
QStringList points = viewbox.replace(QRegExp(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
QStringList points = viewbox.replace(QRegularExpression(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
if (points.size() > 3)
{
QTransform matrix;
447,7 → 447,7
if (!docElem.attribute("viewBox").isEmpty())
{
QString viewbox(docElem.attribute("viewBox"));
QStringList points = viewbox.replace(QRegExp(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
QStringList points = viewbox.replace(QRegularExpression(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
if (points.size() > 3)
{
QTransform matrix;
1071,7 → 1071,7
if (!e.attribute("viewBox").isEmpty())
{
QString viewbox(e.attribute("viewBox"));
QStringList points = viewbox.replace(QRegExp(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
QStringList points = viewbox.replace(QRegularExpression(","), " ").simplified().split(' ', Qt::SkipEmptyParts);
if (points.size() > 3)
{
double left = ScCLocale::toDoubleC(points[0]);
/trunk/Scribus/scribus/plugins/scriptplugin/pconsole.cpp
292,32 → 292,28
 
foreach (const QString& kw, keywords)
{
rule.pattern = QRegExp("\\b" + kw + "\\b", Qt::CaseInsensitive);
rule.pattern = QRegularExpression("\\b" + kw + "\\b", QRegularExpression::CaseInsensitiveOption);
rule.format = keywordFormat;
highlightingRules.append(rule);
}
 
rule.pattern = QRegExp("#[^\n]*");
rule.pattern = QRegularExpression("#[^\n]*");
rule.format = singleLineCommentFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("\'.*\'");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("\'.*\'", QRegularExpression::InvertedGreedinessOption);
rule.format = quotationFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("\".*\"");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("\".*\"", QRegularExpression::InvertedGreedinessOption);
rule.format = quotationFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("\\b\\d+\\b");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("\\b\\d+\\b", QRegularExpression::InvertedGreedinessOption);
rule.format = numberFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("[\\\\|\\<|\\>|\\=|\\!|\\+|\\-|\\*|\\/|\\%]+");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("[\\\\|\\<|\\>|\\=|\\!|\\+|\\-|\\*|\\/|\\%]+", QRegularExpression::InvertedGreedinessOption);
rule.format = operatorFormat;
highlightingRules.append(rule);
}
329,13 → 325,15
 
foreach (HighlightingRule rule, highlightingRules)
{
QRegExp expression(rule.pattern);
int index = expression.indexIn(text);
QRegularExpression expression(rule.pattern);
QRegularExpressionMatch match = expression.match(text);
int n = 0;
int index = match.capturedStart(n);
while (index >= 0)
{
int length = expression.matchedLength();
int length = match.capturedLength(n);
setFormat(index, length, rule.format);
index = expression.indexIn(text, index + length);
index = match.capturedStart(++n);
}
}
setCurrentBlockState(0);
/trunk/Scribus/scribus/plugins/scriptplugin/pconsole.h
16,6 → 16,7
 
#include <QLabel>
#include <QMainWindow>
#include <QRegularExpression>
#include <QSyntaxHighlighter>
#include "ui_pconsole.h"
 
126,7 → 127,7
 
struct HighlightingRule
{
QRegExp pattern;
QRegularExpression pattern;
QTextCharFormat format;
};
QVector<HighlightingRule> highlightingRules;
/trunk/Scribus/scribus/plugins/scriptplugin_py2x/pconsole.cpp
292,31 → 292,29
 
foreach (const QString& kw, keywords)
{
rule.pattern = QRegExp("\\b" + kw + "\\b", Qt::CaseInsensitive);
rule.pattern = QRegularExpression("\\b" + kw + "\\b", QRegularExpression::CaseInsensitiveOption);
rule.format = keywordFormat;
highlightingRules.append(rule);
}
 
rule.pattern = QRegExp("#[^\n]*");
rule.pattern = QRegularExpression("#[^\n]*");
rule.format = singleLineCommentFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("\'.*\'");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("\'.*\'". QRegularExpression::InvertedGreedinessOption);
 
rule.format = quotationFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("\".*\"");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("\".*\"", QRegularExpression::InvertedGreedinessOption);
rule.format = quotationFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("\\b\\d+\\b");
rule.pattern.setMinimal(true);
rule.pattern = QRegularExpression("\\b\\d+\\b", QRegularExpression::InvertedGreedinessOption);
rule.format = numberFormat;
highlightingRules.append(rule);
 
rule.pattern = QRegExp("[\\\\|\\<|\\>|\\=|\\!|\\+|\\-|\\*|\\/|\\%]+");
rule.pattern = QRegularExpression("[\\\\|\\<|\\>|\\=|\\!|\\+|\\-|\\*|\\/|\\%]+");
rule.pattern.setMinimal(true);
rule.format = operatorFormat;
highlightingRules.append(rule);
/trunk/Scribus/scribus/plugins/short-words/parse.cpp
17,7 → 17,7
*/
 
#include <QProgressBar>
#include <QRegExp>
#include <QRegularExpression>
 
#include "parse.h"
 
48,7 → 48,7
// text with special space
QString unbreak;
// the regexp
QRegExp rx(" ");
QRegularExpression rx(" ");
// cfg
SWConfig *cfg = new SWConfig();