Commit e475f432 authored by Hugo Beauzee-Luyssen's avatar Hugo Beauzee-Luyssen

Removed class that belonged only to the old library.

parent 2b2cd492
......@@ -25,9 +25,7 @@ HEADERS += About.h \
ImportMediaListController.h \
LanguagePreferences.h \
LCDTimecode.h \
ListViewMediaItem.h \
MainWindow.h \
MediaListWidget.h \
PreviewRuler.h \
PreviewWidget.h \
TagWidget.h \
......@@ -53,9 +51,7 @@ SOURCES += About.cpp \
ImportMediaListController.cpp \
LanguagePreferences.cpp \
LCDTimecode.cpp \
ListViewMediaItem.cpp \
MainWindow.cpp \
MediaListWidget.cpp \
PreviewRuler.cpp \
PreviewWidget.cpp \
TagWidget.cpp \
......
/*****************************************************************************
* ListViewMediaItem.cpp: VLMC LibraryWidget
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@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 "ListViewMediaItem.h"
#include <QPixmap>
#include <QDebug>
#include <QTime>
#define MAX_NAME_LENGTH 10
ListViewMediaItem::ListViewMediaItem( Clip* clip, Media::FileType fType, QListWidget* parent, int type ) :
QListWidgetItem( parent, type ), m_clip ( clip )
{
m_fileType = fType;
setIcon( QIcon( ":/images/images/vlmc.png") );
m_truncatedName = clip->getParent()->getFileName();
if ( m_truncatedName.length() > MAX_NAME_LENGTH )
{
m_truncatedName.truncate( MAX_NAME_LENGTH - 3 );
m_truncatedName += "...";
}
setText( m_truncatedName );
setIcon( QIcon( m_clip->getParent()->getSnapshot() ) );
QTime length;
length = length.addSecs( m_clip->getLengthSecond() );
setToolTip( "Filename: " + clip->getParent()->getFileName() + "\n" +
"Length: " + length.toString() );
}
ListViewMediaItem::~ListViewMediaItem()
{
}
Clip* ListViewMediaItem::getClip()
{
return m_clip;
}
/*****************************************************************************
* ListViewMediaItem.h: VLMC library widget header
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@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 LISTVIEWMEDIAITEM_H
#define LISTVIEWMEDIAITEM_H
#include <QObject>
#include <QFileInfo>
#include <QListWidgetItem>
#include "Media.h"
#include "Library.h"
/**
* \class ListViewMediaItem
* \brief Items class to use inside MediaListView widget
*/
class ListViewMediaItem : public QObject, public QListWidgetItem
{
Q_OBJECT
public:
/**
* \brief Constructor
*
* \param fileInfo the QFileInfo refering to the file
* \param fType the type of the media
* \param parent parent widget
* \param type
*/
ListViewMediaItem( Clip* media, Media::FileType fType, QListWidget* parent = 0, int type = Type );
/**
* \brief Destructor
*/
virtual ~ListViewMediaItem();
/**
* \brief Getter for filetype
* \return filetype of the item
*/
Media::FileType getFileType() const { return m_fileType; }
Clip* getClip();
//void setInputMedia( InputMedia* inputMedia ) { m_inputMedia = inputMedia; }
private:
/**
* \brief fileType member
*/
Media::FileType m_fileType;
/**
* \Instance of the InputMedia
*/
Clip* m_clip;
/**
* The truncated name of the media
*/
QString m_truncatedName;
};
#endif /* !LISTVIEWMEDIAITEM_H */
......@@ -34,7 +34,6 @@
#include <QStringList>
#include "MainWindow.h"
#include "MediaListWidget.h"
#include "Library.h"
#include "Timeline.h"
#include "About.h"
......@@ -393,13 +392,6 @@ void MainWindow::registerWidgetInWindowMenu( QDockWidget* widget )
m_ui.menuWindow->addAction( widget->toggleViewAction() );
}
void MainWindow::mediaListItemDoubleClicked( QListWidgetItem* qItem )
{
ListViewMediaItem* item = static_cast<ListViewMediaItem*>( qItem );
ClipProperty* mp = new ClipProperty( item->getClip(), this );
mp->show();
}
void MainWindow::toolButtonClicked( int id )
{
emit toolChanged( (ToolButtons)id );
......
......@@ -36,7 +36,6 @@
#include "Timeline.h"
#include "WorkflowFileRenderer.h"
#include "PreviewWidget.h"
#include "ListViewMediaItem.h"
#include "Settings.h"
#include "EffectsEngine.h"
#include "MainWorkflow.h"
......@@ -93,7 +92,6 @@ private slots:
void on_actionHelp_triggered();
void on_actionProject_Preferences_triggered();
void on_actionProject_Wizard_triggered();
void mediaListItemDoubleClicked( QListWidgetItem* );
void toolButtonClicked( int id );
signals:
......
/*****************************************************************************
* MediaListWidget.cpp: Multimedia list widget
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@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 <QSvgRenderer>
#include <QPainter>
#include <QUrl>
#include <QtDebug>
#include "MediaListWidget.h"
MediaListWidget::MediaListWidget( QWidget* parent ) :
QListWidget( parent ),
m_lastClicked( NULL )
{
m_svgRenderer = new QSvgRenderer( this );
setIconSize( QSize( 64, 64 ) );
setContentsMargins( 2, 2, 2, 2 );
setAcceptDrops( true );
}
void MediaListWidget::setType( Media::FileType fileType )
{
this->m_Type = fileType;
switch ( fileType )
{
case Media::Audio:
m_svgRenderer->load( QString( ":/images/scalable/audio-scalable" ) );
break;
case Media::Image:
m_svgRenderer->load( QString( ":/images/scalable/image-scalable" ) );
break;
case Media::Video:
m_svgRenderer->load( QString( ":/images/scalable/video-scalable" ) );
break;
}
}
void MediaListWidget::mousePressEvent( QMouseEvent* event )
{
if ( event->button() == Qt::LeftButton)
this->m_dragStartPos = event->pos();
QListWidget::mousePressEvent( event );
ListViewMediaItem* item = static_cast<ListViewMediaItem*>( currentItem() );
if ( item == NULL )
return ;
if ( item->getClip() != m_lastClicked )
{
m_lastClicked = item->getClip();
emit selectedClipChanged( m_lastClicked );
}
}
void MediaListWidget::mouseMoveEvent( QMouseEvent* event )
{
if ( currentItem() == NULL )
return;
if ( !( event->buttons() & Qt::LeftButton ) )
return;
if ( ( event->pos() - m_dragStartPos ).manhattanLength()
< QApplication::startDragDistance() )
return;
ListViewMediaItem* item = static_cast<ListViewMediaItem*>( currentItem() );
QMimeData* mimeData = new QMimeData;
//FIXME the second argument is a media UUID instead of a Clip
// and this is not logical... but it works.
mimeData->setData( "vlmc/uuid", item->getClip()->getParent()->getUuid().toString().toAscii() );
QDrag* drag = new QDrag( this );
drag->setMimeData( mimeData );
const QPixmap& dragPixmap = static_cast<ListViewMediaItem*>( currentItem() )->getClip()->getParent()->getSnapshot();
drag->setPixmap( dragPixmap.scaled( 100, 100, Qt::KeepAspectRatio ) );
drag->exec( Qt::CopyAction | Qt::MoveAction, Qt::CopyAction );
}
void MediaListWidget::paintEvent( QPaintEvent* event )
{
QPainter painter( viewport() );
painter.setOpacity( 0.2 );
if ( m_svgRenderer->isValid() )
{
QRect destRect = viewport()->rect();
QRect viewportRect = viewport()->rect();
QSize svgRect = m_svgRenderer->defaultSize();
qreal wRatio = (qreal)viewportRect.width() / (qreal)svgRect.width();
qreal hRatio = (qreal)viewportRect.height() / (qreal)svgRect.height();
if ( wRatio < hRatio )
{
destRect.setWidth( viewportRect.width() );
destRect.setHeight( ( int ) ( svgRect.height() * wRatio ) );
}
else
{
destRect.setWidth( ( int ) ( svgRect.width() * hRatio ) );
destRect.setHeight( viewportRect.height() );
}
int x = ( viewportRect.width() / 2 ) - ( destRect.width() / 2 );
int y = ( viewportRect.height() / 2 ) - ( destRect.height() / 2 );
destRect.setCoords( x, y, x + destRect.width(), y + destRect.height() );
m_svgRenderer->render( &painter, destRect );
}
QListWidget::paintEvent( event );
}
void MediaListWidget::unsetSelectedClip()
{
emit selectedClipChanged( NULL );
}
/*****************************************************************************
* MediaListWidget.h: Multimedia list widget
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Christophe Courtaut <christophe.courtaut@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 MEDIALISTWIDGET_H
#define MEDIALISTWIDGET_H
#include <QListWidget>
#include <QMouseEvent>
#include <QPoint>
#include <QMimeData>
#include <QDrag>
#include <QApplication>
#include <QSvgRenderer>
#include "ListViewMediaItem.h"
#include "Clip.h"
class MediaListWidget : public QListWidget
{
Q_OBJECT
public:
MediaListWidget( QWidget* parent = 0 );
void setType( Media::FileType fileType );
void unsetSelectedClip();
protected:
virtual void mousePressEvent( QMouseEvent* event );
virtual void mouseMoveEvent( QMouseEvent* event );
virtual void paintEvent( QPaintEvent* event );
private:
Media::FileType m_Type;
QPoint m_dragStartPos;
QSvgRenderer* m_svgRenderer;
Clip* m_lastClicked;
signals:
void selectedClipChanged( Clip* newClip );
};
#endif // MEDIALISTWIDGET_H
......@@ -26,7 +26,6 @@
#include <QMetaMethod>
#include "PreviewWidget.h"
#include "ui_PreviewWidget.h"
#include "MediaListWidget.h"
#include "Library.h"
PreviewWidget::PreviewWidget( GenericRenderer* genericRenderer, QWidget *parent ) :
......
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