Commit 0ea647d0 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Added a media properties window

Cleaned MetaDataManager/Worker code, removed renderWidget, avoiding to permanent warning.
parent 01ee799c
......@@ -39,6 +39,7 @@
#include "WorkflowRenderer.h"
#include "ClipRenderer.h"
#include "UndoStack.h"
#include "MediaProperty.h"
MainWindow::MainWindow( QWidget *parent ) :
QMainWindow( parent ), m_renderer( NULL )
......@@ -123,6 +124,8 @@ void MainWindow::setupLibrary()
m_clipPreview->getGenericRenderer(), SLOT( setMedia(const Media*) ) );
connect( Library::getInstance(), SIGNAL( mediaRemoved( const QUuid& ) ),
m_clipPreview->getGenericRenderer(), SLOT( mediaUnloaded( QUuid ) ) );
connect( libraryWidget->getVideoListWidget(), SIGNAL( itemDoubleClicked( QListWidgetItem* ) ),
this, SLOT( mediaListItemDoubleClicked( QListWidgetItem* ) ) );
}
void MainWindow::createStatusBar()
......@@ -254,3 +257,10 @@ void MainWindow::registerWidgetInViewMenu( QDockWidget* widget )
{
m_ui.menuView->addAction( widget->toggleViewAction() );
}
void MainWindow::mediaListItemDoubleClicked( QListWidgetItem* qItem )
{
ListViewMediaItem* item = static_cast<ListViewMediaItem*>( qItem );
MediaProperty* mp = new MediaProperty( item->getMedia(), this );
mp->show();
}
......@@ -34,6 +34,7 @@
#include "Timeline.h"
#include "WorkflowFileRenderer.h"
#include "PreviewWidget.h"
#include "ListViewMediaItem.h"
class MainWindow : public QMainWindow
{
......@@ -75,6 +76,7 @@ private slots:
void on_actionRender_triggered();
void on_actionNew_Project_triggered();
void on_actionOpen_Project_triggered();
void mediaListItemDoubleClicked( QListWidgetItem* );
signals:
void translateDockWidgetTitle();
......
......@@ -120,3 +120,4 @@ void MediaListWidget::paintEvent( QPaintEvent* event )
}
QListWidget::paintEvent( event );
}
#include <QtDebug>
#include <QTime>
#include "MediaProperty.h"
#include "ui_MediaProperty.h"
MediaProperty::MediaProperty( const Media* media, QWidget *parent ) :
QDialog( parent ),
ui( new Ui::MediaProperty ),
m_media( media )
{
QTime duration;
duration = duration.addMSecs( m_media->getLength() );
ui->setupUi(this);
connect( this, SIGNAL( accepted() ), this, SLOT( deleteLater() ) );
connect( this, SIGNAL( rejected() ), this, SLOT( deleteLater() ) );
ui->durationValueLabel->setText( duration.toString( "hh:mm:ss" ) );
ui->nameValueLabel->setText( m_media->getFileInfo()->fileName() );
ui->resolutionValueLabel->setText( QString::number( m_media->getWidth() )
+ " x " + QString::number( m_media->getHeight() ) );
ui->fpsValueLabel->setText( QString::number( m_media->getFps() ) );
ui->snapshotLabel->setPixmap( m_media->getSnapshot().scaled( 128, 128, Qt::KeepAspectRatio ) );
setWindowTitle( m_media->getFileInfo()->fileName() + " " + tr( "properties" ) );
}
MediaProperty::~MediaProperty()
{
delete ui;
}
void MediaProperty::changeEvent( QEvent *e )
{
QDialog::changeEvent( e );
switch ( e->type() )
{
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
/*****************************************************************************
* MediaProperty.h: Handle the media property and meta tags edition
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Hugo Beauzee-Luyssen <hugo@vlmc.org>
*
* 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 MEDIAPROPERTY_H
#define MEDIAPROPERTY_H
#include <QDialog>
#include "Media.h"
namespace Ui {
class MediaProperty;
}
class MediaProperty : public QDialog
{
Q_OBJECT
public:
MediaProperty( const Media* media, QWidget *parent = 0 );
~MediaProperty();
protected:
void changeEvent(QEvent *e);
private:
Ui::MediaProperty* ui;
const Media* m_media;
};
#endif // MEDIAPROPERTY_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>MediaProperty</class>
<widget class="QDialog" name="MediaProperty">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0" colspan="6">
<widget class="QListWidget" name="listWidget"/>
</item>
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="snapshotLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>128</width>
<height>128</height>
</size>
</property>
<property name="baseSize">
<size>
<width>256</width>
<height>256</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="4" column="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
<item row="4" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2" 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>
</layout>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>MediaProperty</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>MediaProperty</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -27,18 +27,15 @@
MetaDataManager::MetaDataManager()
{
connect( Library::getInstance(), SIGNAL( newMediaLoaded( Media* ) ),this, SLOT( newMediaLoaded( Media* ) ) );
m_renderWidget = new QWidget;
connect( Library::getInstance(), SIGNAL( newMediaLoaded( Media* ) ), this, SLOT( newMediaLoaded( Media* ) ) );
}
MetaDataManager::~MetaDataManager()
{
delete m_renderWidget;
}
void MetaDataManager::newMediaLoaded( Media* media )
{
MetaDataWorker* w = new MetaDataWorker( media );
w->setRenderWidget( m_renderWidget );
w->start();
}
......@@ -38,9 +38,6 @@ class MetaDataManager : public QObject, public Singleton<MetaDataManager>
public slots:
void newMediaLoaded( Media* );
private:
QWidget* m_renderWidget;
private:
MetaDataManager();
~MetaDataManager();
......
......@@ -40,12 +40,6 @@ MetaDataWorker::~MetaDataWorker()
delete m_mediaPlayer;
}
void MetaDataWorker::setRenderWidget( QWidget* widget )
{
m_renderWidget = widget;
m_mediaPlayer->setDrawable( m_renderWidget->winId() );
}
void MetaDataWorker::run()
{
if ( m_currentMedia->getFileType() == Media::Video )
......@@ -66,6 +60,7 @@ void MetaDataWorker::computeVideoMetaData()
{
//Disabling audio for this specific use of the media
m_currentMedia->addVolatileParam( ":no-audio", ":audio" );
m_currentMedia->addVolatileParam( ":vout=dummy", ":vout=" );
connect( m_mediaPlayer, SIGNAL( lengthChanged() ), this, SLOT( entrypointLengthChanged() ) );
}
......
......@@ -39,7 +39,6 @@ class MetaDataWorker : public QThread
public:
MetaDataWorker( Media* media );
~MetaDataWorker();
void setRenderWidget( QWidget* widget );
virtual void run();
private:
......@@ -62,7 +61,6 @@ class MetaDataWorker : public QThread
LibVLCpp::MediaPlayer* m_mediaPlayer;
Media* m_currentMedia;
QWidget* m_renderWidget;
QString m_tmpSnapshotFilename;
bool m_mediaIsPlaying;
......
......@@ -47,7 +47,8 @@ SOURCES += src/main.cpp \
src/API/ModuleManager.cpp \
src/WorkflowFileRenderer.cpp \
src/UndoStack.cpp \
src/metadata/MetaDataManager.cpp
src/metadata/MetaDataManager.cpp \
src/gui/MediaProperty.cpp
HEADERS += src/gui/MainWindow.h \
src/gui/DockWidgetManager.h \
src/gui/LibraryWidget.h \
......@@ -93,7 +94,8 @@ HEADERS += src/gui/MainWindow.h \
src/tools/Pool.hpp \
src/UndoStack.h \
src/tools/WaitCondition.hpp \
src/metadata/MetaDataManager.h
src/metadata/MetaDataManager.h \
src/gui/MediaProperty.h
FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/PreviewWidget.ui \
src/gui/ui/Preferences.ui \
......@@ -102,8 +104,9 @@ FORMS += src/gui/ui/MainWindow.ui \
src/gui/ui/About.ui \
src/gui/ui/Transcode.ui \
src/gui/ui/FileBrowser.ui \
src/gui/ui/WorkflowFileRenderer.ui
FORMS +=
src/gui/ui/WorkflowFileRenderer.ui \
src/gui/ui/MediaProperty.ui
TRANSLATIONS = ts/vlmc_es.ts \
ts/vlmc_fr.ts \
ts/vlmc_sv.ts
......
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