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