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
a747bf59
Commit
a747bf59
authored
Aug 05, 2021
by
Jean-Baptiste Mardelle
Browse files
Correctly select a clip in clip monitor after it is added to project.
Fixes
#1152
parent
f6774b8e
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/bin/clipcreator.cpp
View file @
a747bf59
...
...
@@ -69,7 +69,10 @@ QString ClipCreator::createTitleClip(const std::unordered_map<QString, QString>
Xml
::
addXmlProperties
(
prod
,
properties
);
QString
id
;
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create title clip"
));
std
::
function
<
void
(
const
QString
&
)
>
callBack
=
[](
const
QString
&
binId
)
{
pCore
->
bin
()
->
selectClipById
(
binId
);
};
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create title clip"
),
callBack
);
return
res
?
id
:
QStringLiteral
(
"-1"
);
}
...
...
@@ -81,7 +84,10 @@ QString ClipCreator::createColorClip(const QString &color, int duration, const Q
auto
prod
=
createProducer
(
xml
,
ClipType
::
Color
,
color
,
name
,
duration
,
QStringLiteral
(
"color"
));
QString
id
;
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create color clip"
));
std
::
function
<
void
(
const
QString
&
)
>
callBack
=
[](
const
QString
&
binId
)
{
pCore
->
bin
()
->
selectClipById
(
binId
);
};
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create color clip"
),
callBack
);
return
res
?
id
:
QStringLiteral
(
"-1"
);
}
...
...
@@ -177,7 +183,10 @@ QString ClipCreator::createSlideshowClip(const QString &path, int duration, cons
Xml
::
addXmlProperties
(
prod
,
properties
);
QString
id
;
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create slideshow clip"
));
std
::
function
<
void
(
const
QString
&
)
>
callBack
=
[](
const
QString
&
binId
)
{
pCore
->
bin
()
->
selectClipById
(
binId
);
};
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create slideshow clip"
),
callBack
);
return
res
?
id
:
QStringLiteral
(
"-1"
);
}
...
...
@@ -210,7 +219,10 @@ QString ClipCreator::createTitleTemplate(const QString &path, const QString &tex
}
QString
id
;
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create title template"
));
std
::
function
<
void
(
const
QString
&
)
>
callBack
=
[](
const
QString
&
binId
)
{
pCore
->
bin
()
->
selectClipById
(
binId
);
};
bool
res
=
model
->
requestAddBinClip
(
id
,
xml
.
documentElement
(),
parentFolder
,
i18n
(
"Create title template"
),
callBack
);
return
res
?
id
:
QStringLiteral
(
"-1"
);
}
...
...
@@ -232,6 +244,7 @@ const QString ClipCreator::createClipsFromList(const QList<QUrl> &list, bool che
// Check for duplicates
QList
<
QUrl
>
cleanList
;
QStringList
duplicates
;
bool
firstClip
=
topLevel
;
for
(
const
QUrl
&
url
:
list
)
{
if
(
!
pCore
->
projectItemModel
()
->
urlExists
(
url
.
toLocalFile
()))
{
cleanList
<<
url
;
...
...
@@ -331,7 +344,14 @@ const QString ClipCreator::createClipsFromList(const QList<QUrl> &list, bool che
if
(
answer
==
KMessageBox
::
Cancel
)
continue
;
}
const
QString
clipId
=
ClipCreator
::
createClipFromFile
(
file
.
toLocalFile
(),
parentFolder
,
model
,
undo
,
redo
);
std
::
function
<
void
(
const
QString
&
)
>
callBack
=
[](
const
QString
&
)
{};
if
(
firstClip
)
{
callBack
=
[](
const
QString
&
binId
)
{
pCore
->
bin
()
->
selectClipById
(
binId
);
};
firstClip
=
false
;
}
const
QString
clipId
=
ClipCreator
::
createClipFromFile
(
file
.
toLocalFile
(),
parentFolder
,
model
,
undo
,
redo
,
callBack
);
if
(
createdItem
.
isEmpty
()
&&
clipId
!=
QLatin1String
(
"-1"
))
{
createdItem
=
clipId
;
}
...
...
src/bin/projectitemmodel.cpp
View file @
a747bf59
...
...
@@ -731,12 +731,12 @@ bool ProjectItemModel::requestAddBinClip(QString &id, const QDomElement &descrip
return
res
;
}
bool
ProjectItemModel
::
requestAddBinClip
(
QString
&
id
,
const
QDomElement
&
description
,
const
QString
&
parentId
,
const
QString
&
undoText
)
bool
ProjectItemModel
::
requestAddBinClip
(
QString
&
id
,
const
QDomElement
&
description
,
const
QString
&
parentId
,
const
QString
&
undoText
,
const
std
::
function
<
void
(
const
QString
&
)
>
&
readyCallBack
)
{
QWriteLocker
locker
(
&
m_lock
);
Fun
undo
=
[]()
{
return
true
;
};
Fun
redo
=
[]()
{
return
true
;
};
bool
res
=
requestAddBinClip
(
id
,
description
,
parentId
,
undo
,
redo
);
bool
res
=
requestAddBinClip
(
id
,
description
,
parentId
,
undo
,
redo
,
readyCallBack
);
if
(
res
)
{
pCore
->
pushUndo
(
undo
,
redo
,
undoText
.
isEmpty
()
?
i18n
(
"Add bin clip"
)
:
undoText
);
}
...
...
src/bin/projectitemmodel.h
View file @
a747bf59
...
...
@@ -163,7 +163,7 @@ public:
*/
bool
requestAddBinClip
(
QString
&
id
,
const
QDomElement
&
description
,
const
QString
&
parentId
,
Fun
&
undo
,
Fun
&
redo
,
const
std
::
function
<
void
(
const
QString
&
)
>
&
readyCallBack
=
[](
const
QString
&
)
{});
bool
requestAddBinClip
(
QString
&
id
,
const
QDomElement
&
description
,
const
QString
&
parentId
,
const
QString
&
undoText
=
QString
());
bool
requestAddBinClip
(
QString
&
id
,
const
QDomElement
&
description
,
const
QString
&
parentId
,
const
QString
&
undoText
=
QString
()
,
const
std
::
function
<
void
(
const
QString
&
)
>
&
readyCallBack
=
[](
const
QString
&
)
{}
);
/** @brief This is the addition function when we already have a producer for the clip*/
bool
requestAddBinClip
(
QString
&
id
,
const
std
::
shared_ptr
<
Mlt
::
Producer
>
&
producer
,
const
QString
&
parentId
,
Fun
&
undo
,
Fun
&
redo
);
...
...
src/jobs/cliploadtask.cpp
View file @
a747bf59
...
...
@@ -669,10 +669,6 @@ void ClipLoadTask::run()
}
generateThumbnail
(
binClip
,
producer
);
emit
taskDone
();
if
(
pCore
->
projectItemModel
()
->
clipsCount
()
==
1
)
{
// Always select first added clip
pCore
->
selectBinClip
(
QString
::
number
(
m_owner
.
second
),
false
);
}
}
pCore
->
taskManager
.
taskDone
(
m_owner
.
second
,
this
);
}
...
...
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