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
4ce7f1a9
Commit
4ce7f1a9
authored
Mar 18, 2020
by
Jean-Baptiste Mardelle
Browse files
Only show relevant effects in timeline clip context menu
parent
d61e7579
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/effects/effectsrepository.cpp
View file @
4ce7f1a9
...
...
@@ -398,3 +398,12 @@ void EffectsRepository::deleteEffect(const QString &id)
m_assets
.
erase
(
id
);
}
}
bool
EffectsRepository
::
isAudioEffect
(
const
QString
&
assetId
)
const
{
if
(
m_assets
.
count
(
assetId
)
>
0
)
{
AssetListType
::
AssetType
type
=
m_assets
.
at
(
assetId
).
type
;
return
type
==
AssetListType
::
AssetType
::
Audio
||
type
==
AssetListType
::
AssetType
::
CustomAudio
;
}
return
false
;
}
src/effects/effectsrepository.hpp
View file @
4ce7f1a9
...
...
@@ -55,6 +55,7 @@ public:
/** @brief Returns true if this is an effect group */
bool
isGroup
(
const
QString
&
assetId
)
const
;
void
deleteEffect
(
const
QString
&
id
);
bool
isAudioEffect
(
const
QString
&
assetId
)
const
;
protected:
// Constructor is protected because class is a Singleton
...
...
src/timeline2/view/qml/Clip.qml
View file @
4ce7f1a9
...
...
@@ -258,7 +258,7 @@ Rectangle {
controller
.
requestAddToSelection
(
clipRoot
.
clipId
,
true
)
}
root
.
mainFrame
=
Math
.
round
(
mouse
.
x
/
timeline
.
scaleFactor
)
root
.
showClipMenu
()
root
.
showClipMenu
(
clipRoot
.
clipId
)
}
}
Keys.onShortcutOverride
:
event
.
accepted
=
clipRoot
.
isGrabbed
&&
(
event
.
key
===
Qt
.
Key_Left
||
event
.
key
===
Qt
.
Key_Right
||
event
.
key
===
Qt
.
Key_Up
||
event
.
key
===
Qt
.
Key_Down
||
event
.
key
===
Qt
.
Key_Escape
)
...
...
src/timeline2/view/qml/timeline.qml
View file @
4ce7f1a9
...
...
@@ -15,7 +15,7 @@ Rectangle {
signal
clipClicked
()
signal
mousePosChanged
(
int
position
)
signal
showClipMenu
()
signal
showClipMenu
(
int
cid
)
signal
showCompositionMenu
()
signal
showTimelineMenu
()
signal
showRulerMenu
()
...
...
src/timeline2/view/timelinewidget.cpp
View file @
4ce7f1a9
...
...
@@ -36,6 +36,7 @@
#include
"qmltypes/thumbnailprovider.h"
#include
"timelinecontroller.h"
#include
"utils/clipboardproxy.hpp"
#include
"effects/effectsrepository.hpp"
#include
<KDeclarative/KDeclarative>
// #include <QUrl>
...
...
@@ -175,7 +176,7 @@ void TimelineWidget::setModel(const std::shared_ptr<TimelineItemModel> &model, M
connect
(
rootObject
(),
SIGNAL
(
processingDrag
(
bool
)),
pCore
->
window
(),
SIGNAL
(
enableUndo
(
bool
)));
connect
(
m_proxy
,
&
TimelineController
::
seeked
,
proxy
,
&
MonitorProxy
::
setPosition
);
rootObject
()
->
setProperty
(
"dar"
,
pCore
->
getCurrentDar
());
connect
(
rootObject
(),
SIGNAL
(
showClipMenu
()),
this
,
SLOT
(
showClipMenu
()));
connect
(
rootObject
(),
SIGNAL
(
showClipMenu
(
int
)),
this
,
SLOT
(
showClipMenu
(
int
)));
connect
(
rootObject
(),
SIGNAL
(
showCompositionMenu
()),
this
,
SLOT
(
showCompositionMenu
()));
connect
(
rootObject
(),
SIGNAL
(
showTimelineMenu
()),
this
,
SLOT
(
showTimelineMenu
()));
connect
(
rootObject
(),
SIGNAL
(
showRulerMenu
()),
this
,
SLOT
(
showRulerMenu
()));
...
...
@@ -193,8 +194,24 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event)
QQuickWidget
::
mousePressEvent
(
event
);
}
void
TimelineWidget
::
showClipMenu
()
void
TimelineWidget
::
showClipMenu
(
int
cid
)
{
// Hide not applicable effects
QList
<
QAction
*>
effects
=
m_favEffects
->
actions
();
int
tid
=
model
()
->
getClipTrackId
(
cid
);
bool
isAudioTrack
=
false
;
if
(
tid
>
-
1
)
{
isAudioTrack
=
model
()
->
isAudioTrack
(
tid
);
}
m_favCompositions
->
setEnabled
(
!
isAudioTrack
);
for
(
auto
ac
:
effects
)
{
const
QString
&
id
=
ac
->
data
().
toString
();
if
(
EffectsRepository
::
get
()
->
isAudioEffect
(
id
)
!=
isAudioTrack
)
{
ac
->
setVisible
(
false
);
}
else
{
ac
->
setVisible
(
true
);
}
}
m_timelineClipMenu
->
popup
(
m_clickPos
);
}
...
...
src/timeline2/view/timelinewidget.h
View file @
4ce7f1a9
...
...
@@ -72,7 +72,7 @@ public slots:
private
slots
:
void
slotUngrabHack
();
void
showClipMenu
();
void
showClipMenu
(
int
cid
);
void
showCompositionMenu
();
void
showTimelineMenu
();
void
showRulerMenu
();
...
...
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