Commit f4066d3c authored by Clement CHAVANCE's avatar Clement CHAVANCE Committed by Clement CHAVANCE

clip view is now available in the media library

parent 432a2a91
......@@ -68,10 +68,8 @@ bool ImportMediaListController::contains( QUuid uuid )
void ImportMediaListController::removeMedia( const QUuid& uuid )
{
ImportMediaCellView* cell = m_mediaCellList->value( uuid );
removeCell( cell );
removeCell( m_mediaCellList->value( uuid ) );
m_mediaCellList->remove( uuid );
delete cell;
}
void ImportMediaListController::addClip( Clip* clip )
......
......@@ -139,7 +139,6 @@ void ImportController::mediaSelection( const QUuid& uuid )
void ImportController::clipSelection( const QUuid& uuid )
{
qDebug() << m_clipListController;
if ( !m_currentUuid.isNull() && !m_controllerSwitched )
m_clipListController->getCell( m_currentUuid )->setPalette( palette() );
else
......@@ -203,10 +202,8 @@ void ImportController::setUIMetaData( Clip* clip )
//compute clip length
QTime time;
qint64 length = clip->getLengthSecond();
qDebug() << "Clip Length" << length;
time = time.addSecs( length );
qDebug() << time;
qDebug() << "time :" << time.toString( "hh:mm:ss" );
m_ui->durationValueLabel->setText( time.toString( "hh:mm:ss" ) );
//Filename || title
m_ui->nameValueLabel->setText( clip->getParent()->getFileInfo()->fileName() );
......@@ -275,13 +272,15 @@ void ImportController::mediaDeletion( const QUuid& uuid )
void ImportController::clipDeletion( const QUuid& uuid )
{
m_mediaListController->removeClip( uuid );
m_clipListController->removeClip( uuid );
QUuid id;
foreach( id, m_model->getMedias()->keys() )
{
Media* media = m_model->getMedias()->value( id );
if (media->clip( uuid) )
if ( media->clip( uuid ) )
{
media->removeClip( uuid );
}
}
}
......
......@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include <QPushButton>
#include "ListViewController.h"
......@@ -31,13 +32,11 @@ ListViewController::ListViewController( StackViewController* nav ) : m_nav( nav
m_title = new QString( "Media List" );
m_scrollArea = new QScrollArea();
m_layout = new QVBoxLayout();
m_container = new QWidget();
m_layout->setAlignment( Qt::AlignTop );
m_layout->setSpacing( 0 );
m_layout->setContentsMargins( 0, 0, 0, 0 );
m_container->setLayout( m_layout );
m_scrollArea->setWidget( m_container );
m_scrollArea->setLayout( m_layout );
m_scrollArea->setWidgetResizable( true );
m_scrollArea->setAcceptDrops( true );
......@@ -48,7 +47,6 @@ ListViewController::~ListViewController()
delete m_title;
delete m_scrollArea;
delete m_layout;
delete m_container;
}
// ViewController method implementation
......@@ -71,4 +69,5 @@ void ListViewController::addCell( QWidget* cell )
void ListViewController::removeCell( QWidget* cell )
{
m_layout->removeWidget( cell );
delete cell;
}
......@@ -54,7 +54,6 @@ protected:
private:
QString* m_title;
QScrollArea* m_scrollArea;
QWidget* m_container;
StackViewController* m_nav;
};
......
......@@ -109,6 +109,7 @@ void MediaCellView::mousePressEvent( QMouseEvent* event )
void MediaCellView::mouseMoveEvent( QMouseEvent* event )
{
qDebug() << "in MediaCellView::mouseMoveEvent";
if ( ( event->buttons() | Qt::LeftButton ) != Qt::LeftButton )
return;
......@@ -147,9 +148,12 @@ void MediaCellView::arrowButtonClicked( QWidget*, QMouseEvent* )
emit arrowClicked( uuid() );
}
void MediaCellView::setLength( qint64 length )
void MediaCellView::setLength( qint64 length, bool mSecs )
{
QTime duration;
duration = duration.addMSecs( length );
if ( mSecs )
duration = duration.addMSecs( length );
else
duration = duration.addSecs( length );
m_ui->length->setText( duration.toString( "hh:mm:ss" ) );
}
......@@ -48,7 +48,7 @@ public:
* \brief Set the length displayed in the cell
* \param length The media length, in ms.
*/
void setLength( qint64 length );
void setLength( qint64 length, bool mSecs = true );
QString title() const;
const QUuid& uuid() const;
const ClickableLabel* nextButton() const;
......
......@@ -32,10 +32,14 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent )
m_nav = new StackViewController( this );
MediaListViewController* list = new MediaListViewController( m_nav );
Library* library = Library::getInstance();
//Media
connect( list, SIGNAL( mediaSelected( Media* ) ), this, SLOT( mediaSelection( Media* ) ) );
connect( list, SIGNAL( mediaDeleted( const QUuid& ) ), library, SLOT( removingMediaAsked( const QUuid& ) ) );
connect( library, SIGNAL( mediaRemoved( QUuid ) ), list, SLOT( mediaRemoved( const QUuid& ) ) );
connect( m_nav, SIGNAL( importRequired() ), this, SIGNAL( importRequired() ) );
//Clip
connect( list, SIGNAL( clipSelected( Clip* clip ) ), this, SIGNAL( clipSelected( Clip* ) ) );
connect( list, SIGNAL( clipRemoved( const QUuid&, const QUuid& ) ), library, SLOT( removeClip( const QUuid&, const QUuid& ) ) );
m_nav->pushViewController( list );
}
......
......@@ -93,5 +93,20 @@ void MediaListViewController::updateCell( Media* media )
void MediaListViewController::showClipList( const QUuid& uuid )
{
qDebug() << "need to show the clip list of " << uuid;
if ( Library::getInstance()->getMedia( uuid )->clips()->size() == 0 )
return ;
m_clipsListView = new ClipListViewController( m_nav, uuid );
m_clipsListView->addClipsFromMedia( Library::getInstance()->getMedia( uuid ) );
qDebug() << "Clips added";
connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ), this, SIGNAL( clipSelected( const QUuid& ) ) );
m_nav->pushViewController( m_clipsListView );
qDebug() << "View Pushed";
}
void MediaListViewController::restoreContext()
{
qDebug() << "context restored";
if ( m_clipsListView != 0 )
delete m_clipsListView;
m_clipsListView = 0;
}
......@@ -4,6 +4,7 @@
#include "StackViewController.h"
#include "ListViewController.h"
#include "MediaCellView.h"
#include "ClipListViewController.h"
#include "Library.h"
#include "Media.h"
......@@ -19,6 +20,7 @@ private:
StackViewController* m_nav;
QUuid m_currentUuid;
QHash<QUuid, QWidget*>* m_cells;
ClipListViewController* m_clipsListView;
public slots:
void newMediaLoaded( Media* );
......@@ -27,6 +29,9 @@ public slots:
void mediaRemoved( const QUuid& uuid );
void updateCell( Media* media );
void showClipList( const QUuid& uuid );
private slots:
void restoreContext();
signals:
void mediaSelected( Media* media );
void mediaDeleted( const QUuid& uuid );
......
......@@ -74,6 +74,7 @@ void StackViewController::pushViewController( ViewController* viewController,
}
m_current = viewController;
qDebug() << "title :" << &m_current->title();
m_nav->setTitle( m_current->title() );
m_layout->insertWidget( 1, m_current->view() );
}
......
......@@ -7,12 +7,13 @@ HEADERS += ListViewController.h \
MediaListViewController.h \
StackViewController.h \
StackViewNavController.h \
ViewController.h
ViewController.h \
ClipListViewController.h
SOURCES += ListViewController.cpp \
MediaCellView.cpp \
MediaLibraryWidget.cpp \
MediaListViewController.cpp \
StackViewController.cpp \
StackViewNavController.cpp
StackViewNavController.cpp \
ClipListViewController.cpp
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