Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Multimedia
Kdenlive
Commits
d22ddf45
Commit
d22ddf45
authored
Mar 24, 2020
by
Jean-Baptiste Mardelle
Browse files
Fix multitrack view track order, make whole screen clickable, highlight active track
parent
05f27c5f
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/monitor/monitor.cpp
View file @
d22ddf45
...
...
@@ -2238,3 +2238,11 @@ MonitorProxy *Monitor::getControllerProxy()
{
return
m_glMonitor
->
getControllerProxy
();
}
void
Monitor
::
updateMultiTrackView
(
int
tid
)
{
QQuickItem
*
root
=
m_glMonitor
->
rootObject
();
if
(
root
)
{
root
->
setProperty
(
"activeTrack"
,
tid
);
}
}
src/monitor/monitor.h
View file @
d22ddf45
...
...
@@ -153,6 +153,8 @@ public:
void
resetPlayOrLoopZone
(
const
QString
&
binId
);
/** @brief Returns a pointer to monitor proxy, allowing to manage seek and consumer position */
MonitorProxy
*
getControllerProxy
();
/** @brief Update active track in multitrack view */
void
updateMultiTrackView
(
int
tid
);
protected:
void
mousePressEvent
(
QMouseEvent
*
event
)
override
;
...
...
src/monitor/view/kdenlivemonitorsplittracks.qml
View file @
d22ddf45
...
...
@@ -21,6 +21,7 @@ Item {
property
double
sourcedar
:
1
property
double
offsetx
:
0
property
double
offsety
:
0
property
int
activeTrack
:
0
onSourcedarChanged
:
refreshdar
()
property
bool
iskeyframe
property
int
requestedKeyFrame
...
...
@@ -66,41 +67,39 @@ Item {
}
}
Rectangle
{
Item
{
id
:
frame
objectName
:
"
referenceframe
"
property
color
hoverColor
:
"
#ff0000
"
width
:
root
.
profile
.
x
*
root
.
scalex
height
:
root
.
profile
.
y
*
root
.
scaley
x
:
root
.
center
.
x
-
width
/
2
-
root
.
offsetx
y
:
root
.
center
.
y
-
height
/
2
-
root
.
offsety
color
:
"
transparent
"
border.color
:
"
#ffffff00
"
Repeater
{
id
:
trackSeparators
model
:
tracks
property
int
rows
:
trackSeparators
.
count
<
5
?
2
:
3
property
int
columns
:
trackSeparators
.
count
<
3
?
1
:
trackSeparators
.
count
<
5
?
2
:
3
property
int
columns
:
trackSeparators
.
count
<
3
?
1
:
trackSeparators
.
count
<
7
?
2
:
3
Rectangle
{
width
:
parent
.
width
/
trackSeparators
.
rows
height
:
parent
.
height
/
trackSeparators
.
columns
x
:
width
*
(
index
%
trackSeparators
.
rows
)
y
:
height
*
(
Math
.
floor
(
index
/
trackSeparators
.
rows
))
color
:
"
transparent
"
border.color
:
root
.
overlayColor
border.color
:
index
==
root
.
activeTrack
?
"
#ff0000
"
:
"
#00000000
"
border.width
:
2
Label
{
text
:
modelData
color
:
"
#ffffff
"
padding
:
4
background
:
Rectangle
{
color
:
"
#66660000
"
}
MouseArea
{
anchors.fill
:
parent
cursorShape
:
Qt
.
PointingHandCursor
onClicked
:
root
.
activateTrack
(
index
);
color
:
index
==
root
.
activeTrack
?
"
#990000
"
:
"
#000066
"
}
}
MouseArea
{
anchors.fill
:
parent
cursorShape
:
Qt
.
PointingHandCursor
onClicked
:
root
.
activateTrack
(
index
);
}
}
}
}
...
...
src/timeline2/model/timelinefunctions.cpp
View file @
d22ddf45
...
...
@@ -810,13 +810,14 @@ void TimelineFunctions::setCompositionATrack(const std::shared_ptr<TimelineItemM
QStringList
TimelineFunctions
::
enableMultitrackView
(
const
std
::
shared_ptr
<
TimelineItemModel
>
&
timeline
,
bool
enable
,
bool
refresh
)
{
QList
<
int
>
videoTracks
;
QStringList
trackNames
;
for
(
const
auto
&
track
:
timeline
->
m_iteratorTable
)
{
if
(
timeline
->
getTrackById_const
(
track
.
first
)
->
isAudioTrack
()
||
timeline
->
getTrackById_const
(
track
.
first
)
->
isHidden
())
{
std
::
vector
<
int
>
videoTracks
;
for
(
int
i
=
0
;
i
<
(
int
)
timeline
->
m_allTracks
.
size
();
i
++
)
{
int
tid
=
timeline
->
getTrackIndexFromPosition
(
i
);
if
(
timeline
->
getTrackById_const
(
tid
)
->
isAudioTrack
()
||
timeline
->
getTrackById_const
(
tid
)
->
isHidden
())
{
continue
;
}
videoTracks
<<
track
.
first
;
videoTracks
.
push_back
(
tid
)
;
}
if
(
videoTracks
.
size
()
<
2
)
{
pCore
->
displayMessage
(
i18n
(
"Cannot enable multitrack view on a single track"
),
InformationMessage
);
...
...
@@ -840,18 +841,20 @@ QStringList TimelineFunctions::enableMultitrackView(const std::shared_ptr<Timeli
service
.
reset
(
service
->
producer
());
}
if
(
enable
)
{
for
(
int
i
=
0
;
i
<
videoTracks
.
size
();
++
i
)
{
int
count
=
0
;
for
(
int
tid
:
videoTracks
)
{
int
b_track
=
timeline
->
getTrackMltIndex
(
tid
);
Mlt
::
Transition
transition
(
*
timeline
->
m_tractor
->
profile
(),
"composite"
);
transition
.
set
(
"mlt_service"
,
"composite"
);
transition
.
set
(
"a_track"
,
0
);
transition
.
set
(
"b_track"
,
timeline
->
getTrackMltIndex
(
videoTracks
.
at
(
i
))
);
transition
.
set
(
"b_track"
,
b_track
);
transition
.
set
(
"distort"
,
0
);
transition
.
set
(
"aligned"
,
0
);
// 200 is an arbitrary number so we can easily remove these transition later
transition
.
set
(
"internal_added"
,
200
);
QString
geometry
;
trackNames
<<
timeline
->
getTrackFullName
(
videoTracks
.
at
(
i
)
);
switch
(
i
)
{
trackNames
<<
timeline
->
getTrackFullName
(
tid
);
switch
(
count
)
{
case
0
:
switch
(
videoTracks
.
size
())
{
case
2
:
...
...
@@ -948,10 +951,11 @@ QStringList TimelineFunctions::enableMultitrackView(const std::shared_ptr<Timeli
geometry
=
QStringLiteral
(
"66% 66% 33% 33%"
);
break
;
}
count
++
;
// Add transition to track:
transition
.
set
(
"geometry"
,
geometry
.
toUtf8
().
constData
());
transition
.
set
(
"always_active"
,
1
);
field
->
plant_transition
(
transition
,
0
,
timeline
->
getTrackMltIndex
(
videoTracks
.
at
(
i
))
);
field
->
plant_transition
(
transition
,
0
,
b_track
);
}
}
field
->
unlock
();
...
...
src/timeline2/view/qml/timeline.qml
View file @
d22ddf45
...
...
@@ -74,7 +74,6 @@ Rectangle {
}
else
if
(
newTrack
>=
max
)
{
newTrack
=
0
;
}
console
.
log
(
'
Setting curr tk:
'
,
newTrack
,
'
MAX:
'
,
max
)
timeline
.
activeTrack
=
tracksRepeater
.
itemAt
(
newTrack
).
trackInternalId
}
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
d22ddf45
...
...
@@ -2874,20 +2874,42 @@ void TimelineController::slotMultitrackView(bool enable, bool refresh)
{
QStringList
trackNames
=
TimelineFunctions
::
enableMultitrackView
(
m_model
,
enable
,
refresh
);
pCore
->
monitorManager
()
->
projectMonitor
()
->
slotShowEffectScene
(
enable
?
MonitorSplitTrack
:
MonitorSceneNone
,
false
,
QVariant
(
trackNames
));
QObject
::
disconnect
(
m_connection
);
if
(
enable
)
{
m_connection
=
connect
(
this
,
&
TimelineController
::
activeTrackChanged
,
[
this
]()
{
int
ix
=
0
;
auto
it
=
m_model
->
m_allTracks
.
cbegin
();
while
(
it
!=
m_model
->
m_allTracks
.
cend
())
{
int
target_track
=
(
*
it
)
->
getId
();
++
it
;
if
(
target_track
==
m_activeTrack
)
{
break
;
}
if
(
m_model
->
getTrackById_const
(
target_track
)
->
isAudioTrack
()
||
m_model
->
getTrackById_const
(
target_track
)
->
isHidden
())
{
continue
;
}
++
ix
;
}
pCore
->
monitorManager
()
->
projectMonitor
()
->
updateMultiTrackView
(
ix
);
});
}
}
void
TimelineController
::
activateTrackAndSelect
(
int
trackPosition
)
{
int
tid
=
-
1
;
for
(
const
auto
&
track
:
m_model
->
m_iteratorTable
)
{
if
(
m_model
->
getTrackById_const
(
track
.
first
)
->
isAudioTrack
()
||
m_model
->
getTrackById_const
(
track
.
first
)
->
isHidden
())
{
int
ix
=
0
;
auto
it
=
m_model
->
m_allTracks
.
cbegin
();
while
(
it
!=
m_model
->
m_allTracks
.
cend
())
{
tid
=
(
*
it
)
->
getId
();
++
it
;
if
(
m_model
->
getTrackById_const
(
tid
)
->
isAudioTrack
()
||
m_model
->
getTrackById_const
(
tid
)
->
isHidden
())
{
continue
;
}
if
(
trackPosition
==
0
)
{
tid
=
track
.
first
;
if
(
trackPosition
==
ix
)
{
break
;
}
trackPosition
--
;
++
ix
;
}
if
(
tid
>
-
1
)
{
m_activeTrack
=
tid
;
...
...
src/timeline2/view/timelinecontroller.h
View file @
d22ddf45
...
...
@@ -587,6 +587,7 @@ private:
bool
m_ready
;
std
::
vector
<
size_t
>
m_activeSnaps
;
int
m_snapStackIndex
;
QMetaObject
::
Connection
m_connection
;
void
initializePreview
();
bool
darkBackground
()
const
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment