Commit ff9308e6 authored by Clement CHAVANCE's avatar Clement CHAVANCE

clip count is now incermented / decremented in the inport window

parent e498c3ed
......@@ -25,7 +25,7 @@
#include "ImportMediaListController.h"
#include <QDebug>
ImportMediaListController::ImportMediaListController( StackViewController* nav ) : ListViewController( nav ), m_nav( nav )
ImportMediaListController::ImportMediaListController( StackViewController* nav ) : ListViewController( nav ), m_nav( nav ), m_clipDeleted( 0 )
{
m_mediaCellList = new QHash<QUuid, ImportMediaCellView*>();
}
......@@ -128,6 +128,7 @@ void ImportMediaListController::clipSelection( const QUuid& uuid )
void ImportMediaListController::clipDeletion( const QUuid& uuid )
{
m_clipDeleted += 1;
emit clipDeleted( uuid );
}
......@@ -136,3 +137,17 @@ void ImportMediaListController::mediaDeletion( const QUuid& uuid )
emit mediaDeleted( uuid );
}
void ImportMediaListController::clipAdded( Clip* clip )
{
if ( clip->getParent() == 0 )
return ;
const QUuid& uuid = clip->getParent()->getUuid();
if ( m_mediaCellList->contains( uuid ) )
m_mediaCellList->value( uuid )->incrementClipCount();
}
int ImportMediaListController::getNbDeletions() const
{
return m_clipDeleted;
}
......@@ -48,10 +48,12 @@ class ImportMediaListController : public ListViewController
const QHash<QUuid, ImportMediaCellView*>* getMediaCellList() const { return m_mediaCellList; }
ImportMediaCellView* getCell( QUuid uuid ) const;
bool contains( QUuid uuid );
int getNbDeletions() const;
private:
StackViewController* m_nav;
QHash<QUuid, ImportMediaCellView*>* m_mediaCellList;
int m_clipDeleted;
public slots:
void metaDataComputed( Media* media );
......@@ -59,6 +61,7 @@ class ImportMediaListController : public ListViewController
void mediaSelection( const QUuid& uuid );
void clipDeletion( const QUuid& uuid );
void mediaDeletion( const QUuid& uuid );
void clipAdded( Clip* clip );
signals:
void mediaSelected( const QUuid& uuid );
......
......@@ -89,6 +89,7 @@ ImportController::ImportController(QWidget *parent) :
connect( m_mediaListController, SIGNAL( mediaDeleted( QUuid ) ), this, SLOT( mediaDeletion( QUuid ) ) );
//Clips
connect( m_mediaListController, SIGNAL( showClipListAsked( const QUuid& ) ), this, SLOT( showClipList( const QUuid& ) ) );
connect( m_preview, SIGNAL( addClip( Clip* ) ), m_mediaListController, SLOT( clipAdded( Clip* ) ) );
//StackViewController
connect( m_stackNav, SIGNAL( previousButtonPushed() ), this, SLOT( restoreContext() ) );
}
......@@ -302,6 +303,11 @@ void ImportController::showClipList( const QUuid& uuid )
void ImportController::restoreContext()
{
if ( m_clipListController->getNbDeletions() != 0 )
{
if ( !m_savedUuid.isNull() )
m_mediaListController->getCell( m_savedUuid )->decrementClipCount( m_clipListController->getNbDeletions() );
}
if ( !m_savedUuid.isNull() )
m_currentUuid = m_savedUuid;
m_controllerSwitched = false;
......
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