Commit 474885fa authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

Adding a ClipMetadataDisplayer to display.... metadata.

This intend to avoid duplicated code between the ClipProperty widget and
the ImportController.
Second step will be to adjust what's displayed, depending on the file
type. IE: Displaying FPS for an audio file is silly.
parent 8c75cc25
......@@ -106,6 +106,7 @@ INCLUDE_DIRECTORIES(
Gui
Gui/import
Gui/library
Gui/media
Gui/preview
Gui/settings
Gui/timeline
......@@ -162,6 +163,7 @@ ELSE(NOT WITH_GUI)
Gui/library/StackViewController.cpp
Gui/library/StackViewNavController.cpp
Gui/media/GuiMedia.cpp
Gui/media/ClipMetadataDisplayer.cpp
Gui/project/GuiProjectManager.cpp
Gui/preview/PreviewRuler.cpp
Gui/preview/PreviewWidget.cpp
......@@ -212,6 +214,7 @@ ELSE(NOT WITH_GUI)
Gui/library/StackViewNavController.h
Gui/library/ViewController.h
Gui/MainWindow.h
Gui/media/ClipMetadataDisplayer.h
Gui/media/GuiMedia.h
Gui/preview/LCDTimecode.h
Gui/preview/PreviewRuler.h
......@@ -260,6 +263,7 @@ ELSE(NOT WITH_GUI)
Gui/ui/ClipProperty.ui
Gui/ui/IntroDialog.ui
Gui/ui/MainWindow.ui
Gui/media/ui/ClipMetadataDisplayer.ui
Gui/preview/ui/PreviewWidget.ui
Gui/import/ui/TagWidget.ui
Gui/ui/Timeline.ui
......
......@@ -20,15 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
#include "ClipProperty.h"
#include "ui_ClipProperty.h"
#include "Media.h"
#include "Clip.h"
#include "ClipMetadataDisplayer.h"
#include "Media.h"
#include <QTime>
#include <QPushButton>
#include <QInputDialog>
#include <QPushButton>
#include <QRegExp>
ClipProperty::ClipProperty( Clip* clip, QWidget *parent ) :
......@@ -36,29 +36,13 @@ ClipProperty::ClipProperty( Clip* clip, QWidget *parent ) :
ui( new Ui::ClipProperty ),
m_clip( clip )
{
QTime duration;
duration = duration.addSecs( m_clip->lengthSecond() );
ui->setupUi(this);
connect( this, SIGNAL( accepted() ), this, SLOT( deleteLater() ) );
connect( this, SIGNAL( rejected() ), this, SLOT( deleteLater() ) );
//Duration
ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) );
//Filename || title
ui->nameValueLabel->setText( m_clip->getMedia()->fileInfo()->fileName() );
setWindowTitle( m_clip->getMedia()->fileInfo()->fileName() + " " + tr( "properties" ) );
//Resolution
ui->resolutionValueLabel->setText( QString::number( m_clip->getMedia()->width() )
+ " x " + QString::number( m_clip->getMedia()->height() ) );
//FPS
ui->fpsValueLabel->setText( QString::number( m_clip->getMedia()->fps() ) );
//Snapshot
ui->snapshotLabel->setPixmap( m_clip->getMedia()->snapshot().scaled( 128, 128, Qt::KeepAspectRatio ) );
//nb tracks :
ui->nbVideoTracksValueLabel->setText(
QString::number( m_clip->getMedia()->nbVideoTracks() ) );
ui->nbAudioTracksValueLabel->setText(
QString::number( m_clip->getMedia()->nbAudioTracks() ) );
//Metatags
const QPushButton* button = ui->buttonBox->button( QDialogButtonBox::Apply );
Q_ASSERT( button != NULL);
......@@ -72,6 +56,8 @@ ClipProperty::ClipProperty( Clip* clip, QWidget *parent ) :
connect( ui->addTagsButton, SIGNAL( clicked() ), this, SLOT( addTagsRequired() ) );
connect( ui->deleteTagsButton, SIGNAL( clicked() ), this, SLOT( removeTagsRequired() ) );
new ClipMetadataDisplayer( clip, ui->metadataContainer );
}
ClipProperty::~ClipProperty()
......@@ -79,7 +65,8 @@ ClipProperty::~ClipProperty()
delete ui;
}
void ClipProperty::changeEvent( QEvent *e )
void
ClipProperty::changeEvent( QEvent *e )
{
QDialog::changeEvent( e );
switch ( e->type() )
......@@ -92,13 +79,15 @@ void ClipProperty::changeEvent( QEvent *e )
}
}
void ClipProperty::apply()
void
ClipProperty::apply()
{
m_clip->setNotes( ui->annotationInput->toPlainText() );
m_clip->setMetaTags( m_model->stringList() );
}
void ClipProperty::addTagsRequired()
void
ClipProperty::addTagsRequired()
{
bool ok;
QString newTags = QInputDialog::getText( this, tr( "New tags edition" ),
......@@ -114,9 +103,10 @@ void ClipProperty::addTagsRequired()
}
}
void ClipProperty::removeTagsRequired()
void
ClipProperty::removeTagsRequired()
{
QItemSelectionModel* selected = ui->metaTagsView->selectionModel();
QItemSelectionModel *selected = ui->metaTagsView->selectionModel();
QModelIndexList listSelected = selected->selectedIndexes();
QStringList list = m_model->stringList();
while ( listSelected.empty() == false )
......
/*****************************************************************************
* ClipMetadataDisplayer.cpp: Display the basic metadata about a clip.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@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 "ClipMetadataDisplayer.h"
#include "Clip.h"
#include "Media.h"
#include <QTime>
ClipMetadataDisplayer::ClipMetadataDisplayer( Clip *clip, QWidget *parent /*= NULL*/ ) :
QWidget( parent ),
m_ui( new Ui::ClipMetadataDisplayer ),
m_watchedClip( clip )
{
m_ui->setupUi( this );
m_watchedMedia = clip->getMedia();
if ( m_watchedMedia->isMetadataComputed() == true )
metadataUpdated( m_watchedMedia );
else
{
connect( m_watchedMedia, SIGNAL( metaDataComputed(const Media*) ),
this, SLOT( metadataUpdated( const Media*) ) );
}
}
void
ClipMetadataDisplayer::metadataUpdated( const Media *media )
{
QTime duration;
duration = duration.addSecs( m_watchedClip->lengthSecond() );
//Duration
m_ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) );
//Filename || title
m_ui->nameValueLabel->setText( media->fileInfo()->fileName() );
//Resolution
m_ui->resolutionValueLabel->setText( QString::number( media->width() )
+ " x " + QString::number( media->height() ) );
//FPS
m_ui->fpsValueLabel->setText( QString::number( media->fps() ) );
//nb tracks :
m_ui->nbVideoTracksValueLabel->setText( QString::number( media->nbVideoTracks() ) );
m_ui->nbAudioTracksValueLabel->setText( QString::number( media->nbAudioTracks() ) );
}
/*****************************************************************************
* ClipMetadataDisplayer.h: Display the basic metadata about a clip.
*****************************************************************************
* Copyright (C) 2008-2010 VideoLAN
*
* Authors: Hugo Beauzée-Luyssen <beauze.h@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 CLIPMETADATADISPLAYER_H
#define CLIPMETADATADISPLAYER_H
#include <QWidget>
class Clip;
class Media;
#include "ui_ClipMetadataDisplayer.h"
class ClipMetadataDisplayer : public QWidget
{
Q_OBJECT
Q_DISABLE_COPY(ClipMetadataDisplayer);
public:
explicit ClipMetadataDisplayer( Clip* clip, QWidget *parent = 0 );
private:
Ui::ClipMetadataDisplayer *m_ui;
Clip *m_watchedClip;
Media *m_watchedMedia;
private slots:
void metadataUpdated( const Media *media );
};
#endif // CLIPMETADATADISPLAYER_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ClipMetadataDisplayer</class>
<widget class="QWidget" name="ClipMetadataDisplayer">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>312</width>
<height>171</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Media Properties</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameValueLabel">
<property name="text">
<string>unnamed</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="durationLabel">
<property name="text">
<string>Duration</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="durationValueLabel">
<property name="text">
<string>---</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="resolutionLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="resolutionValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>---</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="fpsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FPS</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="fpsValueLabel">
<property name="text">
<string>---</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="nbVideoTracks">
<property name="text">
<string>Number of video tracks</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="nbAudioTracks">
<property name="text">
<string>Number of audio tracks</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="nbAudioTracksValueLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="nbVideoTracksValueLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>450</width>
<height>313</height>
<width>522</width>
<height>388</height>
</rect>
</property>
<property name="windowTitle">
......@@ -70,123 +70,6 @@
</property>
</spacer>
</item>
<item row="0" column="5" colspan="2">
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Media Properties</string>
</property>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="nameLabel">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="nameValueLabel">
<property name="text">
<string>unnamed</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="durationLabel">
<property name="text">
<string>Duration</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="durationValueLabel">
<property name="text">
<string>0s</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="resolutionLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Resolution</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="resolutionValueLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>0px. x 0px.</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="fpsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FPS</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="fpsValueLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="nbVideoTracks">
<property name="text">
<string>Number of video tracks</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="nbAudioTracks">
<property name="text">
<string>Number of audio tracks</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="nbVideoTracksValueLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QLabel" name="nbAudioTracksValueLabel">
<property name="text">
<string>0</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
......@@ -268,6 +151,22 @@
</property>
</widget>
</item>
<item row="0" column="6">
<widget class="QWidget" name="metadataContainer" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
......
......@@ -40,13 +40,13 @@
WorkflowRenderer::WorkflowRenderer() :
m_mainWorkflow( MainWorkflow::getInstance() ),
m_media( NULL ),
m_stopping( false ),
m_outputFps( 0.0f ),
m_media( NULL ),
m_esHandler( NULL ),
m_width( 0 ),
m_height( 0 ),
m_silencedAudioBuffer( NULL ),
m_esHandler( NULL ),
m_oldLength( 0 )
{
}
......
......@@ -89,7 +89,7 @@ ImageClipWorkflow::getOutput( ClipWorkflow::GetMode )
}
void
ImageClipWorkflow::lock(ImageClipWorkflow *cw, void **pp_ret, int size )
ImageClipWorkflow::lock(ImageClipWorkflow *cw, void **pp_ret, int )
{
cw->m_renderLock->lock();
if ( cw->m_buffer == NULL )
......@@ -109,7 +109,7 @@ ImageClipWorkflow::unlock(ImageClipWorkflow *cw, void*, int, int, int, int, qint
cw->emit computedFinished();
}
uint32_t
quint32
ImageClipWorkflow::getNbComputedBuffers() const
{
QMutexLocker lock( m_renderLock );
......@@ -119,7 +119,7 @@ ImageClipWorkflow::getNbComputedBuffers() const
return 0;
}
uint32_t
quint32
ImageClipWorkflow::getMaxComputedBuffers() const
{
return 1;
......
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