Commit 56f8e039 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Add guides in titler

parent b4fb1a82
......@@ -981,5 +981,9 @@
<label>Name of last selected title template</label>
<default></default>
</entry>
<entry name="titlerShowGuides" type="Bool">
<label>Show guides in titler.</label>
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -456,6 +456,50 @@ TitleWidget::TitleWidget(const QUrl &url, const Timecode &tc, const QString &pro
m_frameBorder->setData(-1, -1);
graphicsView->scene()->addItem(m_frameBorder);
QGraphicsLineItem *line1 = new QGraphicsLineItem(0, m_frameHeight / 3, m_frameWidth, m_frameHeight / 3, m_frameBorder);
line1->setPen(framepen);
line1->setFlags(nullptr);
line1->setData(-1, -1);
m_guides << line1;
QGraphicsLineItem *line2 = new QGraphicsLineItem(0, 2 *m_frameHeight / 3, m_frameWidth, 2 * m_frameHeight / 3, m_frameBorder);
line2->setPen(framepen);
line2->setFlags(nullptr);
line2->setData(-1, -1);
m_guides << line2;
QGraphicsLineItem *line3 = new QGraphicsLineItem(m_frameWidth / 4, 0, m_frameWidth / 4, m_frameHeight, m_frameBorder);
line3->setPen(framepen);
line3->setFlags(nullptr);
line3->setData(-1, -1);
m_guides << line3;
QGraphicsLineItem *line4 = new QGraphicsLineItem(m_frameWidth / 2, 0, m_frameWidth / 2, m_frameHeight, m_frameBorder);
line4->setPen(framepen);
line4->setFlags(nullptr);
line4->setData(-1, -1);
m_guides << line4;
QGraphicsLineItem *line5 = new QGraphicsLineItem(3 * m_frameWidth / 4, 0, 3 * m_frameWidth / 4, m_frameHeight, m_frameBorder);
line5->setPen(framepen);
line5->setFlags(nullptr);
line5->setData(-1, -1);
m_guides << line5;
framepen.setColor(QColor(255, 0, 0, 160));
QGraphicsLineItem *line6 = new QGraphicsLineItem(0, 0, m_frameWidth, m_frameHeight, m_frameBorder);
line6->setPen(framepen);
line6->setFlags(nullptr);
line6->setData(-1, -1);
m_guides << line6;
QGraphicsLineItem *line7 = new QGraphicsLineItem(m_frameWidth, 0, 0, m_frameHeight, m_frameBorder);
line7->setPen(framepen);
line7->setFlags(nullptr);
line7->setData(-1, -1);
m_guides << line7;
connect(show_guides, &QCheckBox::stateChanged, this, &TitleWidget::showGuides);
show_guides->setChecked(KdenliveSettings::titlerShowGuides());
showGuides(show_guides->checkState());
// semi transparent safe zones
framepen.setColor(QColor(255, 0, 0, 100));
QGraphicsRectItem *safe1 = new QGraphicsRectItem(QRectF(m_frameWidth * 0.05, m_frameHeight * 0.05, m_frameWidth * 0.9, m_frameHeight * 0.9), m_frameBorder);
......@@ -2971,3 +3015,11 @@ const QString TitleWidget::titleSuggest()
}
return title;
}
void TitleWidget::showGuides(int state)
{
for(QGraphicsItem *it : m_guides) {
it->setVisible(state == Qt::Checked);
}
KdenliveSettings::setTitlerShowGuides(state == Qt::Checked);
}
......@@ -148,6 +148,7 @@ private:
QAction *m_selectImages;
QAction *m_unselectAll;
QString lastDocumentHash;
QList <QGraphicsItem*> m_guides;
// See http://doc.trolltech.com/4.5/signalsandslots.html#advanced-signals-and-slots-usage.
QSignalMapper *m_signalMapper;
......@@ -338,6 +339,8 @@ private slots:
void slotResize50();
void slotResize100();
void slotResize200();
/** @brief Show hide guides */
void showGuides(int state);
/** @brief Called when accepted, stores user selections for next time use.
* @ref writeChoices */
......
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>1048</width>
<height>1174</height>
<width>1418</width>
<height>1306</height>
</rect>
</property>
<property name="windowTitle">
......@@ -337,37 +337,37 @@
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="3">
<widget class="QToolButton" name="buttonSelectAll">
<property name="whatsThis">
<string>Selects all items on the canvas.</string>
<item row="2" column="2">
<widget class="QToolButton" name="buttonUnselectAll">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string>A</string>
<string>N</string>
</property>
</widget>
</item>
<item row="2" column="4">
<widget class="QToolButton" name="buttonSelectRects">
<property name="enabled">
<bool>false</bool>
</property>
<item row="2" column="5">
<widget class="QCheckBox" name="use_grid">
<property name="text">
<string>R</string>
<string>Use grid</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QToolButton" name="buttonUnselectAll">
<property name="enabled">
<bool>false</bool>
<item row="2" column="7">
<spacer name="spacerBottomStack">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="text">
<string>N</string>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</widget>
</spacer>
</item>
<item row="0" column="0" colspan="7">
<item row="0" column="0" colspan="8">
<widget class="QGraphicsView" name="graphicsView">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
......@@ -377,6 +377,16 @@
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QToolButton" name="buttonSelectAll">
<property name="whatsThis">
<string>Selects all items on the canvas.</string>
</property>
<property name="text">
<string>A</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QToolButton" name="buttonSelectImages">
<property name="enabled">
......@@ -397,23 +407,20 @@
</property>
</widget>
</item>
<item row="2" column="6">
<spacer name="spacerBottomStack">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="2" column="4">
<widget class="QToolButton" name="buttonSelectRects">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>R</string>
</property>
</spacer>
</widget>
</item>
<item row="2" column="5">
<widget class="QCheckBox" name="use_grid">
<item row="2" column="6">
<widget class="QCheckBox" name="show_guides">
<property name="text">
<string>Use grid</string>
<string>Show guides</string>
</property>
</widget>
</item>
......
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