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
a63f0e5d
Commit
a63f0e5d
authored
Aug 18, 2016
by
Hugo Beauzée-Luyssen
Browse files
Library: Don't inherit MediaContainer
parent
34508ae4
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Library/Library.cpp
View file @
a63f0e5d
...
...
@@ -94,31 +94,27 @@ void
Library
::
addMedia
(
Media
*
media
)
{
setCleanState
(
false
);
MediaContainer
::
addMedia
(
media
);
}
Media
*
Library
::
addMedia
(
const
QFileInfo
&
fileInfo
)
{
Media
*
media
=
MediaContainer
::
addMedia
(
fileInfo
);
if
(
media
!=
nullptr
)
{
setCleanState
(
false
);
connect
(
media
,
SIGNAL
(
metaDataComputed
(
const
Media
*
)
),
this
,
SLOT
(
mediaLoaded
(
const
Media
*
)
),
Qt
::
QueuedConnection
);
m_medias
[
fileInfo
.
absoluteFilePath
()]
=
media
;
}
return
media
;
if
(
m_medias
.
contains
(
media
->
fileInfo
()
->
absoluteFilePath
()
)
)
return
;
m_medias
[
media
->
fileInfo
()
->
absoluteFilePath
()]
=
media
;
}
bool
Library
::
addClip
(
Clip
*
clip
)
{
bool
ret
=
MediaContainer
::
addClip
(
clip
);
if
(
ret
!=
false
)
setCleanState
(
false
);
foreach
(
Clip
*
c
,
m_clips
.
values
()
)
{
if
(
clip
->
uuid
()
==
c
->
uuid
()
||
(
clip
->
media
()
->
fileInfo
()
==
c
->
media
()
->
fileInfo
()
&&
(
clip
->
begin
()
==
c
->
begin
()
&&
clip
->
end
()
==
c
->
end
()
)
)
)
{
vlmcWarning
()
<<
"Clip already loaded."
;
return
false
;
}
}
setCleanState
(
false
);
m_medias
[
clip
->
media
()
->
fileInfo
()
->
absoluteFilePath
()]
=
clip
->
media
();
return
ret
;
return
true
;
}
bool
...
...
@@ -133,6 +129,26 @@ Library::media(const QString& mrl)
return
m_medias
.
value
(
mrl
);
}
Clip
*
Library
::
clip
(
const
QString
&
uuid
)
{
return
m_clips
.
value
(
uuid
);
}
Clip
*
Library
::
clip
(
const
QUuid
&
uuid
)
{
return
clip
(
uuid
.
toString
()
);
}
void
Library
::
clear
()
{
m_medias
.
clear
();
m_clips
.
clear
();
setCleanState
(
true
);
}
void
Library
::
setCleanState
(
bool
newState
)
{
...
...
src/Library/Library.h
View file @
a63f0e5d
...
...
@@ -30,8 +30,8 @@
#ifndef LIBRARY_H
#define LIBRARY_H
#include
"MediaContainer.h"
#include
<QObject>
#include
<QHash>
class
Clip
;
class
Media
;
...
...
@@ -42,7 +42,7 @@ class Settings;
* \class Library
* \brief Library Object that handles public Clips
*/
class
Library
:
public
MediaContainer
class
Library
:
public
QObject
{
Q_OBJECT
Q_DISABLE_COPY
(
Library
)
...
...
@@ -51,10 +51,18 @@ public:
Library
(
Settings
*
projectSettings
);
virtual
~
Library
();
virtual
void
addMedia
(
Media
*
media
);
virtual
Media
*
addMedia
(
const
QFileInfo
&
fileInfo
);
virtual
bool
addClip
(
Clip
*
clip
);
bool
isInCleanState
()
const
;
Media
*
media
(
const
QString
&
mrl
);
/**
* @brief clip returns an existing clip
* @param uuid the clip's UUID
* @return The clip if it exists, or nullptr
* This can be any clip, the given UUID doesn't have to refer to a root clip
*/
Clip
*
clip
(
const
QString
&
uuid
);
Clip
*
clip
(
const
QUuid
&
uuid
);
void
clear
();
private:
void
setCleanState
(
bool
newState
);
...
...
@@ -63,6 +71,13 @@ private:
bool
m_cleanState
;
Settings
*
m_settings
;
QHash
<
QString
,
Media
*>
m_medias
;
/**
* @brief m_clips contains all the clips loaded in the library, without any
* subclip hierarchy
*/
QHash
<
QUuid
,
Clip
*>
m_clips
;
void
preSave
();
void
postLoad
();
...
...
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