[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: koffice/krita/image/recorder
From: Cyrille Berger <cyb () lepi ! org>
Date: 2010-02-02 22:50:21
Message-ID: 1265151021.136001.13498.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1084349 by berger:
--duplicated code (use common implementation for deserializing colors)
M +2 -18 kis_recorded_bezier_curve_paint_action.cpp
M +25 -0 kis_recorded_paint_action.cpp
M +3 -0 kis_recorded_paint_action.h
M +2 -18 kis_recorded_polyline_paint_action.cpp
--- trunk/koffice/krita/image/recorder/kis_recorded_bezier_curve_paint_action.cpp \
#1084348:1084349 @@ -167,25 +167,9 @@
}
// Decode colors
- QDomElement backgroundColorElt = elt.firstChildElement("BackgroundColor");
- KoColor bC;
+ KoColor bC = backgroundColorFromXML(elt);
+ KoColor fC = paintColorFromXML(elt);
- if (!backgroundColorElt.isNull()) {
- bC = KoColor::fromXML(backgroundColorElt.firstChildElement(), \
Integer8BitsColorDepthID.id(), QHash<QString, QString>());
- bC.setOpacity(255);
- dbgImage << "Background color : " << bC.toQColor();
- } else {
- dbgImage << "Warning: no <BackgroundColor /> found";
- }
- QDomElement foregroundColorElt = elt.firstChildElement("ForegroundColor");
- KoColor fC;
- if (!foregroundColorElt.isNull()) {
- fC = KoColor::fromXML(foregroundColorElt.firstChildElement(), \
Integer8BitsColorDepthID.id(), QHash<QString, QString>());
- dbgImage << "Foreground color : " << fC.toQColor();
- fC.setOpacity(255);
- } else {
- dbgImage << "Warning: no <ForegroundColor /> found";
- }
KisRecordedBezierCurvePaintAction* rplpa = new \
KisRecordedBezierCurvePaintAction(name, pathnode, paintOpPreset, fC, bC, opacity, \
paintIncremental, compositeOp);
QDomElement wpElt = elt.firstChildElement("Waypoints");
--- trunk/koffice/krita/image/recorder/kis_recorded_paint_action.cpp #1084348:1084349
@@ -218,3 +218,28 @@
settings->fromXML(elt);
return settings;
}
+
+KoColor KisRecordedPaintActionFactory::paintColorFromXML(const QDomElement& elt)
+{
+ return colorFromXML(elt, "ForegroundColor");
+}
+
+KoColor KisRecordedPaintActionFactory::backgroundColorFromXML(const QDomElement& \
elt) +{
+ return colorFromXML(elt, "BackgroundColor");
+}
+
+KoColor KisRecordedPaintActionFactory::colorFromXML(const QDomElement& elt, const \
QString& elementName) +{
+ QDomElement colorElt = elt.firstChildElement(elementName);
+ KoColor bC;
+
+ if (!colorElt.isNull()) {
+ bC = KoColor::fromXML(colorElt.firstChildElement(), \
Integer8BitsColorDepthID.id(), QHash<QString, QString>()); + \
bC.setOpacity(255); + dbgImage << elementName << " color : " << bC.toQColor();
+ } else {
+ dbgImage << "Warning: no <" << elementName << " /> found";
+ }
+ return bC;
+}
--- trunk/koffice/krita/image/recorder/kis_recorded_paint_action.h #1084348:1084349
@@ -81,6 +81,9 @@
protected:
KisPaintOpPresetSP paintOpPresetFromXML(const QDomElement& elt);
+ KoColor paintColorFromXML(const QDomElement& elt);
+ KoColor backgroundColorFromXML(const QDomElement& elt);
+ KoColor colorFromXML(const QDomElement& elt, const QString& elementName);
};
--- trunk/koffice/krita/image/recorder/kis_recorded_polyline_paint_action.cpp \
#1084348:1084349 @@ -137,24 +137,8 @@
// Decode colors
- QDomElement backgroundColorElt = elt.firstChildElement("BackgroundColor");
- KoColor bC;
- if (!backgroundColorElt.isNull()) {
- bC = KoColor::fromXML(backgroundColorElt.firstChildElement(""), \
Integer8BitsColorDepthID.id(), QHash<QString, QString>());
- bC.setOpacity(255);
- dbgUI << "Background color : " << bC.toQColor();
- } else {
- dbgUI << "Warning: no <BackgroundColor /> found";
- }
- QDomElement foregroundColorElt = elt.firstChildElement("ForegroundColor");
- KoColor fC;
- if (!foregroundColorElt.isNull()) {
- fC = KoColor::fromXML(foregroundColorElt.firstChildElement(""), \
Integer8BitsColorDepthID.id(), QHash<QString, QString>());
- fC.setOpacity(255);
- dbgUI << "Foreground color : " << fC.toQColor();
- } else {
- dbgUI << "Warning: no <ForegroundColor /> found";
- }
+ KoColor bC = backgroundColorFromXML(elt);
+ KoColor fC = paintColorFromXML(elt);
KisRecordedPolyLinePaintAction* rplpa = new KisRecordedPolyLinePaintAction(name, \
pathnode, paintOpPreset, fC, bC, opacity, paintIncremental, compositeOp);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic