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

Remove seek checkboxes in timeremap, add button to center keyframe at cursor position

parent ec313d5d
......@@ -537,6 +537,21 @@ int RemapView::position() const
return m_position;
}
void RemapView::centerCurrentKeyframe()
{
if (m_currentKeyframe.first == -1) {
// No keyframe selected, abort
return;
}
m_currentKeyframe.second = m_position + m_inFrame;
m_keyframes.insert(m_currentKeyframe.first, m_currentKeyframe.second);
std::pair<double,double> speeds = getSpeed(m_currentKeyframe);
emit selectedKf(m_currentKeyframe, speeds);
emit atKeyframe(true);
updateKeyframes(true);
update();
}
int RemapView::getClosestKeyframe(int pos, bool bottomKeyframe) const
{
int deltaMin = -1;
......@@ -1207,9 +1222,11 @@ TimeRemap::TimeRemap(QWidget *parent)
connect(m_in, &TimecodeDisplay::timeCodeUpdated, [this]() {
m_view->updateInPos(m_in->getValue() + m_view->m_inFrame);
});
button_center->setToolTip(i18n("Move selected keyframe to cursor"));
connect(m_out, &TimecodeDisplay::timeCodeUpdated, [this]() {
m_view->updateOutPos(m_out->getValue() + m_view->m_inFrame);
});
connect(button_center, &QToolButton::clicked, m_view, &RemapView::centerCurrentKeyframe);
connect(m_view, &RemapView::atKeyframe, button_add, [&](bool atKeyframe) {
button_add->setIcon(atKeyframe ? QIcon::fromTheme(QStringLiteral("list-remove")) : QIcon::fromTheme(QStringLiteral("list-add")));
});
......@@ -1340,7 +1357,7 @@ void TimeRemap::selectedClip(int cid)
connect(pCore->getMonitor(Kdenlive::ClipMonitor), &Monitor::seekPosition, pCore->getMonitor(Kdenlive::ClipMonitor), &Monitor::seekRemap, Qt::UniqueConnection);
}
m_seekConnection1 = connect(m_view, &RemapView::seekToPos, [this](int topPos, int bottomPos) {
if (topPos > -1 && source_seek->isChecked()) {
if (topPos > -1) {
if (pCore->getMonitor(Kdenlive::ClipMonitor)->activeClipId() != m_binId) {
int min = pCore->getItemIn({ObjectType::TimelineClip,m_cid});
int lastLength = pCore->getItemDuration({ObjectType::TimelineClip,m_cid});
......@@ -1349,7 +1366,7 @@ void TimeRemap::selectedClip(int cid)
}
pCore->getMonitor(Kdenlive::ClipMonitor)->requestSeek(topPos);
}
if (bottomPos > -1 && output_seek->isChecked()) {
if (bottomPos > -1) {
pCore->getMonitor(Kdenlive::ProjectMonitor)->requestSeek(bottomPos + m_view->m_startPos);
}
});
......
......@@ -82,6 +82,7 @@ public slots:
void updateAfterSpeed(double speed);
void toggleMoveNext(bool moveNext);
void reloadProducer();
void centerCurrentKeyframe();
private:
enum MOVEMODE {NoMove, TopMove, BottomMove, CursorMove, CursorMoveBottom};
......
......@@ -6,121 +6,107 @@
<rect>
<x>0</x>
<y>0</y>
<width>288</width>
<height>256</height>
<width>291</width>
<height>242</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>0</number>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="verticalSpacing">
<number>2</number>
<number>0</number>
</property>
<item row="6" column="0">
<widget class="QCheckBox" name="pitch_compensate">
<property name="text">
<string>Pitch compensation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="7" column="4">
<widget class="QToolButton" name="button_del">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="edit-delete">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
<item row="2" column="2" colspan="3">
<widget class="QCheckBox" name="output_seek">
<property name="text">
<string>Seek monitor</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2" colspan="3">
<widget class="QCheckBox" name="source_seek">
<property name="text">
<string>Seek monitor</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="3" colspan="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>28</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QToolButton" name="button_prev">
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-previous">
<normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
<string>Source clip</string>
</property>
</widget>
</item>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>39</height>
</size>
</property>
</spacer>
<item row="1" column="0" colspan="3">
<layout class="QVBoxLayout" name="remapLayout"/>
</item>
<item row="2" column="0" colspan="2">
<item row="2" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Output</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="5">
<item row="3" column="0" colspan="3">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QToolButton" name="button_prev">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-previous">
<normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_next">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-next">
<normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_add">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="list-add">
<normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="button_center">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="align-horizontal-center"/>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>28</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="4" column="0" colspan="3">
<widget class="QFrame" name="info_frame">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
......@@ -211,58 +197,57 @@
</layout>
</widget>
</item>
<item row="1" column="0" colspan="5">
<layout class="QVBoxLayout" name="remapLayout"/>
<item row="5" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>39</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<item row="6" column="0">
<widget class="QCheckBox" name="pitch_compensate">
<property name="text">
<string>Source clip</string>
<string>Pitch compensation</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="tristate">
<bool>false</bool>
</property>
</widget>
</item>
<item row="6" column="1" colspan="4">
<item row="6" column="1" colspan="2">
<widget class="QCheckBox" name="frame_blending">
<property name="text">
<string>Frame blending</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QToolButton" name="button_next">
<item row="7" column="0" colspan="2">
<widget class="QCheckBox" name="move_next">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="go-next">
<normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
<string>Preserve speed of next keyframes</string>
</property>
<property name="autoRaise">
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QToolButton" name="button_add">
<item row="7" column="2">
<widget class="QToolButton" name="button_del">
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset theme="list-add">
<normaloff>../../../../.designer/backup</normaloff>../../../../.designer/backup</iconset>
</property>
<property name="autoRaise">
<bool>true</bool>
</property>
</widget>
</item>
<item row="7" column="0" colspan="4">
<widget class="QCheckBox" name="move_next">
<property name="text">
<string>Preserve speed of next keyframes</string>
</property>
<property name="checked">
<bool>true</bool>
<iconset theme="edit-delete">
<normaloff>.</normaloff>.</iconset>
</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