Commit 166eb5e1 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Title guide color configurable

parent 17b54bae
......@@ -993,5 +993,9 @@
<label>Number of vertical guides in titler.</label>
<default>3</default>
</entry>
<entry name="titleGuideColor" type="Color">
<label>color titler guides.</label>
<default>#ff0000</default>
</entry>
</group>
</kcfg>
......@@ -461,6 +461,8 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, const QString &pro
show_guides->setChecked(KdenliveSettings::titlerShowGuides());
hguides->setValue(KdenliveSettings::titlerHGuides());
vguides->setValue(KdenliveSettings::titlerVGuides());
guideColor->setColor(KdenliveSettings::titleGuideColor());
connect(guideColor, &KColorButton::changed, this, &TitleWidget::guideColorChanged);
connect(hguides, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &TitleWidget::updateGuides);
connect(vguides, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &TitleWidget::updateGuides);
updateGuides(0);
......@@ -2984,7 +2986,7 @@ const QString TitleWidget::titleSuggest()
void TitleWidget::showGuides(int state)
{
for(QGraphicsItem *it : m_guides) {
for(QGraphicsLineItem *it : m_guides) {
it->setVisible(state == Qt::Checked);
}
KdenliveSettings::setTitlerShowGuides(state == Qt::Checked);
......@@ -2997,7 +2999,8 @@ void TitleWidget::updateGuides(int)
qDeleteAll(m_guides);
m_guides.clear();
QPen framepen;
framepen.setColor(Qt::red);
QColor gColor(KdenliveSettings::titleGuideColor());
framepen.setColor(gColor);
// Guides
// Horizontal guides
......@@ -3018,7 +3021,8 @@ void TitleWidget::updateGuides(int)
m_guides << line1;
}
framepen.setColor(QColor(255, 0, 0, 160));
gColor.setAlpha(160);
framepen.setColor(gColor);
QGraphicsLineItem *line6 = new QGraphicsLineItem(0, 0, m_frameWidth, m_frameHeight, m_frameBorder);
line6->setPen(framepen);
......@@ -3032,3 +3036,15 @@ void TitleWidget::updateGuides(int)
line7->setData(-1, -1);
m_guides << line7;
}
void TitleWidget::guideColorChanged(const QColor &col)
{
KdenliveSettings::setTitleGuideColor(col);
QColor guideCol(col);
for(QGraphicsLineItem *it : m_guides) {
int alpha = it->pen().color().alpha();
guideCol.setAlpha(alpha);
QPen framePen(guideCol);
it->setPen(framePen);
}
}
......@@ -148,7 +148,7 @@ private:
QAction *m_selectImages;
QAction *m_unselectAll;
QString lastDocumentHash;
QList <QGraphicsItem*> m_guides;
QList <QGraphicsLineItem*> m_guides;
// See http://doc.trolltech.com/4.5/signalsandslots.html#advanced-signals-and-slots-usage.
QSignalMapper *m_signalMapper;
......@@ -343,6 +343,8 @@ private slots:
void showGuides(int state);
/** @brief Build guides */
void updateGuides(int);
/** @brief guide color changed, repaint */
void guideColorChanged(const QColor &col);
/** @brief Called when accepted, stores user selections for next time use.
* @ref writeChoices */
......
......@@ -337,6 +337,33 @@
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="9">
<widget class="KColorButton" name="guideColor">
<property name="enabled">
<bool>false</bool>
</property>
<property name="autoDefault">
<bool>true</bool>
</property>
<property name="flat">
<bool>false</bool>
</property>
<property name="color">
<color>
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
<property name="defaultColor">
<color>
<red>255</red>
<green>0</green>
<blue>0</blue>
</color>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="buttonUnselectAll">
<property name="enabled">
......@@ -354,7 +381,7 @@
</property>
</widget>
</item>
<item row="2" column="9">
<item row="2" column="10">
<spacer name="spacerBottomStack">
<property name="orientation">
<enum>Qt::Horizontal</enum>
......@@ -367,7 +394,7 @@
</property>
</spacer>
</item>
<item row="0" column="0" colspan="10">
<item row="0" column="0" colspan="11">
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
......@@ -424,32 +451,32 @@
</property>
</widget>
</item>
<item row="2" column="7">
<widget class="QSpinBox" name="vguides">
<item row="2" column="8">
<widget class="QSpinBox" name="hguides">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Vertical guides</string>
</property>
<property name="maximum">
<number>99</number>
<string>Horizontal guides</string>
</property>
<property name="value">
<number>3</number>
<number>2</number>
</property>
</widget>
</item>
<item row="2" column="8">
<widget class="QSpinBox" name="hguides">
<item row="2" column="7">
<widget class="QSpinBox" name="vguides">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Horizontal guides</string>
<string>Vertical guides</string>
</property>
<property name="maximum">
<number>99</number>
</property>
<property name="value">
<number>2</number>
<number>3</number>
</property>
</widget>
</item>
......@@ -1557,5 +1584,21 @@
</hint>
</hints>
</connection>
<connection>
<sender>show_guides</sender>
<signal>toggled(bool)</signal>
<receiver>guideColor</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>471</x>
<y>1211</y>
</hint>
<hint type="destinationlabel">
<x>726</x>
<y>1211</y>
</hint>
</hints>
</connection>
</connections>
</ui>
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