Commit 99ca890b authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix titler rect gradients

parent ab622672
......@@ -503,16 +503,17 @@ int TitleDocument::loadFromXml(const QDomDocument& doc, QGraphicsRectItem* start
gitem = txt;
} else if (itemNode.attributes().namedItem(QStringLiteral("type")).nodeValue() == QLatin1String("QGraphicsRectItem")) {
QString rect = itemNode.namedItem(QStringLiteral("content")).attributes().namedItem(QStringLiteral("rect")).nodeValue();
QString br_str = itemNode.namedItem(QStringLiteral("content")).attributes().namedItem(QStringLiteral("brushcolor")).nodeValue();
QString pen_str = itemNode.namedItem(QStringLiteral("content")).attributes().namedItem(QStringLiteral("pencolor")).nodeValue();
double penwidth = itemNode.namedItem(QStringLiteral("content")).attributes().namedItem(QStringLiteral("penwidth")).nodeValue().toDouble();
QDomNamedNodeMap rectProperties = itemNode.namedItem(QStringLiteral("content")).attributes();
QString rect = rectProperties.namedItem(QStringLiteral("rect")).nodeValue();
QString br_str = rectProperties.namedItem(QStringLiteral("brushcolor")).nodeValue();
QString pen_str = rectProperties.namedItem(QStringLiteral("pencolor")).nodeValue();
double penwidth = rectProperties.namedItem(QStringLiteral("penwidth")).nodeValue().toDouble();
MyRectItem *rec = new MyRectItem();
rec->setRect(stringToRect(rect));
rec->setPen(QPen(QBrush(stringToColor(pen_str)), penwidth, Qt::SolidLine, Qt::SquareCap, Qt::RoundJoin));
if (itemNode.namedItem(QStringLiteral("gradient")).isNull() == false) {
if (rectProperties.namedItem(QStringLiteral("gradient")).isNull() == false) {
// Gradient color
QString data = itemNode.namedItem(QStringLiteral("gradient")).nodeValue();
QString data = rectProperties.namedItem(QStringLiteral("gradient")).nodeValue();
rec->setData(TitleDocument::Gradient, data);
QLinearGradient gr = GradientWidget::gradientFromString(data, rec->rect().width(), rec->rect().height());
rec->setBrush(QBrush(gr));
......
......@@ -225,6 +225,7 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, const QString &pro
connect(buttonAlignRight, SIGNAL(clicked()), this, SLOT(slotUpdateText()));
connect(buttonAlignCenter, SIGNAL(clicked()), this, SLOT(slotUpdateText()));
connect(edit_gradient, SIGNAL(clicked()), this, SLOT(slotEditGradient()));
connect(edit_rect_gradient, SIGNAL(clicked()), this, SLOT(slotEditGradient()));
connect(displayBg, SIGNAL(stateChanged(int)), this, SLOT(displayBackgroundFrame()));
connect(m_unicodeDialog, SIGNAL(charSelected(QString)), this, SLOT(slotInsertUnicodeString(QString)));
......@@ -256,7 +257,8 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, const QString &pro
buttonAlignCenter->setIcon(KoIconUtils::themedIcon(QStringLiteral("format-justify-center")));
buttonAlignLeft->setIcon(KoIconUtils::themedIcon(QStringLiteral("format-justify-left")));
buttonAlignRight->setIcon(KoIconUtils::themedIcon(QStringLiteral("format-justify-right")));
edit_gradient->setIcon(KoIconUtils::themedIcon(QStringLiteral("configure")));
edit_gradient->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add")));
edit_rect_gradient->setIcon(KoIconUtils::themedIcon(QStringLiteral("list-add")));
buttonAlignRight->setToolTip(i18n("Align right"));
buttonAlignLeft->setToolTip(i18n("Align left"));
......@@ -2728,10 +2730,12 @@ void TitleWidget::slotEditGradient()
KConfigGroup group(config, "TitleGradients");
group.deleteGroup();
gradients_combo->clear();
gradients_rect_combo->clear();
int ix = 0;
while (i != gradients.constEnd()) {
group.writeEntry(i.key(), i.value());
gradients_combo->addItem(icons.at(ix), i.key(), i.value());
gradients_rect_combo->addItem(icons.at(ix), i.key(), i.value());
++i;
ix++;
}
......
......@@ -860,7 +860,7 @@
</widget>
</item>
<item row="1" column="2">
<widget class="QToolButton" name="edit_gradient_2">
<widget class="QToolButton" name="edit_rect_gradient">
<property name="text">
<string>...</string>
</property>
......@@ -888,6 +888,12 @@
</item>
<item row="2" column="1">
<widget class="KColorButton" name="rectFColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="color">
<color>
<red>0</red>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment