Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Kdenlive
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
259
Issues
259
List
Boards
Labels
Service Desk
Milestones
Merge Requests
14
Merge Requests
14
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Multimedia
Kdenlive
Commits
508a4b77
Commit
508a4b77
authored
Oct 07, 2020
by
Jean-Baptiste Mardelle
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add method to easily reload a custom effect
parent
4d93def3
Pipeline
#36684
passed with stage
in 22 minutes and 23 seconds
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
46 additions
and
0 deletions
+46
-0
src/assets/assetlist/view/assetlistwidget.hpp
src/assets/assetlist/view/assetlistwidget.hpp
+1
-0
src/assets/assetlist/view/qml/assetList.qml
src/assets/assetlist/view/qml/assetList.qml
+8
-0
src/effects/effectlist/model/effecttreemodel.cpp
src/effects/effectlist/model/effecttreemodel.cpp
+10
-0
src/effects/effectlist/model/effecttreemodel.hpp
src/effects/effectlist/model/effecttreemodel.hpp
+1
-0
src/effects/effectlist/view/effectlistwidget.cpp
src/effects/effectlist/view/effectlistwidget.cpp
+7
-0
src/effects/effectlist/view/effectlistwidget.hpp
src/effects/effectlist/view/effectlistwidget.hpp
+2
-0
src/effects/effectsrepository.cpp
src/effects/effectsrepository.cpp
+10
-0
src/effects/effectsrepository.hpp
src/effects/effectsrepository.hpp
+1
-0
src/transitions/transitionlist/view/transitionlistwidget.cpp
src/transitions/transitionlist/view/transitionlistwidget.cpp
+4
-0
src/transitions/transitionlist/view/transitionlistwidget.hpp
src/transitions/transitionlist/view/transitionlistwidget.hpp
+2
-0
No files found.
src/assets/assetlist/view/assetlistwidget.hpp
View file @
508a4b77
...
...
@@ -54,6 +54,7 @@ public:
/* @brief Delete a custom effect */
void
deleteCustomEffect
(
const
QModelIndex
&
index
);
virtual
void
reloadCustomEffectIx
(
const
QModelIndex
&
index
)
=
0
;
/* @brief Returns the description of the asset given its model index */
QString
getDescription
(
bool
isEffect
,
const
QModelIndex
&
index
)
const
;
...
...
src/assets/assetlist/view/qml/assetList.qml
View file @
508a4b77
...
...
@@ -330,6 +330,14 @@ Rectangle {
assetlist
.
deleteCustomEffect
(
sel
.
currentIndex
)
}
}
MenuItem
{
id
:
reloadMenu
text
:
i18n
(
"
Reload custom effect
"
)
visible
:
isEffectList
&&
assetContextMenu
.
isCustom
onTriggered
:
{
assetlist
.
reloadCustomEffectIx
(
sel
.
currentIndex
)
}
}
}
TableViewColumn
{
role
:
"
identifier
"
;
title
:
i18n
(
"
Name
"
);
}
...
...
src/effects/effectlist/model/effecttreemodel.cpp
View file @
508a4b77
...
...
@@ -113,6 +113,16 @@ std::shared_ptr<EffectTreeModel> EffectTreeModel::construct(const QString &categ
return
self
;
}
void
EffectTreeModel
::
reloadEffectFromIndex
(
const
QModelIndex
&
index
)
{
if
(
!
index
.
isValid
())
{
return
;
}
std
::
shared_ptr
<
TreeItem
>
item
=
getItemById
((
int
)
index
.
internalId
());
const
QString
path
=
EffectsRepository
::
get
()
->
getCustomPath
(
item
->
dataColumn
(
idCol
).
toString
());
reloadEffect
(
path
);
}
void
EffectTreeModel
::
reloadEffect
(
const
QString
&
path
)
{
QPair
<
QString
,
QString
>
asset
=
EffectsRepository
::
get
()
->
reloadCustom
(
path
);
...
...
src/effects/effectlist/model/effecttreemodel.hpp
View file @
508a4b77
...
...
@@ -38,6 +38,7 @@ protected:
public:
static
std
::
shared_ptr
<
EffectTreeModel
>
construct
(
const
QString
&
categoryFile
,
QObject
*
parent
);
void
reloadEffect
(
const
QString
&
path
);
void
reloadEffectFromIndex
(
const
QModelIndex
&
index
);
void
reloadAssetMenu
(
QMenu
*
effectsMenu
,
KActionCategory
*
effectActions
)
override
;
void
setFavorite
(
const
QModelIndex
&
index
,
bool
favorite
,
bool
isEffect
)
override
;
void
deleteEffect
(
const
QModelIndex
&
index
)
override
;
...
...
src/effects/effectlist/view/effectlistwidget.cpp
View file @
508a4b77
...
...
@@ -84,6 +84,13 @@ QString EffectListWidget::getMimeType(const QString &assetId) const
return
QStringLiteral
(
"kdenlive/effect"
);
}
void
EffectListWidget
::
reloadCustomEffectIx
(
const
QModelIndex
&
index
)
{
static_cast
<
EffectTreeModel
*>
(
m_model
.
get
())
->
reloadEffectFromIndex
(
m_proxyModel
->
mapToSource
(
index
));
m_proxyModel
->
sort
(
0
,
Qt
::
AscendingOrder
);
}
void
EffectListWidget
::
reloadCustomEffect
(
const
QString
&
path
)
{
static_cast
<
EffectTreeModel
*>
(
m_model
.
get
())
->
reloadEffect
(
path
);
...
...
src/effects/effectlist/view/effectlistwidget.hpp
View file @
508a4b77
...
...
@@ -47,6 +47,7 @@ public:
QString
getMimeType
(
const
QString
&
assetId
)
const
override
;
void
updateFavorite
(
const
QModelIndex
&
index
);
void
reloadEffectMenu
(
QMenu
*
effectsMenu
,
KActionCategory
*
effectActions
);
void
reloadCustomEffectIx
(
const
QModelIndex
&
index
)
override
;
public
slots
:
void
reloadCustomEffect
(
const
QString
&
path
);
...
...
@@ -72,6 +73,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
reloadCustomEffectIx
(
const
QModelIndex
&
index
)
const
{
q
->
reloadCustomEffectIx
(
index
);
}
Q_INVOKABLE
void
setFavorite
(
const
QModelIndex
&
index
,
bool
favorite
)
const
{
q
->
setFavorite
(
index
,
favorite
,
true
);
...
...
src/effects/effectsrepository.cpp
View file @
508a4b77
...
...
@@ -231,6 +231,16 @@ bool EffectsRepository::hasInternalEffect(const QString &effectId) const
return
false
;
}
QString
EffectsRepository
::
getCustomPath
(
const
QString
&
id
)
{
QString
customAssetDir
=
QStandardPaths
::
locate
(
QStandardPaths
::
AppDataLocation
,
QStringLiteral
(
"effects"
),
QStandardPaths
::
LocateDirectory
);
QPair
<
QStringList
,
QStringList
>
results
;
QDir
current_dir
(
customAssetDir
);
qDebug
()
<<
"==== FETCHING CUSTOM PATH FOR ID: "
<<
id
;
return
current_dir
.
absoluteFilePath
(
QString
(
"%1.xml"
).
arg
(
id
));
}
QPair
<
QString
,
QString
>
EffectsRepository
::
reloadCustom
(
const
QString
&
path
)
{
std
::
unordered_map
<
QString
,
Info
>
customAssets
;
...
...
src/effects/effectsrepository.hpp
View file @
508a4b77
...
...
@@ -45,6 +45,7 @@ public:
/* @brief returns true if an effect exists in MLT (bypasses the blacklist/metadata parsing) */
bool
hasInternalEffect
(
const
QString
&
effectId
)
const
;
QPair
<
QString
,
QString
>
reloadCustom
(
const
QString
&
path
);
QString
getCustomPath
(
const
QString
&
id
);
/* @brief Returns whether this belongs to main effects */
bool
isPreferred
(
const
QString
&
effectId
)
const
;
...
...
src/transitions/transitionlist/view/transitionlistwidget.cpp
View file @
508a4b77
...
...
@@ -103,3 +103,7 @@ void TransitionListWidget::downloadNewLumas()
// TODO: refresh currently displayd trans ?
}
}
void
TransitionListWidget
::
reloadCustomEffectIx
(
const
QModelIndex
&
path
)
{
}
src/transitions/transitionlist/view/transitionlistwidget.hpp
View file @
508a4b77
...
...
@@ -43,6 +43,7 @@ public:
QString
getMimeType
(
const
QString
&
assetId
)
const
override
;
void
updateFavorite
(
const
QModelIndex
&
index
);
void
downloadNewLumas
();
void
reloadCustomEffectIx
(
const
QModelIndex
&
path
)
override
;
private:
TransitionListWidgetProxy
*
m_proxy
;
...
...
@@ -65,6 +66,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
reloadCustomEffectIx
(
const
QModelIndex
&
index
)
const
{
q
->
reloadCustomEffectIx
(
index
);
}
Q_INVOKABLE
void
setFavorite
(
const
QModelIndex
&
index
,
bool
favorite
)
const
{
q
->
setFavorite
(
index
,
favorite
,
false
);
...
...
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