content.setAttribute("font-pixel-size", font.pixelSize());
content.setAttribute("font-italic", font.italic());
content.setAttribute("font-underline", font.underline());
- content.setAttribute("font-color", colorToString(t->defaultTextColor()));
+ {
+ QTextCursor cursor(t->document());
+ cursor.select(QTextCursor::Document);
+ QColor fontcolor = cursor.charFormat().foreground().color();
+ content.setAttribute("font-color", colorToString(fontcolor));
+ if (!t->data(101).isNull()) content.setAttribute("font-outline", t->data(101).toDouble());
+ if (!t->data(102).isNull()) content.setAttribute("font-outline-color", colorToString(QColor(t->data(102).toString())));
+ }
+ if (!t->data(100).isNull()) {
+ QStringList effectParams = t->data(100).toStringList();
+ QString effectName = effectParams.takeFirst();
+ content.setAttribute(effectName, effectParams.join(";"));
+ }
// Only save when necessary.
if (t->data(OriginXLeft).toInt() == AxisInverted) {
pos.setAttribute("y", item->pos().y());
QTransform transform = item->transform();
QDomElement tr = doc.createElement("transform");
+ if (!item->data(ZOOMFACTOR).isNull()) {
+ tr.setAttribute("zoom", QString::number(item->data(ZOOMFACTOR).toInt()));
+ }
+ if (!item->data(ROTATEFACTOR).isNull()) {
+ QList<QVariant> rotlist = item->data(ROTATEFACTOR).toList();
+ tr.setAttribute("rotation", QString("%1,%2,%3").arg(rotlist[0].toDouble()).arg(rotlist[1].toDouble()).arg(rotlist[2].toDouble()));
+ }
tr.appendChild(doc.createTextNode(
QString("%1,%2,%3,%4,%5,%6,%7,%8,%9").arg(
transform.m11()).arg(transform.m12()).arg(transform.m13()).arg(transform.m21()).arg(transform.m22()).arg(transform.m23()).arg(transform.m31()).arg(transform.m32()).arg(transform.m33())
font.setPixelSize(txtProperties.namedItem("font-pixel-size").nodeValue().toInt());
QColor col(stringToColor(txtProperties.namedItem("font-color").nodeValue()));
QGraphicsTextItem *txt = m_scene->addText(items.item(i).namedItem("content").firstChild().nodeValue(), font);
- txt->setDefaultTextColor(col);
+ QTextCursor cursor(txt->document());
+ cursor.select(QTextCursor::Document);
+ QTextCharFormat format;
+ if (txtProperties.namedItem("font-outline").nodeValue().toDouble() > 0.0) {
+ txt->setData(101, txtProperties.namedItem("font-outline").nodeValue().toDouble());
+ txt->setData(102, stringToColor(txtProperties.namedItem("font-outline-color").nodeValue()));
+ format.setTextOutline(
+ QPen(QColor(stringToColor(txtProperties.namedItem("font-outline-color").nodeValue())),
+ txtProperties.namedItem("font-outline").nodeValue().toDouble(),
+ Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)
+ );
+
+ }
+ format.setForeground(QBrush(col));
+ cursor.mergeCharFormat(format);
txt->setTextInteractionFlags(Qt::NoTextInteraction);
if (txtProperties.namedItem("alignment").isNull() == false) {
txt->setTextWidth(txt->boundingRect().width());
txt->setData(OriginYTop, txtProperties.namedItem("kdenlive-axis-y-inverted").nodeValue().toInt());
}
+ // Effects
+ if (!txtProperties.namedItem("typewriter").isNull()) {
+ QStringList effData = QStringList() << "typewriter" << txtProperties.namedItem("typewriter").nodeValue();
+ txt->setData(100, effData);
+ }
+
gitem = txt;
} else if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsRectItem") {
QString rect = items.item(i).namedItem("content").attributes().namedItem("rect").nodeValue();
QString br_str = items.item(i).namedItem("content").attributes().namedItem("brushcolor").nodeValue();
QString pen_str = items.item(i).namedItem("content").attributes().namedItem("pencolor").nodeValue();
double penwidth = items.item(i).namedItem("content").attributes().namedItem("penwidth").nodeValue().toDouble();
- QGraphicsRectItem *rec = m_scene->addRect(stringToRect(rect), QPen(QBrush(stringToColor(pen_str)), penwidth), QBrush(stringToColor(br_str)));
+ QGraphicsRectItem *rec = m_scene->addRect(stringToRect(rect), QPen(QBrush(stringToColor(pen_str)), penwidth, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin), QBrush(stringToColor(br_str)));
gitem = rec;
} else if (items.item(i).attributes().namedItem("type").nodeValue() == "QGraphicsPixmapItem") {
QString url = items.item(i).namedItem("content").attributes().namedItem("url").nodeValue();
QPointF p(items.item(i).namedItem("position").attributes().namedItem("x").nodeValue().toDouble(),
items.item(i).namedItem("position").attributes().namedItem("y").nodeValue().toDouble());
gitem->setPos(p);
- gitem->setTransform(stringToTransform(items.item(i).namedItem("position").firstChild().firstChild().nodeValue()));
+ QDomElement trans = items.item(i).namedItem("position").firstChild().toElement();
+ gitem->setTransform(stringToTransform(trans.firstChild().nodeValue()));
+ QString rotate = trans.attribute("rotation");
+ if (!rotate.isEmpty()) gitem->setData(ROTATEFACTOR, stringToList(rotate));
+ QString zoom = trans.attribute("zoom");
+ if (!zoom.isEmpty()) gitem->setData(ZOOMFACTOR, zoom.toInt());
int zValue = items.item(i).attributes().namedItem("z-index").nodeValue().toInt();
if (zValue > maxZValue) maxZValue = zValue;
gitem->setZValue(zValue);
gitem->setGraphicsEffect(shadow);
}
}
- }
#endif
+ }
if (items.item(i).nodeName() == "background") {
kDebug() << items.item(i).attributes().namedItem("color").nodeValue();
return QColor();
return QColor(l.at(0).toInt(), l.at(1).toInt(), l.at(2).toInt(), l.at(3).toInt());;
}
+
QTransform TitleDocument::stringToTransform(const QString& s)
{
QStringList l = s.split(',');
);
}
+QList<QVariant> TitleDocument::stringToList(const QString & s)
+{
+ QStringList l = s.split(',');
+ if (l.size() < 3)
+ return QList<QVariant>();
+ return QList<QVariant>() << QVariant(l.at(0).toDouble()) << QVariant(l.at(1).toDouble()) << QVariant(l.at(2).toDouble());
+}
+
int TitleDocument::frameWidth() const
{
return m_width;