Commit 7d79f58a authored by Clement CHAVANCE's avatar Clement CHAVANCE Committed by Clement CHAVANCE
Browse files

Basic clip list feature in the import window

parent 5a7e16fe
......@@ -39,6 +39,7 @@ void ImportMediaListController::addMedia( Media* media )
ImportMediaCellView* cell = new ImportMediaCellView( media->getUuid() );
connect( cell, SIGNAL( cellSelected( const QUuid& ) ), this, SLOT( mediaSelection( const QUuid& ) ) );
connect( cell, SIGNAL( cellDeleted( const QUuid& ) ), this, SLOT( mediaDeletion( const QUuid& ) ) );
connect( cell, SIGNAL( arrowClicked( const QUuid& ) ), this, SIGNAL( showClipListAsked( const QUuid& ) ) );
cell->setTitle( media->getFileName() );
cell->setThumbnail( media->getSnapshot() );
......@@ -130,3 +131,4 @@ void ImportMediaListController::mediaDeletion( const QUuid& uuid )
{
emit mediaDeleted( uuid );
}
......@@ -64,6 +64,8 @@ class ImportMediaListController : public ListViewController
void clipSelected( const QUuid& uuid );
void mediaDeleted( const QUuid& uuid );
void clipDeleted( const QUuid& uuid );
void showClipListAsked( const QUuid& uuid );
};
#endif // IMPORTMEDIALISTCONTROLLER_H
......@@ -42,11 +42,12 @@ PreviewWidget::PreviewWidget( GenericRenderer* genericRenderer, QWidget *parent
m_videoPalette.setColor( QPalette::Window, QColor( Qt::black ) );
m_ui->renderWidget->setPalette( m_videoPalette );
// Hide markers buttons if we are not using a ClipRenderer
// Hide markers and createClip buttons if we are not using a ClipRenderer
if ( !qobject_cast<ClipRenderer*>( genericRenderer ) )
{
m_ui->pushButtonMarkerStart->hide();
m_ui->pushButtonMarkerStop->hide();
m_ui->pushButtonCreateClip->hide();
}
// Give the renderer to the ruler
......@@ -72,6 +73,7 @@ PreviewWidget::PreviewWidget( GenericRenderer* genericRenderer, QWidget *parent
connect( m_ui->pushButtonMarkerStart, SIGNAL( clicked() ), this, SLOT( markerStartClicked() ) );
connect( m_ui->pushButtonMarkerStop, SIGNAL( clicked() ), this, SLOT( markerStopClicked() ) );
connect( m_ui->pushButtonCreateClip, SIGNAL( clicked() ), this, SLOT( createNewClipFromMarkers() ) );
}
PreviewWidget::~PreviewWidget()
......@@ -180,6 +182,11 @@ void PreviewWidget::createNewClipFromMarkers()
qint64 beg = m_ui->rulerWidget->getMarker( PreviewRuler::START );
qint64 end = m_ui->rulerWidget->getMarker( PreviewRuler::STOP );
if ( beg == -1 && end == -1 )
return ;
qDebug() << "Creating new Clip beg:" << beg << "end" << end;
beg = beg < 0 ? 0 : beg;
Clip* part = new Clip( selectedMedia, beg, end );
......
......@@ -81,8 +81,13 @@ ImportController::ImportController(QWidget *parent) :
connect( this, SIGNAL( mediaSelected( Media* ) ), m_preview->getGenericRenderer(), SLOT( setMedia( Media* ) ) );
connect( this, SIGNAL( mediaSelected( Media* ) ), m_tag, SLOT( mediaSelected( Media* ) ) );
//Media
connect( m_mediaListController, SIGNAL( mediaSelected( QUuid ) ), this, SLOT( mediaSelection( QUuid ) ) );
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_mediaListController, SIGNAL( clipSelected( const QUuid& ) ), this, SLOT( clipSelection( const QUuid& ) ) );
connect( m_mediaListController, SIGNAL( clipDeleted( const QUuid& ) ), this, SLOT( clipDeletion( const QUuid& ) ) );
}
ImportController::~ImportController()
......@@ -131,7 +136,18 @@ void ImportController::mediaSelection( const QUuid& uuid )
void ImportController::clipSelection( const QUuid& uuid )
{
Q_UNUSED( uuid );
if ( !m_currentUuid.isNull() )
m_mediaListController->getCell( m_currentUuid )->setPalette( palette() );
QPalette p = m_mediaListController->getCell( uuid )->palette();
p.setColor( QPalette::Window, QColor( Qt::darkBlue ) );
m_mediaListController->getCell( uuid )->setPalette( p );
foreach(QUuid id, m_model->getMedias()->keys() )
{
Media* media = m_model->getMedias()->value( id );
if (media->clip( uuid ) )
{
}
}
}
void ImportController::updateMediaRequested( Media* media )
......@@ -237,3 +253,15 @@ void ImportController::clipDeletion( const QUuid& uuid )
media->removeClip( uuid );
}
}
void ImportController::showClipList( const QUuid& uuid )
{
qDebug() << "Showing clip list for" << uuid;
Media* media = m_model->getMedia( uuid );
if ( media->clips()->size() == 0 )
return ;
ImportMediaListController* view = new ImportMediaListController( m_stackNav );
view->addClipsFromMedia( media );
m_stackNav->pushViewController( view );
}
......@@ -74,6 +74,7 @@ class ImportController : public QDialog
void clipSelection( const QUuid& uuid );
void mediaDeletion( const QUuid& uuid );
void clipDeletion( const QUuid& uuid );
void showClipList( const QUuid& uuid );
private slots:
void forwardButtonClicked();
......
......@@ -4,6 +4,7 @@
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Thomas Boquet <thomas.boquet@gmail.com>
* Authors: Clement CHAVANCE <chavance.c@gmail.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -35,6 +36,10 @@ MediaCellView::MediaCellView( const QUuid& uuid, QWidget *parent ) :
setFocusPolicy( Qt::ClickFocus );
setAutoFillBackground( true );
connect( m_ui->delLabel, SIGNAL( clicked( QWidget*, QMouseEvent* ) ), this, SLOT( deleteButtonClicked( QWidget*, QMouseEvent* ) ) );
//TODO : if it's a clip, disable the arrow
connect( m_ui->arrow,
SIGNAL( clicked( QWidget*, QMouseEvent* ) ),
SLOT( arrowButtonClicked( QWidget*, QMouseEvent* ) ) );
}
MediaCellView::~MediaCellView()
......@@ -136,6 +141,12 @@ void MediaCellView::deleteButtonClicked( QWidget*, QMouseEvent* )
emit cellDeleted( uuid() );
}
void MediaCellView::arrowButtonClicked( QWidget*, QMouseEvent* )
{
qDebug() << "arrow clicked for uuid" << uuid();
emit arrowClicked( uuid() );
}
void MediaCellView::setLength( qint64 length )
{
QTime duration;
......
......@@ -74,6 +74,7 @@ signals:
public slots:
void deleteButtonClicked( QWidget* sender, QMouseEvent* event );
void arrowButtonClicked( QWidget* sender, QMouseEvent* event );
};
......
......@@ -42,6 +42,7 @@ void MediaListViewController::newMediaLoaded( Media* media )
connect( cell, SIGNAL ( cellSelected( QUuid ) ), this, SLOT ( cellSelection( QUuid ) ) );
connect( cell, SIGNAL ( cellDeleted( QUuid ) ), this, SLOT( mediaDeletion( QUuid ) ) );
connect( cell, SIGNAL ( arrowClicked( QUuid ) ), this, SLOT( showClipList( QUuid ) ) );
if ( media->getMetadata() != Media::ParsedWithSnapshot )
connect( media, SIGNAL( snapshotComputed( Media* ) ), this, SLOT( updateCell( Media* ) ) );
......@@ -89,3 +90,8 @@ void MediaListViewController::updateCell( Media* media )
if ( cell != NULL )
cell->setThumbnail( media->getSnapshot() );
}
void MediaListViewController::showClipList( const QUuid& uuid )
{
qDebug() << "need to show the clip list of " << uuid;
}
......@@ -26,6 +26,7 @@ public slots:
void mediaDeletion( const QUuid& uuid );
void mediaRemoved( const QUuid& uuid );
void updateCell( Media* media );
void showClipList( const QUuid& uuid );
signals:
void mediaSelected( Media* media );
void mediaDeleted( const QUuid& uuid );
......
......@@ -225,6 +225,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButtonCreateClip">
<property name="text">
<string>Create Clip</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButtonStop">
<property name="sizePolicy">
......
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