[vlmc-devel] commit: MediaListView: Auto select the latest added Media ( Hugo Beauzee-Luyssen )
git at videolan.org
git at videolan.org
Wed Mar 10 22:24:41 CET 2010
vlmc | branch: master | Hugo Beauzee-Luyssen <beauze.h at gmail.com> | Wed Mar 10 22:24:10 2010 +0100| [88077eb0430eb4f8496284635347218376a857d5] | committer: Hugo Beauzee-Luyssen
MediaListView: Auto select the latest added Media
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=88077eb0430eb4f8496284635347218376a857d5
---
src/Gui/TagWidget.cpp | 9 +++++++++
src/Gui/TagWidget.h | 3 +++
src/Gui/import/ImportController.cpp | 13 +++++++++++--
src/Gui/import/ImportController.h | 3 ++-
src/Gui/library/MediaListView.cpp | 1 +
src/Library/MediaContainer.cpp | 8 ++++----
src/Library/MediaContainer.h | 2 +-
src/Media/Clip.cpp | 6 ++++++
src/Media/Clip.h | 1 +
9 files changed, 38 insertions(+), 8 deletions(-)
diff --git a/src/Gui/TagWidget.cpp b/src/Gui/TagWidget.cpp
index 379b6f8..33f15e6 100644
--- a/src/Gui/TagWidget.cpp
+++ b/src/Gui/TagWidget.cpp
@@ -65,6 +65,9 @@ void TagWidget::clipSelected( Clip* clip )
else
static_cast<QPushButton*>(m_buttonList[i])->setChecked( false );
}
+ connect( clip->getMedia(), SIGNAL( metaDataComputed( const Media* ) ),
+ this, SLOT( setMetaTags() ) );
+ connect( clip, SIGNAL( destroyed() ), this, SLOT( clipDestroyed() ) );
}
void TagWidget::setMetaTags()
@@ -135,3 +138,9 @@ void TagWidget::changeEvent( QEvent *e )
break;
}
}
+
+void
+TagWidget::clipDestroyed()
+{
+ m_currentClip = NULL;
+}
diff --git a/src/Gui/TagWidget.h b/src/Gui/TagWidget.h
index a872a42..da4bb1d 100644
--- a/src/Gui/TagWidget.h
+++ b/src/Gui/TagWidget.h
@@ -61,6 +61,9 @@ class TagWidget : public QWidget
void clipSelected( Clip* clip );
void buttonTagClicked();
void setMetaTags();
+
+ private slots:
+ void clipDestroyed();
};
#endif // TAGWIDGET_H
diff --git a/src/Gui/import/ImportController.cpp b/src/Gui/import/ImportController.cpp
index 3793100..079e1e2 100644
--- a/src/Gui/import/ImportController.cpp
+++ b/src/Gui/import/ImportController.cpp
@@ -151,7 +151,7 @@ ImportController::clipSelection( const QUuid& uuid )
}
void
-ImportController::setUIMetaData( Clip* clip )
+ImportController::setUIMetaData( const Clip* clip )
{
if ( clip != NULL )
{
@@ -184,7 +184,10 @@ ImportController::importMedia( const QString &filePath )
++m_nbMediaToLoad;
m_ui->progressBar->setMaximum( m_nbMediaToLoad );
- m_temporaryMedias->addMedia( filePath );
+ Media* media = m_temporaryMedias->addMedia( filePath );
+ if ( media )
+ connect( media, SIGNAL( metaDataComputed( const Media* ) ),
+ this, SLOT( metaDataComputed( const Media* ) ) );
}
void
@@ -333,3 +336,9 @@ ImportController::hideErrors()
m_ui->errorLabelImg->hide();
m_ui->errorLabel->hide();
}
+
+void
+ImportController::metaDataComputed( const Media *media )
+{
+ setUIMetaData( media->baseClip() );
+}
diff --git a/src/Gui/import/ImportController.h b/src/Gui/import/ImportController.h
index cd9157d..84b7076 100644
--- a/src/Gui/import/ImportController.h
+++ b/src/Gui/import/ImportController.h
@@ -59,7 +59,7 @@ class ImportController : public QDialog
public:
ImportController(QWidget *parent = 0);
~ImportController();
- void setUIMetaData( Clip *clip );
+ void setUIMetaData( const Clip *clip );
protected:
void changeEvent( QEvent *e );
@@ -96,6 +96,7 @@ class ImportController : public QDialog
void mediaLoaded();
void failedToLoad( Media* media );
void hideErrors();
+ void metaDataComputed( const Media* media );
signals:
void clipSelected( Clip* );
diff --git a/src/Gui/library/MediaListView.cpp b/src/Gui/library/MediaListView.cpp
index 6860a7a..0ecc42b 100644
--- a/src/Gui/library/MediaListView.cpp
+++ b/src/Gui/library/MediaListView.cpp
@@ -57,6 +57,7 @@ void MediaListView::newClipLoaded( Clip *clip )
this, SLOT( showSubClips( const QUuid& ) ) );
addCell( cell );
m_cells.insert( clip->uuid(), cell );
+ cellSelection( clip->uuid() );
}
void MediaListView::cellSelection( const QUuid& uuid )
diff --git a/src/Library/MediaContainer.cpp b/src/Library/MediaContainer.cpp
index c81d748..43eef54 100644
--- a/src/Library/MediaContainer.cpp
+++ b/src/Library/MediaContainer.cpp
@@ -48,11 +48,11 @@ MediaContainer::addMedia( Media *media )
emit newClipLoaded( media->baseClip() );
}
-bool
+Media*
MediaContainer::addMedia( const QFileInfo& fileInfo, const QString& uuid )
{
if ( QFile::exists( fileInfo.absoluteFilePath() ) == false )
- return false;
+ return NULL;
Media* media = new Media( fileInfo.filePath(), uuid );
foreach( Clip* it, m_clips.values() )
@@ -60,12 +60,12 @@ MediaContainer::addMedia( const QFileInfo& fileInfo, const QString& uuid )
if ( it->getMedia()->fileInfo()->filePath() == media->fileInfo()->filePath() )
{
delete media;
- return false;
+ return NULL;
}
}
MetaDataManager::getInstance()->computeMediaMetadata( media );
addMedia( media );
- return true;
+ return media;
}
bool
diff --git a/src/Library/MediaContainer.h b/src/Library/MediaContainer.h
index 4ac496d..2d9a9cf 100644
--- a/src/Library/MediaContainer.h
+++ b/src/Library/MediaContainer.h
@@ -64,7 +64,7 @@ public:
* \sa media( const QUuid& uuid)
* \sa clip( const QUuid& uuid )
*/
- bool addMedia( const QFileInfo& fileInfo, const QString& uuid = QString() );
+ Media* addMedia( const QFileInfo& fileInfo, const QString& uuid = QString() );
/**
* \brief Check if a file has already been loaded into library.
* \param fileInfo The file infos
diff --git a/src/Media/Clip.cpp b/src/Media/Clip.cpp
index 2c1ca54..445d31a 100644
--- a/src/Media/Clip.cpp
+++ b/src/Media/Clip.cpp
@@ -103,6 +103,12 @@ Clip::getMedia()
return m_media;
}
+const Media*
+Clip::getMedia() const
+{
+ return m_media;
+}
+
qint64
Clip::length() const
{
diff --git a/src/Media/Clip.h b/src/Media/Clip.h
index 3dadddc..58f39fe 100644
--- a/src/Media/Clip.h
+++ b/src/Media/Clip.h
@@ -86,6 +86,7 @@ class Clip : public QObject
\return Returns the Media that the clip was basep uppon.
*/
Media* getMedia();
+ const Media* getMedia() const;
Clip *getParent();
const Clip *getParent() const;
More information about the Vlmc-devel
mailing list