Commit f8da06f1 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Media: Trying a "de-uglyfication"

parent 73cfb7e8
......@@ -382,7 +382,7 @@ ImportController::showClipList( const QUuid& uuid )
if ( m_temporaryMedias.contains( uuid ) == false )
return ;
Media* media = m_temporaryMedias[uuid];
if ( media->clips()->size() == 0 )
if ( media->clipsCount() == 0 )
return ;
m_clipListController = new ImportMediaListController( m_stackNav );
......
......@@ -133,9 +133,8 @@ ImportMediaListController::cleanAll()
void
ImportMediaListController::addClipsFromMedia( Media* media )
{
QUuid uuid;
foreach( uuid, media->clips()->keys() )
addClip( media->clips()->value( uuid ) );
foreach( Clip* clip, media->clips().values() )
addClip( clip );
}
void
......
......@@ -45,7 +45,7 @@ ClipListViewController::~ClipListViewController()
void ClipListViewController::addClipsFromMedia( Media* media )
{
foreach( Clip* clip, *media->clips() )
foreach( Clip* clip, media->clips() )
addClip( clip );
}
......
......@@ -52,7 +52,7 @@ void MediaListViewController::newMediaLoaded( Media* media )
this, SLOT( updateCell( const Media* ) ) );
connect( media, SIGNAL( clipAdded( Clip* ) ),
this, SLOT( newClipAdded(Clip*) ) );
cell->setNbClips( media->clips()->size() );
cell->setNbClips( media->clipsCount() );
cell->setThumbnail( media->snapshot() );
cell->setTitle( media->fileName() );
cell->setLength( media->lengthMS() );
......@@ -95,7 +95,7 @@ void MediaListViewController::updateCell( const Media* media )
MediaCellView* cell = qobject_cast<MediaCellView*>( m_cells->value( media->uuid(), NULL ) );
if ( cell != NULL )
{
cell->setNbClips( media->clips()->size() );
cell->setNbClips( media->clipsCount() );
cell->setLength( media->lengthMS() );
cell->setThumbnail( media->snapshot() );
cell->setEnabled(true);
......@@ -107,7 +107,7 @@ void MediaListViewController::showClipList( const QUuid& uuid )
if ( !m_cells->contains( uuid ) )
return ;
if ( Library::getInstance()->media( uuid ) == NULL ||
Library::getInstance()->media( uuid )->clips()->size() == 0 )
Library::getInstance()->media( uuid )-> clipsCount() == 0 )
return ;
m_lastUuidClipListAsked = uuid;
m_clipsListView = new ClipListViewController( m_nav, uuid );
......
......@@ -69,7 +69,7 @@ Library::clip( const QUuid& uuid )
foreach( mediaUuid, m_medias.keys() )
{
Media* media = m_medias.value( mediaUuid );
if ( media != NULL && media->clips()->contains( uuid ) )
if ( media != NULL && media->clips().contains( uuid ) )
return media->clip( uuid );
}
return NULL;
......@@ -80,7 +80,7 @@ Library::clip( const QUuid& mediaUuid, const QUuid& clipUuid )
{
if ( m_medias.contains( mediaUuid ) )
{
if ( m_medias.value( mediaUuid )->clips()->contains( clipUuid ) )
if ( m_medias.value( mediaUuid )->clips().contains( clipUuid ) )
return m_medias.value( mediaUuid )->clip( clipUuid );
else
return new Clip( m_medias.value( mediaUuid )->baseClip() );
......@@ -259,10 +259,10 @@ Library::saveProject( QDomDocument& doc, QDomElement& rootNode )
media.appendChild( mrl );
media.appendChild( uuid );
//Creating the clip branch
if ( it.value()->clips()->size() != 0 )
if ( it.value()->clipsCount() != 0 )
{
QDomElement clips = doc.createElement( "clips" );
foreach( Clip* c, it.value()->clips()->values() )
foreach( Clip* c, it.value()->clips().values() )
{
QDomElement clip = doc.createElement( "clip" );
clip.setAttribute( "begin", c->begin() );
......@@ -301,6 +301,6 @@ Library::removeClip( const QUuid& mediaId, const QUuid& clipId )
else
return;
if ( med->clips()->contains( clipId ) )
if ( med->clips().contains( clipId ) )
med->removeClip( clipId );
}
......@@ -282,6 +282,27 @@ bool Media::addClip( Clip* clip )
return true;
}
Clip*
Media::clip( const QUuid &uuid )
{
QHash<QUuid, Clip*>::const_iterator it = m_clips.find( uuid );
if ( it == m_clips.end() )
return NULL;
return *it;
}
quint32
Media::clipsCount() const
{
return m_clips.size();
}
const QHash<QUuid, Clip*>&
Media::clips() const
{
return m_clips;
}
void Media::removeClip( const QUuid& uuid )
{
m_clips.remove( uuid );
......
......@@ -142,8 +142,9 @@ public:
bool addClip( Clip* clip );
void removeClip( const QUuid& uuid );
Clip* clip( const QUuid& uuid ) const { return m_clips[uuid]; }
const QHash<QUuid, Clip*>* clips() const { return &m_clips; }
Clip* clip( const QUuid& uuid );
quint32 clipsCount() const;
const QHash<QUuid, Clip*> &clips() const;
QList<int>* audioValues() { return m_audioValueList; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment