Commit 6da8a847 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Add config setting for default subtitle duration, add subtitle by double clicking in subtitle track

parent 93d2d41e
......@@ -85,6 +85,11 @@
<label>Default mix transition duration.</label>
<default>00:00:01:00</default>
</entry>
<entry name="subtitle_duration" type="String">
<label>Default subtitle duration.</label>
<default>00:00:05:00</default>
</entry>
<entry name="autoimagesequence" type="Bool">
<label>Automatically import image sequences.</label>
......
......@@ -874,6 +874,11 @@ Rectangle {
onExited: {
scim = false
}
onDoubleClicked: {
if (root.showSubtitles && root.activeTool === 0 && mouse.y > ruler.height && mouse.y < (ruler.height + subtitleTrack.height)) {
timeline.addSubtitle((scrollView.contentX + mouseX) / timeline.scaleFactor)
}
}
onPositionChanged: {
if (pressed && ((mouse.buttons === Qt.MidButton) || (mouse.buttons === Qt.LeftButton && root.activeTool == 0 && (mouse.modifiers & Qt.ControlModifier) && !shiftPress))) {
// Pan view
......
......@@ -3829,10 +3829,12 @@ void TimelineController::shiftSubtitle(int oldStartFrame, int newStartFrame, int
pCore->pushUndo(local_undo, local_redo, i18n("Move subtitle"));
}
void TimelineController::addSubtitle()
void TimelineController::addSubtitle(int startframe)
{
int startframe = pCore->getTimelinePosition();
int endframe = startframe + 50; //create basic subtitle clip of default width
if (startframe == -1) {
startframe = pCore->getTimelinePosition();
}
int endframe = startframe + pCore->getDurationFromString(KdenliveSettings::subtitle_duration());
auto subtitleModel = pCore->projectManager()->current()->getSubtitleModel();
Fun local_undo = [subtitleModel, startframe, endframe]() {
......
......@@ -579,7 +579,7 @@ public:
/** @brief Shift subtitle clips without changing the clip duration */
Q_INVOKABLE void shiftSubtitle(int oldStartFrame, int newStartFrame, int endFrame=0, QString text = QString());
/** @brief Add subtitle clip at cursor's position in timeline */
Q_INVOKABLE void addSubtitle();
Q_INVOKABLE void addSubtitle(int startframe = -1);
/** @brief Delete subtitle clip with frame as start position*/
Q_INVOKABLE void deleteSubtitle(int frameframe, int endframe, QString Ctext);
......
......@@ -124,6 +124,16 @@
<item row="3" column="1">
<widget class="QLineEdit" name="kcfg_mix_duration"/>
</item>
<item row="3" column="3">
<widget class="QLineEdit" name="kcfg_subtitle_duration"/>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Subtitles</string>
</property>
</widget>
</item>
</layout>
</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