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
7bd1d6b5
Commit
7bd1d6b5
authored
Aug 08, 2018
by
Jean-Baptiste Mardelle
Browse files
Timeline context menu now only shows favorite effects / compositions
parent
63987d13
Changes
26
Hide whitespace changes
Inline
Side-by-side
src/assets/abstractassetsrepository.hpp
View file @
7bd1d6b5
...
...
@@ -52,7 +52,7 @@ public:
AssetType
getType
(
const
QString
&
assetId
)
const
;
/* @brief Return name of asset */
QString
getName
(
const
QString
&
assetId
)
const
;
Q_INVOKABLE
QString
getName
(
const
QString
&
assetId
)
const
;
/* @brief Return description of asset */
QString
getDescription
(
const
QString
&
assetId
)
const
;
...
...
src/assets/assetlist/model/assetfilter.hpp
View file @
7bd1d6b5
...
...
@@ -45,6 +45,11 @@ public:
/** @brief Returns true if the ModelIndex in the source model is visible after filtering
*/
bool
isVisible
(
const
QModelIndex
&
sourceIndex
);
/** @brief If we are in favorite view, invalidate filter to refresh. Call this after a favorite has changed
*/
virtual
void
reloadFilterOnFavorite
()
=
0
;
QVariantList
getCategories
();
Q_INVOKABLE
QModelIndex
getNextChild
(
const
QModelIndex
&
current
);
Q_INVOKABLE
QModelIndex
getPreviousChild
(
const
QModelIndex
&
current
);
...
...
src/assets/assetlist/view/qml/assetList.qml
View file @
7bd1d6b5
...
...
@@ -259,7 +259,7 @@ Rectangle {
Image
{
id
:
assetThumb
visible
:
assetDelegate
.
isItem
property
bool
isFavorite
:
model
.
favorite
property
bool
isFavorite
:
model
==
undefined
||
model
.
favorite
==
undefined
?
false
:
model
.
favorite
height
:
parent
.
height
width
:
height
source
:
'
image://asseticon/
'
+
styleData
.
value
...
...
src/bin/binplaylist.cpp
View file @
7bd1d6b5
...
...
@@ -27,7 +27,7 @@
#include
"projectclip.h"
#include
<mlt++/Mlt.h>
QString
BinPlaylist
::
binPlaylistId
=
QString
Literal
(
"main_bin"
);
QString
BinPlaylist
::
binPlaylistId
=
QString
(
"main_bin"
);
BinPlaylist
::
BinPlaylist
()
:
m_binPlaylist
(
new
Mlt
::
Playlist
(
pCore
->
getCurrentProfile
()
->
profile
()))
...
...
src/effects/effectlist/model/effectfilter.cpp
View file @
7bd1d6b5
...
...
@@ -37,6 +37,13 @@ void EffectFilter::setFilterType(bool enabled, EffectType type)
invalidateFilter
();
}
void
EffectFilter
::
reloadFilterOnFavorite
()
{
if
(
m_type_enabled
&&
m_type_value
==
EffectType
::
Favorites
)
{
invalidateFilter
();
}
}
bool
EffectFilter
::
filterType
(
const
std
::
shared_ptr
<
TreeItem
>
&
item
)
const
{
if
(
!
m_type_enabled
)
{
...
...
src/effects/effectlist/model/effectfilter.hpp
View file @
7bd1d6b5
...
...
@@ -41,6 +41,7 @@ public:
@param type Effect type to display
*/
void
setFilterType
(
bool
enabled
,
EffectType
type
);
void
reloadFilterOnFavorite
()
override
;
protected:
bool
filterType
(
const
std
::
shared_ptr
<
TreeItem
>
&
item
)
const
;
...
...
src/effects/effectlist/view/effectlistwidget.cpp
View file @
7bd1d6b5
...
...
@@ -50,6 +50,8 @@ EffectListWidget::EffectListWidget(QWidget *parent)
void
EffectListWidget
::
updateFavorite
(
const
QModelIndex
&
index
)
{
m_proxyModel
->
dataChanged
(
index
,
index
,
QVector
<
int
>
());
m_proxyModel
->
reloadFilterOnFavorite
();
emit
reloadFavorites
();
}
EffectListWidget
::~
EffectListWidget
()
...
...
src/effects/effectlist/view/effectlistwidget.hpp
View file @
7bd1d6b5
...
...
@@ -52,7 +52,7 @@ private:
EffectListWidgetProxy
*
m_proxy
;
signals:
void
reload
Basket
();
void
reload
Favorites
();
};
// see https://bugreports.qt.io/browse/QTBUG-57714, don't expose a QWidget as a context property
...
...
@@ -69,7 +69,7 @@ public:
}
Q_INVOKABLE
QString
getName
(
const
QModelIndex
&
index
)
const
{
return
q
->
getName
(
index
);
}
Q_INVOKABLE
bool
isFavorite
(
const
QModelIndex
&
index
)
const
{
return
q
->
isFavorite
(
index
);
}
Q_INVOKABLE
void
setFavorite
(
const
QModelIndex
&
index
,
bool
favorite
)
const
{
q
->
setFavorite
(
index
,
favorite
);
q
->
updateFavorite
(
index
);
q
->
reloadBasket
();
}
Q_INVOKABLE
void
setFavorite
(
const
QModelIndex
&
index
,
bool
favorite
)
const
{
q
->
setFavorite
(
index
,
favorite
);
q
->
updateFavorite
(
index
);}
Q_INVOKABLE
QString
getDescription
(
const
QModelIndex
&
index
)
const
{
return
q
->
getDescription
(
index
);
}
Q_INVOKABLE
QVariantMap
getMimeData
(
const
QString
&
assetId
)
const
{
return
q
->
getMimeData
(
assetId
);
}
...
...
src/effects/effectsrepository.cpp
View file @
7bd1d6b5
...
...
@@ -22,14 +22,15 @@
#include
"effectsrepository.hpp"
#include
"core.h"
#include
"kdenlivesettings.h"
#include
"profiles/profilemodel.hpp"
#include
"xml/xml.hpp"
#include
<mlt++/Mlt.h>
#include
<QDir>
#include
<QFile>
#include
<QStandardPaths>
#include
<QTextStream>
#include
"profiles/profilemodel.hpp"
#include
<mlt++/Mlt.h>
#include
<KLocalizedString>
std
::
unique_ptr
<
EffectsRepository
>
EffectsRepository
::
instance
;
std
::
once_flag
EffectsRepository
::
m_onceFlag
;
...
...
@@ -38,6 +39,21 @@ EffectsRepository::EffectsRepository()
:
AbstractAssetsRepository
<
EffectType
>
()
{
init
();
// Check that our favorite effects are valid
QStringList
invalidEffect
;
for
(
const
QString
&
effect
:
KdenliveSettings
::
favorite_effects
())
{
if
(
!
exists
(
effect
))
{
invalidEffect
<<
effect
;
}
}
if
(
!
invalidEffect
.
isEmpty
())
{
pCore
->
displayMessage
(
i18n
(
"Some of your favorite effects are invalid and were removed: %1"
,
invalidEffect
.
join
(
QLatin1Char
(
','
))),
ErrorMessage
);
QStringList
newFavorites
=
KdenliveSettings
::
favorite_effects
();
for
(
const
QString
&
effect
:
invalidEffect
)
{
newFavorites
.
removeAll
(
effect
);
}
KdenliveSettings
::
setFavorite_effects
(
newFavorites
);
}
}
Mlt
::
Properties
*
EffectsRepository
::
retrieveListFromMlt
()
...
...
src/effectslist/effectbasket.cpp
View file @
7bd1d6b5
...
...
@@ -37,6 +37,7 @@ EffectBasket::EffectBasket(QWidget *parent)
void
EffectBasket
::
slotReloadBasket
()
{
clear
();
for
(
const
QString
&
effectId
:
KdenliveSettings
::
favorite_effects
())
{
if
(
EffectsRepository
::
get
()
->
exists
(
effectId
))
{
QListWidgetItem
*
it
=
new
QListWidgetItem
(
EffectsRepository
::
get
()
->
getName
(
effectId
));
...
...
@@ -44,6 +45,7 @@ void EffectBasket::slotReloadBasket()
addItem
(
it
);
}
}
sortItems
();
}
QMimeData
*
EffectBasket
::
mimeData
(
const
QList
<
QListWidgetItem
*>
list
)
const
...
...
src/kdenlivesettings.kcfg
View file @
7bd1d6b5
...
...
@@ -943,11 +943,11 @@
</entry>
<entry
name=
"favorite_effects"
type=
"StringList"
>
<label>
List of favorite effects ids.
</label>
<default></default>
<default>
volume,lift_gamma_gain,qtblend
</default>
</entry>
<entry
name=
"favorite_transitions"
type=
"StringList"
>
<label>
List of favorite transitions ids.
</label>
<default></default>
<default>
qtblend
</default>
</entry>
<entry
name=
"selected_effecttab"
type=
"Int"
>
<label>
Last opened tab in effects list.
</label>
...
...
src/mainwindow.cpp
View file @
7bd1d6b5
...
...
@@ -402,7 +402,7 @@ void MainWindow::init()
// Create Effect Basket (dropdown list of favorites)
m_effectBasket
=
new
EffectBasket
(
this
);
connect
(
m_effectBasket
,
&
EffectBasket
::
activateAsset
,
pCore
->
projectManager
(),
&
ProjectManager
::
activateAsset
);
connect
(
m_effectList2
,
&
EffectListWidget
::
reload
Basket
,
m_effectBasket
,
&
EffectBasket
::
slotReloadBasket
);
connect
(
m_effectList2
,
&
EffectListWidget
::
reload
Favorites
,
m_effectBasket
,
&
EffectBasket
::
slotReloadBasket
);
auto
*
widgetlist
=
new
QWidgetAction
(
this
);
widgetlist
->
setDefaultWidget
(
m_effectBasket
);
// widgetlist->setText(i18n("Favorite Effects"));
...
...
@@ -2096,6 +2096,9 @@ void MainWindow::connectDocument()
m_normalEditTool
->
setChecked
(
true
);
connect
(
m_projectMonitor
,
&
Monitor
::
durationChanged
,
this
,
&
MainWindow
::
slotUpdateProjectDuration
);
pCore
->
monitorManager
()
->
setDocument
(
project
);
connect
(
m_effectList2
,
&
EffectListWidget
::
reloadFavorites
,
getMainTimeline
(),
&
TimelineWidget
::
updateEffectFavorites
);
connect
(
m_transitionList2
,
&
TransitionListWidget
::
reloadFavorites
,
getMainTimeline
(),
&
TimelineWidget
::
updateTransitionFavorites
);
// TODO REFAC: fix
// trackView->updateProfile(1.0);
// Init document zone
...
...
src/timeline2/view/qml/AssetMenu.qml
View file @
7bd1d6b5
...
...
@@ -26,6 +26,7 @@ import QtQml.Models 2.2
Menu
{
id
:
menuRoot
property
alias
menuModel
:
itemRepeater
.
model
property
bool
isTransition
:
false
signal
assetSelected
(
string
assetId
)
...
...
@@ -34,8 +35,8 @@ Menu {
onObjectAdded
:
menuRoot
.
insertItem
(
index
,
object
)
onObjectRemoved
:
menuRoot
.
removeItem
(
object
)
delegate
:
MenuItem
{
text
:
name
property
string
assetId
:
identifier
text
:
timeline
.
getAssetName
(
modelData
,
isTransition
)
//
name
property
string
assetId
:
modelData
//
identifier
onTriggered
:
{
console
.
log
(
assetId
)
menuRoot
.
assetSelected
(
assetId
)
...
...
src/timeline2/view/qml/Clip.qml
View file @
7bd1d6b5
...
...
@@ -303,7 +303,7 @@ Rectangle {
Loader
{
id
:
thumbsLoader
anchors.fill
:
parent
source
:
parentTrack
.
isAudio
?
"
ClipAudioThumbs.qml
"
:
"
ClipThumbs.qml
"
source
:
parentTrack
.
isAudio
?
"
ClipAudioThumbs.qml
"
:
clipType
==
ProducerType
.
Color
?
""
:
"
ClipThumbs.qml
"
}
Rectangle
{
...
...
src/timeline2/view/qml/ClipMenu.qml
View file @
7bd1d6b5
...
...
@@ -94,6 +94,7 @@ Menu {
AssetMenu
{
title
:
i18n
(
'
Insert a composition...
'
)
menuModel
:
transitionModel
isTransition
:
true
onAssetSelected
:
{
timeline
.
addCompositionToClip
(
assetId
,
clipId
)
}
...
...
src/timeline2/view/qml/ClipMenuOld.qml
View file @
7bd1d6b5
...
...
@@ -94,6 +94,7 @@ Menu {
AssetMenu
{
title
:
i18n
(
'
Insert a composition...
'
)
menuModel
:
transitionModel
isTransition
:
true
onAssetSelected
:
{
timeline
.
addCompositionToClip
(
assetId
,
clipId
)
}
...
...
src/timeline2/view/qml/timeline.qml
View file @
7bd1d6b5
...
...
@@ -366,6 +366,7 @@ Rectangle {
AssetMenu
{
title
:
i18n
(
'
Insert a composition...
'
)
menuModel
:
transitionModel
isTransition
:
true
onAssetSelected
:
{
var
track
=
Logic
.
getTrackIdFromPos
(
menu
.
clickedY
-
ruler
.
height
)
var
frame
=
Math
.
round
((
menu
.
clickedX
+
scrollView
.
flickableItem
.
contentX
)
/
timeline
.
scaleFactor
)
...
...
src/timeline2/view/timelinecontroller.cpp
View file @
7bd1d6b5
...
...
@@ -1726,3 +1726,8 @@ void TimelineController::updateClipActions()
act
->
setEnabled
(
enableAction
);
}
}
const
QString
TimelineController
::
getAssetName
(
const
QString
&
assetId
,
bool
isTransition
)
{
return
isTransition
?
TransitionsRepository
::
get
()
->
getName
(
assetId
)
:
EffectsRepository
::
get
()
->
getName
(
assetId
);
}
src/timeline2/view/timelinecontroller.h
View file @
7bd1d6b5
...
...
@@ -380,6 +380,7 @@ public:
void
selectCurrentItem
(
ObjectType
type
,
bool
select
,
bool
addToCurrent
=
false
);
/** @brief Set target tracks (video, audio) */
void
setTargetTracks
(
QPair
<
int
,
int
>
targets
);
Q_INVOKABLE
const
QString
getAssetName
(
const
QString
&
assetId
,
bool
isTransition
);
public
slots
:
void
selectMultitrack
();
...
...
src/timeline2/view/timelinewidget.cpp
View file @
7bd1d6b5
...
...
@@ -94,6 +94,26 @@ TimelineWidget::~TimelineWidget()
delete
m_proxy
;
}
void
TimelineWidget
::
updateEffectFavorites
()
{
rootContext
()
->
setContextProperty
(
"effectModel"
,
sortedItems
(
KdenliveSettings
::
favorite_effects
(),
false
));
}
void
TimelineWidget
::
updateTransitionFavorites
()
{
rootContext
()
->
setContextProperty
(
"transitionModel"
,
sortedItems
(
KdenliveSettings
::
favorite_transitions
(),
true
));
}
const
QStringList
TimelineWidget
::
sortedItems
(
const
QStringList
&
items
,
bool
isTransition
)
{
QMap
<
QString
,
QString
>
sortedItems
;
for
(
const
QString
&
effect
:
items
)
{
sortedItems
.
insert
(
m_proxy
->
getAssetName
(
effect
,
isTransition
),
effect
);
}
return
sortedItems
.
values
();
}
void
TimelineWidget
::
setModel
(
std
::
shared_ptr
<
TimelineItemModel
>
model
)
{
m_thumbnailer
->
resetProject
();
...
...
@@ -105,8 +125,9 @@ void TimelineWidget::setModel(std::shared_ptr<TimelineItemModel> model)
rootContext
()
->
setContextProperty
(
"multitrack"
,
sortModel
);
rootContext
()
->
setContextProperty
(
"controller"
,
model
.
get
());
rootContext
()
->
setContextProperty
(
"timeline"
,
m_proxy
);
rootContext
()
->
setContextProperty
(
"transitionModel"
,
m_transitionProxyModel
.
get
());
rootContext
()
->
setContextProperty
(
"effectModel"
,
m_effectsProxyModel
.
get
());
rootContext
()
->
setContextProperty
(
"transitionModel"
,
sortedItems
(
KdenliveSettings
::
favorite_transitions
(),
true
));
//m_transitionProxyModel.get());
//rootContext()->setContextProperty("effectModel", m_effectsProxyModel.get());
rootContext
()
->
setContextProperty
(
"effectModel"
,
sortedItems
(
KdenliveSettings
::
favorite_effects
(),
false
));
rootContext
()
->
setContextProperty
(
"guidesModel"
,
pCore
->
projectManager
()
->
current
()
->
getGuideModel
().
get
());
rootContext
()
->
setContextProperty
(
"clipboard"
,
new
ClipboardProxy
(
this
));
setSource
(
QUrl
(
QStringLiteral
(
"qrc:/qml/timeline.qml"
)));
...
...
Prev
1
2
Next
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