Skip to content
GitLab
Menu
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
8e5c0861
Commit
8e5c0861
authored
Nov 17, 2021
by
Julius Künzel
Browse files
Make it possible to enable/disable track with a shortcut
The default shortcut is Shift+H
BUG: 440181
parent
ad714c87
Pipeline
#98602
passed with stage
in 8 minutes and 42 seconds
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/mainwindow.cpp
View file @
8e5c0861
...
...
@@ -1861,6 +1861,8 @@ void MainWindow::setupActions()
disableEffects
->
setCheckable
(
true
);
disableEffects
->
setChecked
(
false
);
addAction
(
QStringLiteral
(
"switch_track_disabled"
),
i18n
(
"Toggle Track Disabled"
),
pCore
->
projectManager
(),
SLOT
(
slotSwitchTrackDisabled
()),
QIcon
(),
Qt
::
SHIFT
+
Qt
::
Key_H
);
addAction
(
QStringLiteral
(
"switch_track_lock"
),
i18n
(
"Toggle Track Lock"
),
pCore
->
projectManager
(),
SLOT
(
slotSwitchTrackLock
()),
QIcon
(),
Qt
::
SHIFT
+
Qt
::
Key_L
);
addAction
(
QStringLiteral
(
"switch_all_track_lock"
),
i18n
(
"Toggle All Track Lock"
),
pCore
->
projectManager
(),
SLOT
(
slotSwitchAllTrackLock
()),
QIcon
(),
...
...
src/project/projectmanager.cpp
View file @
8e5c0861
...
...
@@ -834,6 +834,11 @@ void ProjectManager::slotDisableTimelineEffects(bool disable)
pCore
->
monitorManager
()
->
refreshProjectMonitor
();
}
void
ProjectManager
::
slotSwitchTrackDisabled
()
{
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
switchTrackDisabled
();
}
void
ProjectManager
::
slotSwitchTrackLock
()
{
pCore
->
window
()
->
getMainTimeline
()
->
controller
()
->
switchTrackLock
();
...
...
src/project/projectmanager.h
View file @
8e5c0861
...
...
@@ -142,6 +142,8 @@ public slots:
/** @brief Dis/enable all timeline effects */
void
slotDisableTimelineEffects
(
bool
disable
);
/** @brief Mute/Unmute or Hide/Show current timeline track */
void
slotSwitchTrackDisabled
();
/** @brief Un/Lock current timeline track */
void
slotSwitchTrackLock
();
void
slotSwitchAllTrackLock
();
...
...
src/timeline2/model/timelineitemmodel.cpp
View file @
8e5c0861
...
...
@@ -475,9 +475,11 @@ void TimelineItemModel::setTrackName(int trackId, const QString &text)
PUSH_UNDO
(
undo_lambda
,
redo_lambda
,
i18n
(
"Rename Track"
));
}
void
TimelineItemModel
::
hideTrack
(
int
trackId
,
const
QString
stat
e
)
void
TimelineItemModel
::
hideTrack
(
int
trackId
,
bool
hid
e
)
{
QWriteLocker
locker
(
&
m_lock
);
bool
isAudio
=
isAudioTrack
(
trackId
);
QString
state
=
hide
?
(
isAudio
?
"1"
:
"2"
)
:
"3"
;
QString
previousState
=
getTrackProperty
(
trackId
,
QStringLiteral
(
"hide"
)).
toString
();
Fun
undo_lambda
=
[
this
,
trackId
,
previousState
]()
{
setTrackProperty
(
trackId
,
QStringLiteral
(
"hide"
),
previousState
);
...
...
src/timeline2/model/timelineitemmodel.hpp
View file @
8e5c0861
...
...
@@ -72,7 +72,7 @@ public:
@param text is the new track name.
*/
Q_INVOKABLE
void
setTrackName
(
int
trackId
,
const
QString
&
text
);
Q_INVOKABLE
void
hideTrack
(
int
trackId
,
const
QString
stat
e
);
Q_INVOKABLE
void
hideTrack
(
int
trackId
,
bool
hid
e
);
/** @brief returns the lower video track index in timeline.
**/
int
getFirstVideoTrackIndex
()
const
;
...
...
src/timeline2/view/qml/TrackHead.qml
View file @
8e5c0861
...
...
@@ -428,7 +428,7 @@ Rectangle {
}
width
:
root
.
collapsedHeight
height
:
root
.
collapsedHeight
onClicked
:
controller
.
hideTrack
(
trackId
,
isDisabled
?
(
isAudio
?
'
1
'
:
'
2
'
)
:
'
3
'
)
onClicked
:
controller
.
hideTrack
(
trackId
,
isDisabled
)
ToolTip
{
visible
:
muteButton
.
hovered
font
:
miniFont
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
8e5c0861
...
...
@@ -3217,6 +3217,18 @@ void TimelineController::makeAllTrackActive()
m_activeSnaps
.
clear
();
}
void
TimelineController
::
switchTrackDisabled
()
{
if
(
m_activeTrack
==
-
2
)
{
// Subtitle track
switchSubtitleDisable
();
}
else
{
bool
isAudio
=
m_model
->
getTrackById_const
(
m_activeTrack
)
->
isAudioTrack
();
bool
enabled
=
isAudio
?
m_model
->
getTrackById_const
(
m_activeTrack
)
->
isMute
()
:
m_model
->
getTrackById_const
(
m_activeTrack
)
->
isHidden
();
m_model
->
hideTrack
(
m_activeTrack
,
enabled
);
}
}
void
TimelineController
::
switchTrackLock
(
bool
applyToAll
)
{
if
(
!
applyToAll
)
{
...
...
src/timeline2/view/timelinecontroller.h
View file @
8e5c0861
...
...
@@ -459,6 +459,7 @@ public:
void
switchAllTrackActive
();
/** @brief Make all tracks active or inactive */
void
makeAllTrackActive
();
void
switchTrackDisabled
();
void
switchTrackLock
(
bool
applyToAll
=
false
);
void
switchTargetTrack
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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