Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Double click on track led to set as audio/video target

parent cbeabfc7
......@@ -133,6 +133,24 @@ Rectangle {
width: height
radius: height
border.width: 1
MouseArea {
anchors.fill: parent
onDoubleClicked: {
if (trackHeadRoot.isAudio) {
if (trackHeadRoot.trackId == timeline.audioTarget) {
timeline.audioTarget = -1;
} else {
timeline.audioTarget = trackHeadRoot.trackId;
}
} else {
if (trackHeadRoot.trackId == timeline.videoTarget) {
timeline.videoTarget = -1;
} else {
timeline.videoTarget = trackHeadRoot.trackId;
}
}
}
}
state: 'normalled'
states: [
State {
......@@ -143,6 +161,14 @@ Rectangle {
color: 'red'
}
},
State {
name: 'target'
when: (trackHeadRoot.isAudio && trackHeadRoot.trackId == timeline.audioTarget) || (!trackHeadRoot.isAudio && trackHeadRoot.trackId == timeline.videoTarget)
PropertyChanges {
target: trackLed
color: 'yellow'
}
},
State {
name: 'mute'
when: trackHeadRoot.isMute || trackHeadRoot.isHidden
......
......@@ -53,6 +53,8 @@ TimelineController::TimelineController(KActionCollection *actionCollection, QObj
, m_actionCollection(actionCollection)
, m_position(0)
, m_seekPosition(-1)
, m_audioTarget(-1)
, m_videoTarget(-1)
, m_scale(3.0)
, m_usePreview(false)
, m_timelinePreview(nullptr)
......@@ -544,6 +546,18 @@ void TimelineController::setPosition(int position)
emit seeked(position);
}
void TimelineController::setAudioTarget(int track)
{
m_audioTarget = track;
emit audioTargetChanged();
}
void TimelineController::setVideoTarget(int track)
{
m_videoTarget = track;
emit videoTargetChanged();
}
void TimelineController::setSeekPosition(int position)
{
m_seekPosition = position;
......
......@@ -57,6 +57,8 @@ class TimelineController : public QObject
Q_PROPERTY(QVariantList dirtyChunks READ dirtyChunks NOTIFY dirtyChunksChanged)
Q_PROPERTY(QVariantList renderedChunks READ renderedChunks NOTIFY renderedChunksChanged)
Q_PROPERTY(int workingPreview READ workingPreview NOTIFY workingPreviewChanged)
Q_PROPERTY(int audioTarget READ audioTarget WRITE setAudioTarget NOTIFY audioTargetChanged)
Q_PROPERTY(int videoTarget READ videoTarget WRITE setVideoTarget NOTIFY videoTargetChanged)
public:
TimelineController(KActionCollection *actionCollection, QObject *parent);
......@@ -86,6 +88,8 @@ public:
/* @brief Returns the seek request position (-1 = no seek pending)
*/
Q_INVOKABLE int seekPosition() const { return m_seekPosition; }
Q_INVOKABLE int audioTarget() const { return m_audioTarget; }
Q_INVOKABLE int videoTarget() const { return m_videoTarget; }
/* @brief Request a seek operation
@param position is the desired new timeline position
*/
......@@ -312,6 +316,8 @@ public:
public slots:
void selectMultitrack();
Q_INVOKABLE void setSeekPosition(int position);
Q_INVOKABLE void setAudioTarget(int track);
Q_INVOKABLE void setVideoTarget(int track);
void onSeeked(int position);
void addEffectToCurrentClip(const QStringList &effectData);
/** @brief Dis / enable timeline preview. */
......@@ -331,6 +337,8 @@ private:
};
int m_position;
int m_seekPosition;
int m_audioTarget;
int m_videoTarget;
QPoint m_zone;
double m_scale;
static int m_duration;
......@@ -352,6 +360,8 @@ signals:
void durationChanged();
void positionChanged();
void seekPositionChanged();
void audioTargetChanged();
void videoTargetChanged();
void showThumbnailsChanged();
void showAudioThumbnailsChanged();
void showMarkersChanged();
......
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