Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
VLMC
Commits
5912bd9f
Commit
5912bd9f
authored
Mar 10, 2010
by
Hugo Beauzee-Luyssen
Browse files
MediaContainer: Don't add the same clip twice in the same container
parent
961f5e83
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/Gui/PreviewWidget.cpp
View file @
5912bd9f
...
...
@@ -209,5 +209,6 @@ void PreviewWidget::createNewClipFromMarkers()
Clip
*
part
=
new
Clip
(
clip
,
beg
,
end
);
//Adding the newly created clip to the media
clip
->
addSubclip
(
part
);
if
(
clip
->
addSubclip
(
part
)
==
false
)
delete
part
;
}
src/Library/MediaContainer.cpp
View file @
5912bd9f
...
...
@@ -79,11 +79,19 @@ MediaContainer::mediaAlreadyLoaded( const QFileInfo& fileInfo )
return
false
;
}
void
bool
MediaContainer
::
addClip
(
Clip
*
clip
)
{
foreach
(
Clip
*
c
,
m_clips
.
values
()
)
{
if
(
clip
->
uuid
()
==
c
->
uuid
()
||
(
clip
->
getMedia
()
->
fileInfo
()
==
clip
->
getMedia
()
->
fileInfo
()
&&
(
clip
->
begin
()
==
c
->
begin
()
&&
clip
->
end
()
==
c
->
end
()
)
)
)
return
false
;
}
m_clips
[
clip
->
uuid
()]
=
clip
;
emit
newClipLoaded
(
clip
);
return
true
;
}
void
...
...
src/Library/MediaContainer.h
View file @
5912bd9f
...
...
@@ -70,15 +70,17 @@ public:
* \param fileInfo The file infos
* \return true if the file is already loaded, false otherwhise
*/
bool
mediaAlreadyLoaded
(
const
QFileInfo
&
fileInfo
);
bool
mediaAlreadyLoaded
(
const
QFileInfo
&
fileInfo
);
/**
* \brief Add a clip.
*
* This will emit the newClipLoaded signal.
* The method will first check for an identic clip existence.
* This will emit the newClipLoaded signal if the Clip is added.
*
* \param clip The clip to be added.
* \return true if the Clip has been added.
*/
void
addClip
(
Clip
*
clip
);
bool
addClip
(
Clip
*
clip
);
/**
* \return All the loaded Clip
...
...
src/Media/Clip.cpp
View file @
5912bd9f
...
...
@@ -280,10 +280,10 @@ Clip::getChilds() const
return
m_childs
;
}
void
bool
Clip
::
addSubclip
(
Clip
*
clip
)
{
m_childs
->
addClip
(
clip
);
return
m_childs
->
addClip
(
clip
);
}
void
...
...
src/Media/Clip.h
View file @
5912bd9f
...
...
@@ -122,7 +122,7 @@ class Clip : public QObject
*/
void
clear
();
void
addSubclip
(
Clip
*
clip
);
bool
addSubclip
(
Clip
*
clip
);
private:
Media
*
m_media
;
...
...
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