Left/right arrow to seek timeline, add icons to track headers

parent ef6f23db
......@@ -1593,3 +1593,8 @@ void GLWidget::switchPlay(bool play, double speed)
m_producer->seek(m_consumer->position() + 1);
}
}
int GLWidget::getCurrentPos() const
{
return m_requestedSeekPosition == SEEK_INACTIVE ? m_consumer->position() : m_requestedSeekPosition;
}
......@@ -115,6 +115,8 @@ public:
void resetDrops();
void seek(int pos);
bool checkFrameNumber(int pos);
/** @brief Return current timeline position */
int getCurrentPos() const;
protected:
void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
......
......@@ -1225,14 +1225,14 @@ void Monitor::slotForward(double speed)
void Monitor::slotRewindOneFrame(int diff)
{
slotActivateMonitor();
render->seekToFrameDiff(-diff);
emit seekTimeline(m_glMonitor->getCurrentPos() - diff);
m_ruler->update();
}
void Monitor::slotForwardOneFrame(int diff)
{
slotActivateMonitor();
render->seekToFrameDiff(diff);
emit seekTimeline(m_glMonitor->getCurrentPos() + diff);
m_ruler->update();
}
......
......@@ -332,6 +332,8 @@ public slots:
signals:
void renderPosition(int);
void seekPosition(int);
/** @brief Request a timeline seeking if diff is true, position is a relative offset, otherwise an absolute position */
void seekTimeline(int position);
void durationChanged(int);
void refreshClipThumbnail(const QString &);
void zoneUpdated(const QPoint &);
......
......@@ -853,6 +853,7 @@ void ProjectManager::updateTimeline(Mlt::Tractor tractor) {
qDebug() << "CONSTRUCTING TIMELINEWIDGET";
m_timelineWidget = new TimelineWidget(pCore->window()->actionCollection(), pCore->binController(), m_project->commandStack(), pCore->window());
pCore->addTimeline(m_timelineWidget, m_project->url().fileName());
connect(pCore->monitorManager()->projectMonitor(), &Monitor::seekTimeline, m_timelineWidget, &TimelineWidget::seek, Qt::DirectConnection);
connect(m_timelineWidget, &TimelineWidget::seeked, pCore->monitorManager()->projectMonitor(), &Monitor::requestSeek, Qt::DirectConnection);
connect(pCore->monitorManager()->projectMonitor(), &Monitor::seekPosition, m_timelineWidget, &TimelineWidget::onSeeked, Qt::DirectConnection);
connect(m_timelineWidget, &TimelineWidget::focusProjectMonitor, pCore->monitorManager(), &MonitorManager::focusProjectMonitor);
......
......@@ -260,7 +260,7 @@ QVariant TimelineItemModel::data(const QModelIndex &index, int role) const
case HeightRole: {
int height = getTrackById_const(id)->getProperty("kdenlive:trackheight").toInt();
// qDebug() << "DATA yielding height" << height;
return (height > 0 ? height : 50);
return (height > 0 ? height : 60);
}
case IsCompositeRole: {
return Qt::Unchecked;
......
......@@ -216,7 +216,7 @@ Rectangle {
id: label
text: clipName
visible: !isBlank && !isTransition
font.pointSize: 8
font.pixelSize: root.baseUnit
anchors {
top: parent.top
left: parent.left
......
......@@ -23,13 +23,13 @@ Rectangle {
property int stepSize: 34
property int index: 0
property real timeScale: timeline.scaleFactor
property int fontUnit: root.baseUnit * 0.6
property int fontUnit: root.baseUnit
SystemPalette { id: activePalette }
id: rulerTop
enabled: false
height: root.baseUnit * 2
height: root.baseUnit * 2.5
color: activePalette.base
Repeater {
......@@ -51,7 +51,7 @@ Rectangle {
opacity: 0.8
x: index * stepSize * 4 + 2
text: timeline.timecode(index * stepSize * 4 / timeScale)
font.pointSize: fontUnit
font.pixelSize: fontUnit
}
}
}
......
......@@ -18,7 +18,7 @@
import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.0
import QtQuick.Controls.Styles 1.2
import QtQuick.Layouts 1.3
//import Shotcut.Controls 1.0 as Shotcut
......@@ -91,12 +91,12 @@ Rectangle {
}
ColumnLayout {
id: trackHeadColumn
spacing: 2
spacing: 0
anchors {
top: parent.top
left: parent.left
bottom: parent.bottom
margins: 0
margins: 2
}
Rectangle {
......@@ -120,6 +120,7 @@ Rectangle {
text: trackName
color: activePalette.windowText
elide: Qt.ElideRight
font.pixelSize: root.baseUnit * 1.5
x: 4
y: 3
width: parent.width - 8
......@@ -129,6 +130,9 @@ Rectangle {
visible: false
width: trackHeadRoot.width - trackHeadColumn.anchors.margins * 2
text: trackName
style: TextFieldStyle {
font.pixelSize: root.baseUnit * 1.5
}
onAccepted: {
timeline.setTrackName(index, text)
visible = false
......@@ -137,121 +141,37 @@ Rectangle {
}
}
RowLayout {
spacing: 0
visible: (trackHeadRoot.height > trackLabel.height + muteButton.height + resizer.height + 8)
CheckBox {
spacing: 6
visible: (trackHeadRoot.height > trackLabel.height + muteButton.height + resizer.height + 4)
ToolButton {
id: muteButton
checked: isMute
style: CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 2
color: isMute? activePalette.highlight : trackHeadRoot.color
border.color: activePalette.shadow
border.width: 1
Text {
id: muteText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: qsTr('M', 'Mute')
color: isMute? activePalette.highlightedText : activePalette.windowText
}
}
}
implicitWidth: 20
implicitHeight: 20
iconName: isMute ? 'kdenlive-hide-audio' : 'kdenlive-show-audio'
iconSource: isMute ? 'qrc:///pics/kdenlive-hide-audio.svg' : 'qrc:///pics/kdenlive-show-audio.svg'
onClicked: timeline.toggleTrackMute(index)
//Shotcut.ToolTip { text: qsTr('Mute') }
tooltip: isMute? qsTr('Unmute') : qsTr('Mute')
}
CheckBox {
ToolButton {
id: hideButton
checked: isHidden
visible: isVideo
style: CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 2
color: isHidden? activePalette.highlight : trackHeadRoot.color
border.color: activePalette.shadow
border.width: 1
Text {
id: hideText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: qsTr('H', 'Hide')
color: isHidden? activePalette.highlightedText : activePalette.windowText
}
}
}
implicitWidth: 20
implicitHeight: 20
iconName: isHidden ? 'kdenlive-hide-video' : 'kdenlive-show-video'
iconSource: isHidden? 'qrc:///pics/kdenlive-hide-video.svg' : 'qrc:///pics/kdenlive-show-video.svg'
onClicked: timeline.toggleTrackHidden(index)
//Shotcut.ToolTip { text: qsTr('Hide') }
}
CheckBox {
id: compositeButton
visible: isVideo
checked: isComposite
style: CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 2
color: isComposite? activePalette.highlight : trackHeadRoot.color
border.color: activePalette.shadow
border.width: 1
Text {
id: compositeText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: qsTr('C', 'Composite')
color: isComposite? activePalette.highlightedText : activePalette.windowText
}
}
}
onClicked: timeline.setTrackComposite(index, checkedState)
//Shotcut.ToolTip { text: qsTr('Composite') }
tooltip: isHidden? qsTr('Show') : qsTr('Hide')
}
CheckBox {
ToolButton {
id: lockButton
checked: isLocked
style: CheckBoxStyle {
indicator: Rectangle {
implicitWidth: 16
implicitHeight: 16
radius: 2
color: isLocked ? activePalette.highlight : trackHeadRoot.color
border.color: activePalette.shadow
border.width: 1
Text {
id: lockText
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
text: qsTr('L', 'Lock')
color: isLocked ? activePalette.highlightedText : activePalette.windowText
}
}
}
SequentialAnimation {
id: lockButtonAnim
loops: 2
NumberAnimation {
target: lockButton
property: "scale"
to: 1.8
duration: 200
}
NumberAnimation {
target: lockButton
property: "scale"
to: 1
duration: 200
}
}
implicitWidth: 20
implicitHeight: 20
iconName: isLocked ? 'kdenlive-lock' : 'kdenlive-unlock'
iconSource: isLocked ? 'qrc:///pics/kdenlive-lock.svg' : 'qrc:///pics/kdenlive-unlock.svg'
onClicked: timeline.setTrackLock(index, !isLocked)
//Shotcut.ToolTip { text: qsTr('Lock track') }
tooltip: isLocked? qsTr('Unlock track') : qsTr('Lock track')
}
}
Rectangle {
......
......@@ -32,7 +32,7 @@ Rectangle {
}
property int headerWidth: 140
property int baseUnit: fontMetrics.height * 0.8
property int baseUnit: fontMetrics.height * 0.6
property int currentTrack: 0
property color selectedTrackColor: activePalette.highlight //.rgba(0.8, 0.8, 0, 0.3);
property alias trackCount: tracksRepeater.count
......@@ -303,7 +303,7 @@ Rectangle {
TimelinePlayhead {
id: playhead
visible: timeline.position > -1
height: baseUnit * 0.8
height: baseUnit
width: baseUnit
y: ruler.height - height
x: timeline.position * timeline.scaleFactor - scrollView.flickableItem.contentX - (width / 2)
......@@ -329,13 +329,13 @@ Rectangle {
Rectangle {
id: bubbleHelp
property alias text: bubbleHelpLabel.text
//color: application.toolTipBaseColor
color: activePalette.window //application.toolTipBaseColor
width: bubbleHelpLabel.width + 8
height: bubbleHelpLabel.height + 8
radius: 4
states: [
State { name: 'invisible'; PropertyChanges { target: bubbleHelp; opacity: 0} },
State { name: 'visible'; PropertyChanges { target: bubbleHelp; opacity: 1} }
State { name: 'visible'; PropertyChanges { target: bubbleHelp; opacity: 0.8} }
]
state: 'invisible'
transitions: [
......@@ -352,8 +352,9 @@ Rectangle {
]
Label {
id: bubbleHelpLabel
//color: application.toolTipTextColor
color: activePalette.text //application.toolTipTextColor
anchors.centerIn: parent
font.pixelSize: root.baseUnit
}
function show(x, y, text) {
bubbleHelp.x = x + tracksArea.x - scrollView.flickableItem.contentX - bubbleHelpLabel.width
......@@ -367,7 +368,7 @@ Rectangle {
bubbleHelp.opacity = 0
}
}
DropShadow {
/*DropShadow {
source: bubbleHelp
anchors.fill: bubbleHelp
opacity: bubbleHelp.opacity
......@@ -377,7 +378,7 @@ Rectangle {
color: '#80000000'
transparentBorder: true
fast: true
}
}*/
DelegateModel {
id: trackDelegateModel
......
......@@ -239,7 +239,13 @@ void TimelineWidget::triggerAction(const QString &name)
QString TimelineWidget::timecode(int frames)
{
return m_model->tractor()->frames_to_time(frames, mlt_time_smpte_df);
return KdenliveSettings::frametimecode() ? QString::number(frames) : m_model->tractor()->frames_to_time(frames, mlt_time_smpte_df);
}
void TimelineWidget::seek(int position)
{
rootObject()->setProperty("seekPos", position);
emit seeked(position);
}
void TimelineWidget::setPosition(int position)
......@@ -323,11 +329,11 @@ int TimelineWidget::requestBestSnapPos(int pos, int duration)
void TimelineWidget::gotoNextSnap()
{
setPosition(m_model->requestNextSnapPos(m_position));
seek(m_model->requestNextSnapPos(m_position));
}
void TimelineWidget::gotoPreviousSnap()
{
setPosition(m_model->requestPreviousSnapPos(m_position));
seek(m_model->requestPreviousSnapPos(m_position));
}
......@@ -168,6 +168,7 @@ public slots:
void selectMultitrack();
void onSeeked(int position);
void slotChangeZoom(int value, bool zoomOnMouse);
void seek(int position);
private:
std::shared_ptr<TimelineItemModel> m_model;
......
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