Commit 329ed3e6 authored by Geoffroy Lacarriere's avatar Geoffroy Lacarriere
Browse files

Merge commit 'origin/master' into geoff_import

Conflicts:
	src/GUI/MainWindow.h
	src/GUI/ui/MainWindow.ui
	src/Media/Media.cpp
	src/Media/Media.h
	vlmc.pro
parents 7726a12e 8484c3db
......@@ -5,9 +5,14 @@ tombe a l'eau. Qui reste-t-il ?
16:20 < chouquette> putain il a marche la dedans ?!
16:20 < etix> j'y crois pas...
---
09:37 < JakeSays> i believe python was designed by someone missing his right
little finger.
09:38 < chouquette> JakeSays: I've a screwed up right little finger and I
wouldn't dare come up with something like python
09:38 < chouquette> I still have some kind of self esteem
---
23:57:50 < Apocalypse_555> sorry my english is execrable
......@@ -19,6 +19,10 @@
<file>images/add.png</file>
<file>images/marker_left.png</file>
<file>images/marker_right.png</file>
<file alias="editcut">images/editcut.png</file>
<file alias="mouse">images/mouse.png</file>
<file alias="zoomin">images/zoom_in.png</file>
<file alias="zoomout">images/zoom_out.png</file>
</qresource>
<qresource prefix="/text" >
<file>AUTHORS</file>
......
......@@ -86,7 +86,7 @@ void Commands::MainWorkflow::RemoveClips::undo()
}
Commands::MainWorkflow::ResizeClip::ResizeClip( ::MainWorkflow* mainWorkflow, const QUuid& uuid, unsigned int trackId,
float newBegin, float newEnd ) :
qint64 newBegin, qint64 newEnd ) :
m_mainWorkflow( mainWorkflow ),
m_newBegin( newBegin ),
m_newEnd( newEnd )
......
......@@ -93,15 +93,15 @@ namespace Commands
{
public:
ResizeClip( ::MainWorkflow* mainWorkflow, const QUuid& uuid, unsigned int trackId,
float newBegin, float newEnd );
qint64 newBegin, qint64 newEnd );
virtual void redo();
virtual void undo();
private:
::MainWorkflow* m_mainWorkflow;
float m_oldBegin;
float m_oldEnd;
float m_newBegin;
float m_newEnd;
qint64 m_oldBegin;
qint64 m_oldEnd;
qint64 m_newBegin;
qint64 m_newEnd;
Clip* m_clip;
};
}
......
/*****************************************************************************
* SettingsManager.cpp * : Backend settings manager
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Clement CHAVANCE <kinder@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.
*****************************************************************************/
#include <QHash>
#include "SettingsManager.h"
int SettingsManager::createNewSettings()
{
this->m_settings.append(new SettingsContainer());
return this->m_settings.size() - 1;
}
SettingsManager::SettingsManager( QObject* parent )
: QObject( parent )
{
}
SettingsManager::~SettingsManager()
{
}
void SettingsManager::saveSettings( QDomDocument& xmlfile, int index )
{
Q_UNUSED( xmlfile )
SettingsContainer* settings = m_settings[index];
settings->lock.lockForRead();
//SAVE SETTINGS TO DomDocument
settings->lock.unlock();
}
/*****************************************************************************
* SettingsManager.h: Backend settings manager
*****************************************************************************
* Copyright (C) 2008-2009 the VLMC team
*
* Authors: Clement CHAVANCE <kinder@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 SETTINGSMANAGER_H
#define SETTINGSMANAGER_H
#include <QObject>
#include <QVector>
#include <QHash>
#include <QReadWriteLock>
#include <QString>
#include <QVariant>
#include <QDomDocument>
#include "QSingleton.hpp"
struct SettingsContainer
{
QReadWriteLock lock;
QHash<QString, QVariant> settings;
};
class SettingsManager : public QObject, public QSingleton<SettingsManager>
{
//Q_OBJECT
//
friend class QSingleton<SettingsManager>;
public:
int createNewSettings();
void setValues( QHash<QString, QVariant>, int index );
void setValue( const QString& key, QVariant& value, int index );
QVariant& getValue( const QString& key );
private:
SettingsManager( QObject* parent = 0 );
~SettingsManager();
QVector<SettingsContainer*> m_settings;
public slots:
void saveSettings( QDomDocument& xmlfile, int index );
};
#endif
......@@ -25,7 +25,7 @@
AbstractGraphicsMediaItem::AbstractGraphicsMediaItem() :
oldTrackNumber( -1 ), oldPosition( -1 ), m_tracksView( NULL )
{
setCursor( Qt::OpenHandCursor );
}
TracksView* AbstractGraphicsMediaItem::tracksView()
......@@ -33,16 +33,6 @@ TracksView* AbstractGraphicsMediaItem::tracksView()
return m_tracksView;
}
void AbstractGraphicsMediaItem::mousePressEvent( QGraphicsSceneMouseEvent* )
{
setCursor( Qt::ClosedHandCursor );
}
void AbstractGraphicsMediaItem::mouseReleaseEvent( QGraphicsSceneMouseEvent* )
{
setCursor( Qt::OpenHandCursor );
}
quint32 AbstractGraphicsMediaItem::trackNumber()
{
if ( parentItem() )
......
......@@ -69,9 +69,6 @@ protected:
*/
qint64 oldPosition;
virtual void mousePressEvent( QGraphicsSceneMouseEvent* event );
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
private:
/// This pointer will be set when inserted in the tracksView.
TracksView* m_tracksView;
......
......@@ -24,24 +24,21 @@
#include "QDebug"
AudioProjectPreferences::AudioProjectPreferences( QWidget *parent ) :
QWidget( parent )
AudioProjectPreferences::AudioProjectPreferences( QWidget *parent )
: PreferenceWidget( parent )
{
this->setWidget( this );
m_ui.setupUi( this );
m_ui.setupUi( this );
}
AudioProjectPreferences::~AudioProjectPreferences() { }
bool AudioProjectPreferences::load()
{
qDebug() << "Loading AudioProjectPreferences values";
return true;
qDebug() << "Loading AudioProjectPreferences values";
return true;
}
void AudioProjectPreferences::save( QSettings& settings )
void AudioProjectPreferences::save( QHash<QString, QVariant>& settings )
{
settings.beginGroup( "Project" );
//settings.setValue( "outputFPS", m_ui.outputFPS->text() );
settings.endGroup();
settings.insert( "AudioSampleRate", m_ui.SampleRate->value() );
}
......@@ -28,14 +28,14 @@
#include "PreferenceWidget.h"
#include "ui_AudioProjectPreferences.h"
class AudioProjectPreferences : public QWidget, public PreferenceWidget
class AudioProjectPreferences : public PreferenceWidget
{
//Q_OBJECT
public:
AudioProjectPreferences(QWidget *parent = 0);
AudioProjectPreferences( QWidget *parent = 0 );
~AudioProjectPreferences();
bool load();
void save( QSettings& settings );
void save( QHash<QString, QVariant>& settings );
private:
Ui::AudioProjectPreferences m_ui;
};
......
......@@ -55,8 +55,9 @@ void DockWidgetManager::addDockedWidget( QWidget *widget,
dock->setWidget( widget );
dock->setAllowedAreas( areas );
dock->setFeatures( features );
dock->setObjectName( qs_name );
m_mainWin->addDockWidget( startArea, dock );
m_mainWin->registerWidgetInViewMenu( dock );
m_mainWin->registerWidgetInWindowMenu( dock );
widget->show();
}
......
......@@ -44,6 +44,6 @@ void GraphicsCursorItem::setCursorPos( qint64 position )
void GraphicsCursorItem::setHeight( int height )
{
prepareGeometryChange();
m_boundingRect.setHeight( height );
update();
}
......@@ -35,9 +35,15 @@ GraphicsMovieItem::GraphicsMovieItem( Clip* clip ) : m_clip( clip ), m_width( 0
QTime length = QTime().addMSecs( clip->getParent()->getLength() );
QString tooltip( tr( "<p style='white-space:pre'><b>Name:</b> %1"
"<br><b>Length:</b> %2" )
.arg( clip->getParent()->getFileInfo()->fileName() )
.arg( clip->getParent()->getFileName() )
.arg( length.toString("hh:mm:ss.zzz") ) );
setToolTip( tooltip );
setAcceptHoverEvents( true );
// Adjust the width
setWidth( clip->getLength() );
// Automatically adjust future changes
connect( clip, SIGNAL( lengthUpdated() ), this, SLOT( adjustLength() ) );
}
GraphicsMovieItem::~GraphicsMovieItem()
......@@ -59,21 +65,33 @@ void GraphicsMovieItem::paint( QPainter* painter, const QStyleOptionGraphicsItem
paintTitle( painter, option );
painter->restore();
/* buggy code
painter->save();
paintAudioSpectrum( painter );
painter->restore();
*/
}
void GraphicsMovieItem::setWidth( int width )
{
prepareGeometryChange();
m_width = width;
}
void GraphicsMovieItem::setHeight( int height )
{
prepareGeometryChange();
m_height = height;
}
void GraphicsMovieItem::adjustLength()
{
//FIXME implement clip expanding.
Q_ASSERT_X( m_clip->getLength() <= m_width, "adjustLength", "Clip expanding not supported!" );
prepareGeometryChange();
setWidth( m_clip->getLength() );
}
void GraphicsMovieItem::paintAudioSpectrum( QPainter* painter )
{
qreal x1, x2, y1, y2;
......@@ -200,7 +218,7 @@ void GraphicsMovieItem::paintTitle( QPainter* painter, const QStyleOptionGraphic
// Initiate the font metrics calculation
QFontMetrics fm( painter->font() );
QString text = m_clip->getParent()->getFileInfo()->fileName();
QString text = m_clip->getParent()->getFileName();
// Get the transformations required to map the text on the viewport
QTransform viewPortTransform = Timeline::getInstance()->tracksView()->viewportTransform();
......@@ -212,3 +230,45 @@ void GraphicsMovieItem::paintTitle( QPainter* painter, const QStyleOptionGraphic
painter->setPen( Qt::white );
painter->drawText( mapped, Qt::AlignVCenter, fm.elidedText( text, Qt::ElideRight, mapped.width() ) );
}
void GraphicsMovieItem::hoverEnterEvent( QGraphicsSceneHoverEvent* event )
{
TracksView* tv = Timeline::getInstance()->tracksView();
if ( tv )
{
switch ( tv->tool() )
{
case TOOL_DEFAULT:
setCursor( Qt::OpenHandCursor );
break;
case TOOL_CUT:
setCursor( QCursor( QPixmap( ":/images/editcut" ) ) );
break;
}
}
AbstractGraphicsMediaItem::hoverEnterEvent( event );
}
void GraphicsMovieItem::hoverLeaveEvent( QGraphicsSceneHoverEvent* event )
{
AbstractGraphicsMediaItem::hoverLeaveEvent( event );
}
void GraphicsMovieItem::mousePressEvent( QGraphicsSceneMouseEvent* event )
{
TracksView* tv = Timeline::getInstance()->tracksView();
if ( tv->tool() == TOOL_DEFAULT )
setCursor( Qt::ClosedHandCursor );
else
emit split( this, qRound64( event->pos().x() ) );
}
void GraphicsMovieItem::mouseReleaseEvent( QGraphicsSceneMouseEvent* event )
{
Q_UNUSED( event );
TracksView* tv = Timeline::getInstance()->tracksView();
if ( tv->tool() == TOOL_DEFAULT )
setCursor( Qt::OpenHandCursor );
}
......@@ -51,19 +51,28 @@ public:
void setWidth( int width );
void setHeight( int height );
Clip* clip() const;
void setClip( Clip* clip );
//void setAudioSpectrum( QVector<float*> spectrum );
void paintAudioSpectrum( QPainter* painter );
protected:
void paintRect( QPainter* painter, const QStyleOptionGraphicsItem* option );
void paintTitle( QPainter* painter, const QStyleOptionGraphicsItem* option );
virtual void hoverEnterEvent( QGraphicsSceneHoverEvent* event );
virtual void hoverLeaveEvent( QGraphicsSceneHoverEvent* event );
virtual void mousePressEvent( QGraphicsSceneMouseEvent* event );
virtual void mouseReleaseEvent( QGraphicsSceneMouseEvent* event );
private slots:
void adjustLength();
private:
Clip* m_clip;
int m_width;
int m_height;
QVector<float*> m_audioSpectrum;
signals:
void split( GraphicsMovieItem* self, qint64 frame );
};
#endif // GRAPHICSMOVIEITEM_H
......@@ -25,6 +25,7 @@
#include <QGraphicsWidget>
#include <QPainter>
#include <QDebug>
class GraphicsTrack : public QGraphicsWidget
{
......@@ -37,33 +38,64 @@ public:
Video,
Audio
};
GraphicsTrack( MediaType type, quint32 trackNumber, QGraphicsItem* parent = 0 ) : QGraphicsWidget( parent )
{
m_type = type;
m_trackNumber = trackNumber;
setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed );
setContentsMargins( 0, 0, 0, 0 );
setZValue( 1 );
}
void setHeight( int height )
{
setPreferredHeight( height );
adjustSize();
updateGeometry();
}
int height()
{
return preferredHeight();
}
quint32 trackNumber()
{
return m_trackNumber;
}
virtual int type() const { return Type; }
protected:
virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem*, QWidget* = 0 )
{
Q_UNUSED( painter );
/*
Debugging of tracks.
Do not remove this block.
if ( m_type == Video )
painter->setBrush( Qt::green );
else
painter->setBrush( Qt::blue );
painter->setPen( Qt::transparent );
painter->drawRect( rect() );
*/
painter->setMatrixEnabled( false );
if ( m_trackNumber == 0 )
{
QString text;
switch ( m_type )
{
case Video:
text = tr( "Video" );
break;
case Audio:
text = tr( "Audio" );
break;
}
QRectF mapped = mapRectToScene( boundingRect() ).adjusted( 10, 1, 0, 0 );
QFont textFont;
textFont.setItalic( true );
textFont.setBold( true );
textFont.setPixelSize( mapped.height() + 12 );
painter->setPen( QPen( palette().window().color().lighter( 125 ) ) );
painter->setFont( textFont );
painter->drawText( mapped, Qt::AlignVCenter, text );
}
}
private:
......
......@@ -32,9 +32,11 @@ Import::Import(QWidget *parent) :
m_ui->setupUi( this );
m_importBrowser = new ImportBrowser( m_ui->ImportBrowserWidget );
m_previewWidget = new PreviewWidget( new ClipRenderer, m_ui->PreviewWidget );
m_tagWidget = new TagWidget( m_ui->TagWidget, 6 );
m_ui->ImportBrowserWidget = m_importBrowser;
m_ui->PreviewWidget = m_previewWidget;
m_ui->TagWidget = m_tagWidget;
connect( m_importBrowser, SIGNAL( mediaSelected( QFileInfo ) ), this, SLOT( getMetaData( QFileInfo ) ) );
}
......@@ -47,6 +49,7 @@ Import::~Import()
delete m_metaDataWorker;
delete m_importBrowser;
delete m_previewWidget;
delete m_tagWidget;
}
void Import::getMetaData( QFileInfo fileInfos )
......@@ -64,6 +67,8 @@ void Import::setUIMetaData()
m_currentClip = new Clip( m_currentMedia );
connect( this, SIGNAL( mediaSelected( Clip* ) ), m_previewWidget->getGenericRenderer(), SLOT( setClip( Clip* ) ) );
connect( this, SIGNAL( mediaSelected( Media* ) ), m_tagWidget, SLOT( mediaSelected( Media* ) ) );
emit mediaSelected( m_currentMedia );
//Duration
QTime duration;
......
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