Commit 4c9a1b4e authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Removing ClipListViewController as they are useless.

Trying to use Clip* and Clip's UUID everywhere in the code.
This commit breaks a few things.
parent b93f3d4f
...@@ -36,7 +36,6 @@ SET(VLMC_SRCS ...@@ -36,7 +36,6 @@ SET(VLMC_SRCS
Gui/export/RendererSettings.cpp Gui/export/RendererSettings.cpp
Gui/import/ImportController.cpp Gui/import/ImportController.cpp
Gui/import/ImportMediaListController.cpp Gui/import/ImportMediaListController.cpp
Gui/library/ClipListViewController.cpp
Gui/library/ListViewController.cpp Gui/library/ListViewController.cpp
Gui/library/MediaCellView.cpp Gui/library/MediaCellView.cpp
Gui/library/MediaLibraryWidget.cpp Gui/library/MediaLibraryWidget.cpp
...@@ -119,7 +118,6 @@ SET (VLMC_HDRS ...@@ -119,7 +118,6 @@ SET (VLMC_HDRS
Gui/import/ImportMediaListController.h Gui/import/ImportMediaListController.h
Gui/LanguageHelper.h Gui/LanguageHelper.h
Gui/LCDTimecode.h Gui/LCDTimecode.h
Gui/library/ClipListViewController.h
Gui/library/ListViewController.h Gui/library/ListViewController.h
Gui/library/MediaCellView.h Gui/library/MediaCellView.h
Gui/library/MediaLibraryWidget.h Gui/library/MediaLibraryWidget.h
......
...@@ -235,16 +235,13 @@ void MainWindow::setupLibrary() ...@@ -235,16 +235,13 @@ void MainWindow::setupLibrary()
Qt::AllDockWidgetAreas, Qt::AllDockWidgetAreas,
QDockWidget::AllDockWidgetFeatures, QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea ); Qt::LeftDockWidgetArea );
connect( mediaLibraryWidget, SIGNAL( mediaSelected( Media* ) ), connect( mediaLibraryWidget, SIGNAL( clipSelected(QUuid) ),
m_clipPreview->getGenericRenderer(), SLOT( setMedia( Media* ) ) ); m_clipPreview->getGenericRenderer(), SLOT( setClip( QUuid ) ) );
connect( Library::getInstance(), SIGNAL( mediaRemoved( const QUuid& ) ), connect( Library::getInstance(), SIGNAL( mediaRemoved( const QUuid& ) ),
m_clipPreview->getGenericRenderer(), SLOT( mediaUnloaded( QUuid ) ) ); m_clipPreview->getGenericRenderer(), SLOT( mediaUnloaded( QUuid ) ) );
connect( mediaLibraryWidget, SIGNAL( importRequired() ), this, SLOT( on_actionImport_triggered() ) ); connect( mediaLibraryWidget, SIGNAL( importRequired() ), this, SLOT( on_actionImport_triggered() ) );
connect( mediaLibraryWidget, SIGNAL( previewClipSetted( Clip* ) ),
m_clipPreview->getGenericRenderer(), SLOT( setClip( Clip* ) ) );
} }
void MainWindow::on_actionSave_triggered() void MainWindow::on_actionSave_triggered()
......
...@@ -87,8 +87,9 @@ ImportController::ImportController(QWidget *parent) : ...@@ -87,8 +87,9 @@ ImportController::ImportController(QWidget *parent) :
connect( m_ui->forwardButton, SIGNAL( clicked() ), connect( m_ui->forwardButton, SIGNAL( clicked() ),
this, SLOT( forwardButtonClicked() ) ); this, SLOT( forwardButtonClicked() ) );
connect( this, SIGNAL( mediaSelected( Media* ) ), connect( m_mediaListController, SIGNAL( mediaSelected( const QUuid& ) ),
m_preview->getGenericRenderer(), SLOT( setMedia( Media* ) ) ); qobject_cast<const ClipRenderer*>( m_preview->getGenericRenderer() ),
SLOT( setClip( const QUuid& ) ) );
connect( this, SIGNAL( mediaSelected( Media* ) ), connect( this, SIGNAL( mediaSelected( Media* ) ),
m_tag, SLOT( mediaSelected( Media* ) ) ); m_tag, SLOT( mediaSelected( Media* ) ) );
......
/*****************************************************************************
* ClipListViewController.cpp: controller for the library clip list
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include <QtDebug>
#include <QWidget>
#include "ClipListViewController.h"
#include "MediaCellView.h"
#include "Library.h"
ClipListViewController::ClipListViewController( StackViewController* nav, const QUuid& mediaId )
: ListViewController( nav ),
m_nav( nav ),
m_mediaId( mediaId ),
m_currentUuid(),
m_deletion( 0 )
{
connect( this, SIGNAL( clipDeleted( const QUuid&, const QUuid& ) ),
Library::getInstance(), SLOT( removeClip( const QUuid&, const QUuid& ) ) );
}
ClipListViewController::~ClipListViewController()
{
foreach( QWidget* cell, m_cells.values() )
removeCell( cell );
}
void ClipListViewController::addClipsFromMedia( Media* media )
{
foreach( Clip* clip, media->clips() )
addClip( clip );
}
int ClipListViewController::getNbDeletion() const
{
return m_deletion;
}
void ClipListViewController::resetNbDeletion()
{
m_deletion = 0;
}
void ClipListViewController::addClip( Clip* clip )
{
MediaCellView* cell = new MediaCellView( clip );
cell->containsClip();
connect( cell, SIGNAL( cellSelected( QUuid ) ), this, SLOT( cellSelection( const QUuid& ) ) );
connect( cell, SIGNAL( cellDeleted( const QUuid& ) ), this, SLOT( clipDeletion( const QUuid& ) ) );
addCell( cell );
m_cells.insert( clip->uuid(), cell );
}
void ClipListViewController::clean()
{
foreach ( QWidget* widg, m_cells )
{
removeCell( widg );
delete widg;
}
m_cells.clear();
}
void ClipListViewController::cellSelection( const QUuid& uuid )
{
if ( m_currentUuid == uuid )
return;
if ( m_cells.contains( uuid ) )
{
if ( !m_currentUuid.isNull() && m_cells.contains( m_currentUuid ) )
m_cells.value( m_currentUuid )->setPalette( m_cells.value( uuid )->palette() );
QPalette p = m_cells.value( uuid )->palette();
p.setColor( QPalette::Window, QColor( Qt::darkBlue ) );
m_cells.value( uuid )->setPalette( p );
m_currentUuid = uuid;
emit clipSelected( uuid );
}
}
void ClipListViewController::clipDeletion( const QUuid& uuid )
{
if ( m_cells.contains( uuid ) )
{
QUuid tmp = uuid;
++m_deletion;
QWidget* cell = m_cells.value( uuid );
removeCell( cell );
m_currentUuid = QUuid();
m_cells.remove( tmp );
emit clipDeleted( m_mediaId, tmp );
}
}
/*****************************************************************************
* ClipListViewController.h: controller for the library clip list
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* 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
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#ifndef CLIPLISTVIEWCONTROLLER_H
#define CLIPLISTVIEWCONTROLLER_H
#include "ListViewController.h"
#include "Media.h"
#include "Clip.h"
class ClipListViewController : public ListViewController
{
Q_OBJECT
public:
explicit ClipListViewController( StackViewController* nav, const QUuid& uuid);
~ClipListViewController();
void addClipsFromMedia( Media* media );
int getNbDeletion() const;
void resetNbDeletion();
private:
void addClip( Clip* clip );
void clean();
StackViewController* m_nav;
QHash<QUuid, QWidget*> m_cells;
QUuid m_mediaId;
QUuid m_currentUuid;
int m_deletion;
public slots:
void cellSelection( const QUuid& uuid );
void clipDeletion( const QUuid& uuid );
signals:
void clipSelected( const QUuid& uuid );
void clipDeleted( const QUuid& mediaId, const QUuid& clipId );
};
#endif
...@@ -33,12 +33,10 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent ) ...@@ -33,12 +33,10 @@ MediaLibraryWidget::MediaLibraryWidget( QWidget* parent ) : QWidget( parent )
MediaListViewController* list = new MediaListViewController( m_nav ); MediaListViewController* list = new MediaListViewController( m_nav );
Library* library = Library::getInstance(); Library* library = Library::getInstance();
//Media //Media
connect( list, SIGNAL( mediaSelected( Media* ) ), this, SLOT( mediaSelection( Media* ) ) ); connect( list, SIGNAL( clipSelected( const QUuid& ) ), this, SIGNAL( clipSelected( const QUuid& ) ) );
connect( list, SIGNAL( mediaDeleted( const QUuid& ) ), library, SLOT( removingMediaAsked( const QUuid& ) ) ); connect( list, SIGNAL( clipDeleted( const QUuid& ) ), library, SLOT( removingMediaAsked( const QUuid& ) ) );
connect( library, SIGNAL( mediaRemoved( QUuid ) ), list, SLOT( mediaRemoved( const QUuid& ) ) ); connect( library, SIGNAL( mediaRemoved( QUuid ) ), list, SLOT( mediaRemoved( const QUuid& ) ) );
connect( m_nav, SIGNAL( importRequired() ), this, SIGNAL( importRequired() ) ); connect( m_nav, SIGNAL( importRequired() ), this, SIGNAL( importRequired() ) );
//Clip
connect( list, SIGNAL( clipSelected( Clip* ) ), this, SIGNAL( previewClipSetted( Clip* ) ) );
connect( this, SIGNAL( addClipToViewController( Clip* ) ), list, SLOT( newClipAdded( Clip* ) ) ); connect( this, SIGNAL( addClipToViewController( Clip* ) ), list, SLOT( newClipAdded( Clip* ) ) );
m_nav->pushViewController( list ); m_nav->pushViewController( list );
setMinimumWidth( 280 ); setMinimumWidth( 280 );
...@@ -53,8 +51,3 @@ const ViewController* MediaLibraryWidget::getCurrentViewController() ...@@ -53,8 +51,3 @@ const ViewController* MediaLibraryWidget::getCurrentViewController()
{ {
return m_nav->getCurrentViewController(); return m_nav->getCurrentViewController();
} }
void MediaLibraryWidget::mediaSelection( Media* media )
{
emit mediaSelected( media );
}
...@@ -25,10 +25,11 @@ ...@@ -25,10 +25,11 @@
#include <QWidget> #include <QWidget>
class StackViewController; class StackViewController;
class ViewController; class ViewController;
class Media; class Media;
class Clip; class Clip;
class QUuid;
class MediaLibraryWidget : public QWidget class MediaLibraryWidget : public QWidget
{ {
...@@ -43,12 +44,8 @@ public: ...@@ -43,12 +44,8 @@ public:
private: private:
StackViewController* m_nav; StackViewController* m_nav;
private slots:
void mediaSelection( Media* media );
signals: signals:
void mediaSelected( Media* media ); void clipSelected( const QUuid& );
void previewClipSetted( Clip* clip );
void importRequired(); void importRequired();
void addClipToViewController( Clip* clip ); void addClipToViewController( Clip* clip );
}; };
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "MediaListViewController.h" #include "MediaListViewController.h"
#include <QDebug> #include "Clip.h"
MediaListViewController::MediaListViewController( StackViewController* nav ) : MediaListViewController::MediaListViewController( StackViewController* nav ) :
ListViewController( nav ), m_nav( nav ), m_clipsListView( 0 ) ListViewController( nav ), m_nav( nav ), m_clipsListView( 0 )
...@@ -45,7 +45,7 @@ void MediaListViewController::newMediaLoaded( Media* media ) ...@@ -45,7 +45,7 @@ void MediaListViewController::newMediaLoaded( Media* media )
connect( cell, SIGNAL ( cellSelected( QUuid ) ), connect( cell, SIGNAL ( cellSelected( QUuid ) ),
this, SLOT ( cellSelection( QUuid ) ) ); this, SLOT ( cellSelection( QUuid ) ) );
connect( cell, SIGNAL ( cellDeleted( QUuid ) ), connect( cell, SIGNAL ( cellDeleted( QUuid ) ),
this, SIGNAL( mediaDeleted( QUuid ) ) ); this, SIGNAL( clipDeleted( QUuid ) ) );
connect( cell, SIGNAL( arrowClicked( const QUuid& ) ), connect( cell, SIGNAL( arrowClicked( const QUuid& ) ),
this, SLOT( showClipList( const QUuid& ) ) ); this, SLOT( showClipList( const QUuid& ) ) );
connect( media, SIGNAL( clipAdded( Clip* ) ), connect( media, SIGNAL( clipAdded( Clip* ) ),
...@@ -71,7 +71,7 @@ void MediaListViewController::cellSelection( const QUuid& uuid ) ...@@ -71,7 +71,7 @@ void MediaListViewController::cellSelection( const QUuid& uuid )
p.setColor( QPalette::Window, QColor( Qt::darkBlue ) ); p.setColor( QPalette::Window, QColor( Qt::darkBlue ) );
m_cells->value( uuid )->setPalette( p ); m_cells->value( uuid )->setPalette( p );
m_currentUuid = uuid; m_currentUuid = uuid;
emit mediaSelected( Library::getInstance()->media( uuid ) ); emit clipSelected( uuid );
} }
} }
...@@ -81,6 +81,7 @@ void MediaListViewController::mediaRemoved( const QUuid& uuid ) ...@@ -81,6 +81,7 @@ void MediaListViewController::mediaRemoved( const QUuid& uuid )
removeCell( cell ); removeCell( cell );
m_cells->remove( uuid ); m_cells->remove( uuid );
m_currentUuid = QUuid(); m_currentUuid = QUuid();
emit clipDeleted( uuid );
} }
void MediaListViewController::showClipList( const QUuid& uuid ) void MediaListViewController::showClipList( const QUuid& uuid )
...@@ -91,8 +92,8 @@ void MediaListViewController::showClipList( const QUuid& uuid ) ...@@ -91,8 +92,8 @@ void MediaListViewController::showClipList( const QUuid& uuid )
Library::getInstance()->media( uuid )-> clipsCount() == 0 ) Library::getInstance()->media( uuid )-> clipsCount() == 0 )
return ; return ;
m_lastUuidClipListAsked = uuid; m_lastUuidClipListAsked = uuid;
m_clipsListView = new ClipListViewController( m_nav, uuid ); m_clipsListView = new MediaListViewController( m_nav );
m_clipsListView->addClipsFromMedia( Library::getInstance()->media( uuid ) ); m_clipsListView->newMediaLoaded( Library::getInstance()->media( uuid ) );
connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ), connect( m_clipsListView, SIGNAL( clipSelected( const QUuid& ) ),
this, SLOT( clipSelection( const QUuid& ) ) ); this, SLOT( clipSelection( const QUuid& ) ) );
m_nav->pushViewController( m_clipsListView ); m_nav->pushViewController( m_clipsListView );
...@@ -116,27 +117,10 @@ void MediaListViewController::newClipAdded( Clip* clip ) ...@@ -116,27 +117,10 @@ void MediaListViewController::newClipAdded( Clip* clip )
void MediaListViewController::restoreContext() void MediaListViewController::restoreContext()
{ {
if ( m_clipsListView->getNbDeletion() != 0 ) MediaCellView* cell = qobject_cast<MediaCellView*>( m_cells->value( m_lastUuidClipListAsked, 0 ) );
if ( cell != 0 )
{ {
if ( m_cells->contains( m_lastUuidClipListAsked ) ) qDebug() << "FIXME: Update clip count";
{
MediaCellView* cell = qobject_cast<MediaCellView*>( m_cells->value( m_lastUuidClipListAsked, 0 ) );
if ( cell != 0 )
{
cell->decrementClipCount( m_clipsListView->getNbDeletion() );
m_clipsListView->resetNbDeletion();
}
}
} }
delete m_clipsListView; delete m_clipsListView;
} }
void
MediaListViewController::clipSelection( const QUuid& uuid )
{
Clip* clip;
if ( ( clip = Library::getInstance()->clip( m_currentUuid, uuid ) ) != 0 )
{
emit clipSelected( clip );
}
}
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include "StackViewController.h" #include "StackViewController.h"
#include "ListViewController.h" #include "ListViewController.h"
#include "MediaCellView.h" #include "MediaCellView.h"
#include "ClipListViewController.h"
#include "Library.h" #include "Library.h"
#include "Media.h" #include "Media.h"
...@@ -39,27 +38,23 @@ public: ...@@ -39,27 +38,23 @@ public:
virtual ~MediaListViewController(); virtual ~MediaListViewController();
private: private:
StackViewController* m_nav; StackViewController* m_nav;
QUuid m_currentUuid; QUuid m_currentUuid;
QHash<QUuid, QWidget*>* m_cells; QHash<QUuid, QWidget*>* m_cells;
ClipListViewController* m_clipsListView; MediaListViewController* m_clipsListView;
QUuid m_lastUuidClipListAsked; QUuid m_lastUuidClipListAsked;
public slots: public slots:
//void newMediaLoaded( Media* );
void newMediaLoaded( Media* media ); void newMediaLoaded( Media* media );
void cellSelection( const QUuid& uuid ); void cellSelection( const QUuid& uuid );
void mediaRemoved( const QUuid& uuid ); void mediaRemoved( const QUuid& uuid );
void showClipList( const QUuid& uuid ); void showClipList( const QUuid& uuid );
void newClipAdded( Clip* clip ); void newClipAdded( Clip* clip );
void clipSelection( const QUuid& uuid );
private slots: private slots:
void restoreContext(); void restoreContext();
signals: signals:
void mediaSelected( Media* media ); void clipSelected( const QUuid& );
void mediaDeleted( const QUuid& uuid ); void clipDeleted( const QUuid& );
void clipSelected( Clip* clip );
}; };
#endif // MEDIALISTVIEWCONTROLLER_H #endif // MEDIALISTVIEWCONTROLLER_H
...@@ -25,12 +25,13 @@ ...@@ -25,12 +25,13 @@
#include <QtGlobal> #include <QtGlobal>
#include <QLabel> #include <QLabel>
#include "Clip.h"
#include "ClipRenderer.h" #include "ClipRenderer.h"
#include "Library.h"
#include "Media.h" #include "Media.h"
#include "MainWorkflow.h" #include "MainWorkflow.h"
#include "VLCMediaPlayer.h" #include "VLCMediaPlayer.h"
#include "VLCMedia.h" #include "VLCMedia.h"
#include "Clip.h"
ClipRenderer::ClipRenderer() : ClipRenderer::ClipRenderer() :
GenericRenderer(), GenericRenderer(),
...@@ -56,22 +57,11 @@ ClipRenderer::~ClipRenderer() ...@@ -56,22 +57,11 @@ ClipRenderer::~ClipRenderer()
} }
void void
ClipRenderer::setMedia( Media *media ) ClipRenderer::setClip( const QUuid& uuid )
{ {
m_selectedMedia = media; qDebug() << "setting clip:" << uuid;
if ( media == NULL || media->lengthMS() == 0 ) Clip* clip = Library::getInstance()->clip( uuid );
return ;
m_begin = 0;
m_end = media->nbFrames();
if ( m_isRendering == true )
m_mediaChanged = true;
else
m_clipLoaded = false;
}
void
ClipRenderer::setClip( Clip *clip )
{
if ( clip == NULL || clip->length() == 0 ) if ( clip == NULL || clip->length() == 0 )
{ {
m_selectedMedia = NULL; m_selectedMedia = NULL;
......
...@@ -71,8 +71,11 @@ private: ...@@ -71,8 +71,11 @@ private:
bool m_mediaChanged; bool m_mediaChanged;
public slots: public slots:
virtual void setClip( Clip* clip ); /**
virtual void setMedia( Media* media ); * \brief Set the Clip to render
* \param clip The clip to render
*/
virtual void setClip( const QUuid& );
virtual void mediaUnloaded( const QUuid& ); virtual void mediaUnloaded( const QUuid& );
virtual void previewWidgetCursorChanged( qint64 newFrame ); virtual void previewWidgetCursorChanged( qint64 newFrame );
......
...@@ -181,20 +181,6 @@ public slots: ...@@ -181,20 +181,6 @@ public slots:
* \brief This SLOT has to be called when the render ends. * \brief This SLOT has to be called when the render ends.
*/ */
virtual void __endReached() = 0; virtual void __endReached() = 0;
/**
* \brief Set the Clip to render
* \param clip The clip to render
* \warning This must only be called from a ClipRenderer implementation
* \todo This method shouldn't be here, as it is not generic at all.
*/
virtual void setClip( Clip* clip ) = 0;
/**
* \brief Set the Media to render.
* \param media The media to render.
* \warning This must only be called from a ClipRenderer implementation
* \todo This method shouldn't be here, as it is not generic at all.
*/
virtual void setMedia( Media* media ) = 0;
/** /**
* \brief Handle a media unloading. Mainly, this should stop the render * \brief Handle a media unloading. Mainly, this should stop the render
* using this media if any. * using this media if any.
......
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