r23131 by craig - Remove unnecessary color parsing code used in ODG and SVG etc importers as QColor knows about them these days
scribus-commit
scribus-commit at lists.scribus.net
Thu Aug 15 21:05:25 UTC 2019
Author: craig
Date: Thu Aug 15 21:05:25 2019
New Revision: 23131
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23131
Log:
Remove unnecessary color parsing code used in ODG and SVG etc importers as QColor knows about them these days
Modified:
trunk/Scribus/scribus/color.h
trunk/Scribus/scribus/gtaction.cpp
trunk/Scribus/scribus/gtaction.h
trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
trunk/Scribus/scribus/plugins/import/odg/importodg.h
trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.h
trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h
trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
Modified: trunk/Scribus/scribus/gtaction.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/gtaction.cpp
==============================================================================
--- trunk/Scribus/scribus/gtaction.cpp (original)
+++ trunk/Scribus/scribus/gtaction.cpp Thu Aug 15 21:05:25 2019
@@ -35,7 +35,6 @@
#include "gtparagraphstyle.h"
#include "gtframestyle.h"
-#include "color.h"
#include "commonstrings.h"
#include "hyphenator.h"
#include "marks.h"
@@ -833,13 +832,7 @@
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
- {
- QString rgbColor = s.trimmed();
- if( rgbColor.startsWith( "#" ) )
- c.setNamedColor( rgbColor );
- else
- c = parseColorN( rgbColor );
- }
+ c.setNamedColor(s.trimmed());
found = false;
for (it = m_textFrame->doc()->PageColors.begin(); it != m_textFrame->doc()->PageColors.end(); ++it)
{
@@ -861,13 +854,6 @@
return ret;
}
-QColor gtAction::parseColorN(const QString &rgbColor)
-{
- int r, g, b;
- keywordToRGB( rgbColor, r, g, b );
- return QColor( r, g, b );
-}
-
void gtAction::finalize()
{
if (m_textFrame->doc()->docHyphenator->AutoCheck)
Modified: trunk/Scribus/scribus/gtaction.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/gtaction.h
==============================================================================
--- trunk/Scribus/scribus/gtaction.h (original)
+++ trunk/Scribus/scribus/gtaction.h Thu Aug 15 21:05:25 2019
@@ -109,7 +109,6 @@
QString findFontName(gtFont* font);
void updateParagraphStyle(int pstyleIndex, gtParagraphStyle* pstyle);
QString parseColor(const QString &s);
- QColor parseColorN(const QString &rgbColor);
void finalize();
PrefsManager& m_prefsManager;
StoryText* m_noteStory;
Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp (original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.cpp Thu Aug 15 21:05:25 2019
@@ -17,7 +17,7 @@
#include <QScopedPointer>
#include <QXmlInputSource>
#include <QXmlSimpleReader>
-#include "color.h"
+
#include "scribusdoc.h"
#include "styles/charstyle.h"
#include "styles/paragraphstyle.h"
@@ -30,7 +30,7 @@
QString FileFormatName()
{
- return QObject::tr("ODT Document");
+ return QObject::tr("ODT Document");
}
QStringList FileExtensions()
@@ -1271,13 +1271,6 @@
return value;
}
-QColor ODTIm::parseColorN( const QString &rgbColor )
-{
- int r, g, b;
- keywordToRGB( rgbColor, r, g, b );
- return QColor( r, g, b );
-}
-
QString ODTIm::parseColor( const QString &s )
{
QColor c;
@@ -1309,13 +1302,7 @@
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
- {
- QString rgbColor = s.trimmed();
- if (rgbColor.startsWith( "#" ))
- c.setNamedColor( rgbColor );
- else
- c = parseColorN( rgbColor );
- }
+ c.setNamedColor( s.trimmed() );
ScColor tmp;
tmp.fromQColor(c);
tmp.setSpotColor(false);
Modified: trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h
==============================================================================
--- trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h (original)
+++ trunk/Scribus/scribus/plugins/gettext/odt2im/importodt.h Thu Aug 15 21:05:25 2019
@@ -149,7 +149,6 @@
void applyParagraphStyle(ParagraphStyle &tmpStyle, ObjStyleODT &oStyle);
void resolveStyle(ObjStyleODT &tmpOStyle, const QString& pAttrs);
double parseUnit(const QString &unit);
- QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
QString constructFontName(const QString& fontBaseName, const QString& fontStyle);
void setFontstyle(CharStyle &tmpCStyle, int kind);
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.cpp Thu Aug 15 21:05:25 2019
@@ -34,7 +34,6 @@
#include "importodg.h"
-#include "color.h"
#include "fileloader.h"
#include "third_party/fparser/fparser.hh"
#include "loadsaveplugin.h"
@@ -3227,13 +3226,6 @@
return fNam;
}
-QColor OdgPlug::parseColorN( const QString &rgbColor )
-{
- int r, g, b;
- keywordToRGB( rgbColor, r, g, b );
- return QColor( r, g, b );
-}
-
QString OdgPlug::parseColor( const QString &s )
{
QColor c;
@@ -3265,13 +3257,8 @@
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
- {
- QString rgbColor = s.trimmed();
- if (rgbColor.startsWith( "#" ))
- c.setNamedColor( rgbColor );
- else
- c = parseColorN( rgbColor );
- }
+ c.setNamedColor(s.trimmed());
+
ScColor tmp;
tmp.fromQColor(c);
tmp.setSpotColor(false);
Modified: trunk/Scribus/scribus/plugins/import/odg/importodg.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/odg/importodg.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/odg/importodg.h (original)
+++ trunk/Scribus/scribus/plugins/import/odg/importodg.h Thu Aug 15 21:05:25 2019
@@ -351,7 +351,6 @@
void arcTo(QPainterPath &path, QPointF startpoint, double rx, double ry, double startAngle, double sweepAngle);
int arcToCurve(double rx, double ry, double startAngle, double sweepAngle, const QPointF & offset, QPointF * curvePoints);
QString modifyColor(const QString& name, bool darker, int amount);
- QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
QString constructFontName(const QString& fontBaseName, const QString& fontStyle);
QPointF intersectBoundingRect(PageItem *item, QLineF gradientVector);
Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.cpp Thu Aug 15 21:05:25 2019
@@ -20,7 +20,6 @@
#include "scconfig.h"
-#include "color.h"
#include "commonstrings.h"
#include "fpointarray.h"
#include "pageitem.h"
@@ -1355,13 +1354,6 @@
return value;
}
-QColor OODPlug::parseColorN( const QString &rgbColor )
-{
- int r, g, b;
- keywordToRGB( rgbColor, r, g, b );
- return QColor( r, g, b );
-}
-
QString OODPlug::parseColor( const QString &s )
{
QColor c;
@@ -1391,13 +1383,8 @@
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
- {
- QString rgbColor = s.trimmed();
- if (rgbColor.startsWith( "#" ))
- c.setNamedColor(rgbColor);
- else
- c = parseColorN(rgbColor);
- }
+ c.setNamedColor(s.trimmed());
+
ScColor tmp;
tmp.fromQColor(c);
tmp.setSpotColor(false);
Modified: trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.h (original)
+++ trunk/Scribus/scribus/plugins/import/oodraw/oodrawimp.h Thu Aug 15 21:05:25 2019
@@ -128,7 +128,6 @@
void fillStyleStack( const QDomElement& object );
void addStyles( const QDomElement* style );
void storeObjectStyles( const QDomElement& object );
- QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
void parseTransform(FPointArray *composite, const QString &transform);
void parseViewBox( const QDomElement& object, double *x, double *y, double *w, double *h );
Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.cpp Thu Aug 15 21:05:25 2019
@@ -18,7 +18,6 @@
#include <cstdlib>
-#include "color.h"
#include "commonstrings.h"
#include "fileloader.h"
#include "loadsaveplugin.h"
@@ -3508,13 +3507,6 @@
return ScCLocale::toDoubleC(s1) / 100.0;
}
-QColor RawPainter::parseColorN( const QString &rgbColor )
-{
- int r, g, b;
- keywordToRGB( rgbColor.toLower(), r, g, b );
- return QColor( r, g, b );
-}
-
QString RawPainter::parseColor( const QString &s )
{
QColor c;
@@ -3544,16 +3536,8 @@
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
- {
- QString rgbColor = s.trimmed();
- if (rgbColor.startsWith( "#" ))
- {
- rgbColor = rgbColor.left(7);
- c.setNamedColor( rgbColor );
- }
- else
- c = parseColorN( rgbColor );
- }
+ c.setNamedColor( s.trimmed() );
+
ScColor tmp;
tmp.fromQColor(c);
tmp.setSpotColor(false);
Modified: trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h (original)
+++ trunk/Scribus/scribus/plugins/import/revenge/rawpainter.h Thu Aug 15 21:05:25 2019
@@ -99,7 +99,6 @@
double valueAsPoint(const librevenge::RVNGProperty *prop);
QString constructFontName(const QString& fontBaseName, const QString& fontStyle);
double fromPercentage(const QString &s );
- QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
void insertImage(PageItem* ite, const QString& imgExt, QByteArray &imageData);
void applyFill(PageItem* ite);
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.cpp Thu Aug 15 21:05:25 2019
@@ -18,7 +18,6 @@
#include "svgplugin.h"
-#include "color.h"
#include "commonstrings.h"
#include "fonts/scfontmetrics.h"
#include "fpointarray.h"
@@ -2336,15 +2335,6 @@
return ite->parseSVG(s);
}
-
-QColor SVGPlug::parseColorN(const QString &rgbColor)
-{
- int r, g, b;
- keywordToRGB(rgbColor.toLower(), r, g, b);
- return QColor(r, g, b);
-}
-
-
QString SVGPlug::parseColor(const QString &s)
{
QColor c;
@@ -2384,16 +2374,8 @@
c = QColor(r.toInt(), g.toInt(), b.toInt());
}
else
- {
- QString rgbColor = s.trimmed();
- if (rgbColor.startsWith("#"))
- {
- rgbColor = rgbColor.left(7);
- c.setNamedColor(rgbColor);
- }
- else
- c = parseColorN(rgbColor);
- }
+ c.setNamedColor(s.trimmed());
+
ScColor tmp;
tmp.fromQColor(c);
tmp.setSpotColor(false);
Modified: trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23131&path=/trunk/Scribus/scribus/plugins/import/svg/svgplugin.h
==============================================================================
--- trunk/Scribus/scribus/plugins/import/svg/svgplugin.h (original)
+++ trunk/Scribus/scribus/plugins/import/svg/svgplugin.h Thu Aug 15 21:05:25 2019
@@ -277,7 +277,6 @@
double parseUnit(const QString &unit);
QTransform parseTransform(const QString &transform);
bool parseSVG( const QString &s, FPointArray *ite );
- QColor parseColorN( const QString &rgbColor );
QString parseColor( const QString &s );
QString parseIccColor( const QString &s );
QString parseTagName( const QDomElement &e );
More information about the scribus-commit
mailing list