Commit c8a38619 authored by Vincent Carrubba's avatar Vincent Carrubba
Browse files

Master merged successfully, thanks to chouquette for his help, it works

parents 488ea5d0 b86da848
<RCC>
<qresource prefix="/Lang" >
<file alias="es" >ts/vlmc_es.qm</file>
<file alias="fr" >ts/vlmc_fr.qm</file>
<file alias="sv" >ts/vlmc_sv.qm</file>
<qresource prefix="/Lang">
<file alias="es">ts/vlmc_es.qm</file>
<file alias="fr">ts/vlmc_fr.qm</file>
<file alias="sv">ts/vlmc_sv.qm</file>
</qresource>
<qresource prefix="/images" >
<qresource prefix="/images">
<file>images/vlmc.png</file>
<file alias="play" >images/play.png</file>
<file alias="pause" >images/pause.png</file>
<file alias="back" >images/back.png</file>
<file alias="forward" >images/forward.png</file>
<file alias="up" >images/up.png</file>
<file alias="play">images/play.png</file>
<file alias="pause">images/pause.png</file>
<file alias="back">images/back.png</file>
<file alias="forward">images/forward.png</file>
<file alias="up">images/up.png</file>
<file>images/next_frame.png</file>
<file>images/previous_frame.png</file>
<file>images/stop.png</file>
......@@ -23,15 +23,21 @@
<file alias="mouse">images/mouse.png</file>
<file alias="zoomin">images/zoom_in.png</file>
<file alias="zoomout">images/zoom_out.png</file>
<file alias="trackon">images/trackon.png</file>
<file alias="trackoff">images/trackoff.png</file>
<file alias="hpon">images/hpon.png</file>
<file alias="hpoff">images/hpoff.png</file>
<file>images/audio.png</file>
<file>images/video.png</file>
</qresource>
<qresource prefix="/text" >
<qresource prefix="/text">
<file>AUTHORS</file>
<file>COPYING</file>
<file>TRANSLATORS</file>
</qresource>
<qresource prefix="/images/scalable" >
<file alias="audio-scalable" >images/scalable/audio.svg</file>
<file alias="image-scalable" >images/scalable/image.svg</file>
<file alias="video-scalable" >images/scalable/video.svg</file>
<qresource prefix="/images/scalable">
<file alias="audio-scalable">images/scalable/audio.svg</file>
<file alias="image-scalable">images/scalable/image.svg</file>
<file alias="video-scalable">images/scalable/video.svg</file>
</qresource>
</RCC>
......@@ -32,26 +32,34 @@ void Commands::trigger( QUndoCommand* command )
UndoStack::getInstance()->push( command );
}
Commands::MainWorkflow::AddClip::AddClip( ::MainWorkflow* workflow, Clip* clip, unsigned int trackNumber, qint64 pos ) :
m_workflow( workflow ), m_clip( clip ), m_trackNumber( trackNumber ), m_pos( pos )
Commands::MainWorkflow::AddClip::AddClip( ::MainWorkflow* workflow, Clip* clip,
unsigned int trackNumber, qint64 pos,
::MainWorkflow::TrackType trackType ) :
m_workflow( workflow ),
m_clip( clip ),
m_trackNumber( trackNumber ),
m_pos( pos ),
m_trackType( trackType )
{
setText( QObject::tr( "Adding clip to track %1" ).arg( QString::number( trackNumber ) ) );
}
void Commands::MainWorkflow::AddClip::redo()
{
m_workflow->addClip( m_clip, m_trackNumber, m_pos );
m_workflow->addClip( m_clip, m_trackNumber, m_pos, m_trackType );
}
void Commands::MainWorkflow::AddClip::undo()
{
m_workflow->removeClip( m_clip->getUuid(), m_trackNumber );
m_workflow->removeClip( m_clip->getUuid(), m_trackNumber, m_trackType );
}
Commands::MainWorkflow::MoveClip::MoveClip( ::MainWorkflow* workflow, const QUuid& uuid,
unsigned int oldTrack, qint64 oldPos, unsigned int newTrack, qint64 newPos ) :
unsigned int oldTrack, qint64 oldPos, unsigned int newTrack, qint64 newPos,
::MainWorkflow::TrackType trackType ) :
m_workflow( workflow ), m_uuid( uuid ), m_oldTrack( oldTrack ),
m_newTrack( newTrack ), m_pos( newPos ), m_oldPos( oldPos )
m_newTrack( newTrack ), m_pos( newPos ), m_oldPos( oldPos ),
m_trackType( trackType )
{
setText( QObject::tr( "Moving clip" ) );
m_undoRedoAction = false;
......@@ -59,13 +67,13 @@ Commands::MainWorkflow::MoveClip::MoveClip( ::MainWorkflow* workflow, const QUui
void Commands::MainWorkflow::MoveClip::redo()
{
m_workflow->moveClip( m_uuid, m_oldTrack, m_newTrack, m_pos, m_undoRedoAction );
m_workflow->moveClip( m_uuid, m_oldTrack, m_newTrack, m_pos, m_trackType, m_undoRedoAction );
m_undoRedoAction = true;
}
void Commands::MainWorkflow::MoveClip::undo()
{
m_workflow->moveClip( m_uuid, m_newTrack, m_oldTrack, m_oldPos, m_undoRedoAction );
m_workflow->moveClip( m_uuid, m_newTrack, m_oldTrack, m_oldPos, m_trackType, m_undoRedoAction );
m_undoRedoAction = true;
}
......@@ -77,21 +85,22 @@ Commands::MainWorkflow::RemoveClips::RemoveClips( ::MainWorkflow* workflow, cons
void Commands::MainWorkflow::RemoveClips::redo()
{
for (int i = 0; i < m_clips.size(); ++i )
m_workflow->removeClip( m_clips.at( i ).clip->getUuid(), m_clips.at( i ).trackNumber );
m_workflow->removeClip( m_clips.at( i ).clip->getUuid(), m_clips.at( i ).trackNumber, m_clips.at( i ).trackType );
}
void Commands::MainWorkflow::RemoveClips::undo()
{
for (int i = 0; i < m_clips.size(); ++i )
m_workflow->addClip( m_clips.at( i ).clip, m_clips.at( i ).trackNumber, m_clips.at( i ).pos );
m_workflow->addClip( m_clips.at( i ).clip, m_clips.at( i ).trackNumber, m_clips.at( i ).pos, m_clips.at( i ).trackType );
}
Commands::MainWorkflow::ResizeClip::ResizeClip( ::MainWorkflow* mainWorkflow, const QUuid& uuid, unsigned int trackId,
qint64 newBegin, qint64 newEnd ) :
qint64 newBegin, qint64 newEnd, ::MainWorkflow::TrackType trackType ) :
m_mainWorkflow( mainWorkflow ),
m_newBegin( newBegin ),
m_newEnd( newEnd )
m_newEnd( newEnd ),
m_trackType( trackType )
{
m_clip = mainWorkflow->getClip( uuid, trackId );
m_clip = mainWorkflow->getClip( uuid, trackId, m_trackType );
m_oldBegin = m_clip->getBegin();
m_oldEnd = m_clip->getEnd();
}
......
......@@ -41,40 +41,44 @@ namespace Commands
{
struct ClipActionInfo
{
Clip* clip;
quint32 trackNumber;
qint64 pos;
Clip* clip;
quint32 trackNumber;
qint64 pos;
::MainWorkflow::TrackType trackType;
};
NEW_COMMAND( AddClip )
{
public:
AddClip( ::MainWorkflow* workflow, Clip* clip, unsigned int trackNumber, qint64 pos );
AddClip( ::MainWorkflow* workflow, Clip* clip, unsigned int trackNumber, qint64 pos, ::MainWorkflow::TrackType trackType );
virtual void redo();
virtual void undo();
private:
::MainWorkflow* m_workflow;
Clip* m_clip;
unsigned int m_trackNumber;
qint64 m_pos;
::MainWorkflow* m_workflow;
Clip* m_clip;
unsigned int m_trackNumber;
qint64 m_pos;
::MainWorkflow::TrackType m_trackType;
};
NEW_COMMAND( MoveClip )
{
public:
MoveClip( ::MainWorkflow* workflow, const QUuid& uuid,
unsigned int oldTrack, qint64 oldPos, unsigned int newTrack, qint64 newPos );
unsigned int oldTrack, qint64 oldPos, unsigned int newTrack,
qint64 newPos, ::MainWorkflow::TrackType trackType );
virtual void redo();
virtual void undo();
private:
::MainWorkflow* m_workflow;
QUuid m_uuid;
unsigned int m_oldTrack;
unsigned int m_newTrack;
qint64 m_pos;
qint64 m_oldPos;
bool m_undoRedoAction;
::MainWorkflow* m_workflow;
QUuid m_uuid;
unsigned int m_oldTrack;
unsigned int m_newTrack;
qint64 m_pos;
qint64 m_oldPos;
bool m_undoRedoAction;
::MainWorkflow::TrackType m_trackType;
};
NEW_COMMAND( RemoveClips )
......@@ -93,7 +97,8 @@ namespace Commands
{
public:
ResizeClip( ::MainWorkflow* mainWorkflow, const QUuid& uuid, unsigned int trackId,
qint64 newBegin, qint64 newEnd );
qint64 newBegin, qint64 newEnd,
::MainWorkflow::TrackType trackType );
virtual void redo();
virtual void undo();
private:
......@@ -103,6 +108,7 @@ namespace Commands
qint64 m_newBegin;
qint64 m_newEnd;
Clip* m_clip;
::MainWorkflow::TrackType m_trackType;
};
}
}
......
#include "SettingsManager.h"
#include "ProjectSettingsDefault.h"
void ProjectSettingsDefault::load( const QString& part )
{
SettingsManager::getInstance()->addNewSettingsPart( part );
ProjectSettingsDefault::loadAudioDefaults( part );
ProjectSettingsDefault::loadVideoDefaults( part );
ProjectSettingsDefault::loadProjectDefaults( part );
return ;
}
void ProjectSettingsDefault::loadAudioDefaults( const QString& part )
{
SettingsManager* setMan = SettingsManager::getInstance();
QVariant defaultSampleRate = 0;
setMan->setValue( part, "AudioSampleRate", defaultSampleRate );
return ;
}
void ProjectSettingsDefault::loadVideoDefaults( const QString& part )
{
SettingsManager* settingsMan = SettingsManager::getInstance();
QVariant defaultProjectFPS = 25;
QVariant defaultProjectHeight = 800;
QVariant defaultProjectWidth = 600;
settingsMan->setValue( part,
"VideoProjectFPS",
defaultProjectFPS );
settingsMan->setValue( part,
"VideoProjectHeight",
defaultProjectHeight );
settingsMan->setValue( part,
"VideoProjectWidth",
defaultProjectWidth );
return ;
}
void ProjectSettingsDefault::loadProjectDefaults( const QString& part )
{
SettingsManager* setMan = SettingsManager::getInstance();
QVariant defaultName = "project";
QVariant defaultPath = "./";
setMan->setValue( part, "ProjectName", defaultName );
setMan->setValue( part, "ProjectDirectory", defaultPath );
return ;
}
#ifndef PROJECTSETTINGSDEFAULT_H
#define PROJECTSETTINGSDEFAULT_H
class ProjectSettingsDefault
{
public:
static void load( const QString& part );
private:
static void loadAudioDefaults( const QString& part );
static void loadVideoDefaults( const QString& part );
static void loadProjectDefaults( const QString& part );
private:
ProjectSettingsDefault();
~ProjectSettingsDefault();
ProjectSettingsDefault( const ProjectSettingsDefault & );
ProjectSettingsDefault& operator = ( const ProjectSettingsDefault& );
};
#endif
......@@ -25,9 +25,14 @@
#include <QDomNamedNodeMap>
#include <QDomNodeList>
#include <QtDebug>
#include <QWriteLocker>
#include <QReadLocker>
#include <QTextStream>
#include "SettingsManager.h"
#include "VLMCSettingsDefault.h"
#include "ProjectSettingsDefault.h"
SettingsManager::SettingsManager( QObject* parent )
: QObject( parent )
......@@ -38,70 +43,90 @@ SettingsManager::~SettingsManager()
{
}
void SettingsManager::setValues( QHash<QString, QVariant> values )
void SettingsManager::setValues( const QString& part, QHash<QString, QVariant> values )
{
if ( !m_data.contains( part ) )
addNewSettingsPart( part );
m_globalLock.lockForRead();
SettingsPart* sett = m_data[part];
m_globalLock.unlock();
QHash<QString, QVariant>::iterator it = values.begin();
QHash<QString, QVariant>::iterator end = values.end();
m_lock.lockForWrite();
QWriteLocker lock( &sett->m_lock );
for ( ; it != end; ++it )
m_data.insert( it.key(), it.value() );
m_lock.unlock();
sett->m_data.insert( it.key(), it.value() );
return ;
}
void SettingsManager::setValue( const QString& key, QVariant& value )
void SettingsManager::setValue( const QString& part , const QString& key, QVariant& value )
{
m_lock.lockForWrite();
m_data.insert( key, value );
m_lock.unlock();
m_globalLock.lockForRead();
if ( !m_data.contains( part ) )
{
addNewSettingsPart( part );
}
m_globalLock.unlock();
QWriteLocker lock( &m_globalLock );
SettingsPart* tmp = m_data[part];
tmp->m_data.insert( key, value );
return ;
}
const QVariant SettingsManager::getValue( const QString& key ) const
const QVariant& SettingsManager::getValue( const QString& part, const QString& key ) const
{
m_lock.lockForRead();
QVariant value = m_data[key];
m_lock.unlock();
if ( !m_data.contains( part ) )
return getValue( "default", key );
QReadLocker readLock( &m_globalLock );
QReadLocker rdLock( &m_data[part]->m_lock );
QVariant& value = m_data[part]->m_data[key];
return value;
}
void SettingsManager::saveSettings( QDomDocument& xmlfile, QDomElement& root )
void SettingsManager::saveSettings( const QString& part, QDomDocument& xmlfile, QDomElement& root )
{
m_lock.lockForRead();
m_globalLock.lockForRead();
if ( !m_data.contains( part ) )
{
m_globalLock.unlock();
return ;
}
SettingsPart* sett = m_data[part];
m_globalLock.unlock();
//SAVE SETTINGS TO DomDocument
QHash<QString, QVariant>::iterator it = m_data.begin();
QHash<QString, QVariant>::iterator end = m_data.end();
QDomElement settingsNode = xmlfile.createElement( "settings" );
QReadLocker lock( &sett->m_lock );
QHash<QString, QVariant>::iterator it = sett->m_data.begin();
QHash<QString, QVariant>::iterator end = sett->m_data.end();
QDomElement settingsNode = xmlfile.createElement( part );
for ( ; it != end; ++it )
{
QDomElement elem = xmlfile.createElement( it.key() );
elem.setAttribute( "value", it.value().toString() );
settingsNode.appendChild( elem );
}
m_lock.unlock();
//DEBUG
{
QTextStream stream( stdout );
stream << settingsNode;
}
root.appendChild( settingsNode );
}
void SettingsManager::loadSettings( const QDomElement& settings )
void SettingsManager::loadSettings( const QString& part, const QDomElement& settings )
{
qDebug() << "Loading settings";
if ( settings.isNull() == true || settings.tagName() != "settings" )
if ( settings.isNull() == true || settings.tagName() != "project" )
{
qWarning() << "Invalid settings node";
return ;
}
m_globalLock.lockForRead();
if ( !m_data.contains( part ) )
{
qWarning() << "These settings Does not exists";
return ;
}
SettingsPart* sett = m_data[part];
qDebug() << sett->m_data;
m_globalLock.unlock();
//Loading all the settings
m_lock.lockForWrite();
m_globalLock.lockForWrite();
sett->m_lock.lockForWrite();
QDomNodeList list = settings.childNodes();
int nbChild = list.size();
......@@ -113,10 +138,28 @@ void SettingsManager::loadSettings( const QDomElement& settings )
qWarning() << "Invalid number of attributes for" << list.at( idx ).nodeName();
return ;
}
m_data.insert( list.at( idx ).toElement().tagName(),
sett->m_data.insert( list.at( idx ).toElement().tagName(),
QVariant( attrMap.item( 0 ).nodeValue() ));
}
m_lock.unlock();
sett->m_lock.unlock();
m_globalLock.unlock();
emit settingsLoaded();
}
void SettingsManager::addNewSettingsPart( const QString& name )
{
QReadLocker rLock( &m_globalLock );
if ( !m_data.contains( name ) )
{
rLock.unlock();
QWriteLocker lock( &m_globalLock );
m_data.insert( name, new SettingsPart );
}
}
void SettingsManager::loadDefaultsSettings()
{
VLMCSettingsDefault::load( "default" );
ProjectSettingsDefault::load( "default" );
}
......@@ -33,6 +33,18 @@
#include "QSingleton.hpp"
struct SettingsPart
{
SettingsPart() {}
QHash<QString, QVariant> m_data;
mutable QReadWriteLock m_lock;
bool m_rdOnly;
private:
SettingsPart( const SettingsPart& );
SettingsPart& operator =( const SettingsPart& );
};
class SettingsManager : public QObject, public QSingleton<SettingsManager>
{
......@@ -41,23 +53,24 @@ class SettingsManager : public QObject, public QSingleton<SettingsManager>
friend class QSingleton<SettingsManager>;
public:
void setValues( const QString& part, QHash<QString, QVariant> );
void setValue( const QString& part, const QString& key, QVariant& value );
const QVariant& getValue( const QString& part, const QString& key ) const;
void saveSettings( const QString& part, QDomDocument& xmlfile, QDomElement& root );
void loadSettings( const QString& part, const QDomElement& settings );
void addNewSettingsPart( const QString& name );
static void loadDefaultsSettings();
void setValues( QHash<QString, QVariant> );
void setValue( const QString& key, QVariant& value );
const QVariant getValue( const QString& key ) const;
void saveSettings( QDomDocument& xmlfile, QDomElement& root );
void loadSettings( const QDomElement& settings );
private:
SettingsManager( QObject* parent = 0 );
~SettingsManager();
QHash<QString, QVariant> m_data;
mutable QReadWriteLock m_lock;
QHash<QString, SettingsPart*> m_data;
mutable QReadWriteLock m_globalLock;
signals:
void settingsLoaded();
void settingsLoaded();
};
#endif
#include <QVariant>
#include "VLMCSettingsDefault.h"
#include "SettingsManager.h"
void VLMCSettingsDefault::load( const QString& part )
{
SettingsManager::getInstance()->addNewSettingsPart( part );
VLMCSettingsDefault::loadVLMCDefaults( part );
VLMCSettingsDefault::loadlanguageDefaults( part );
return ;
}
void VLMCSettingsDefault::loadVLMCDefaults( const QString& part )
{
SettingsManager* settingsMan = SettingsManager::getInstance();
QVariant defaultOutputPFS = "25";
QVariant defaultPreviewFPS = "25";
QVariant defaultTrackNb = "64";
settingsMan->setValue( part,
"VLMCOutPutFPS", defaultOutputPFS );
settingsMan->setValue( part,
"VLMCPreviewFPS",
defaultPreviewFPS );
settingsMan->setValue( part,
"VLMCTracksNb",
defaultTrackNb );
return ;
}
void VLMCSettingsDefault::loadlanguageDefaults( const QString& part )
{
}
#ifndef VLMCSETTINGSDEFAULT_H
#define VLMCSETTINGSDEFAULT_H
class VLMCSettingsDefault
{
public:
static void load( const QString& part );
private:
static void loadVLMCDefaults( const QString& part );
static void loadlanguageDefaults( const QString& part );
private:
VLMCSettingsDefault();
~VLMCSettingsDefault();
VLMCSettingsDefault( const VLMCSettingsDefault& );
VLMCSettingsDefault& operator = ( const VLMCSettingsDefault& );
};
#endif
......@@ -27,8 +27,6 @@
EffectsEngine::EffectsEngine( void ) : m_patch( NULL ), m_bypassPatch( NULL )
{
m_inputLock = new QReadWriteLock;
if ( EffectNode::createRootNode( "RootNode" ) == false )
qDebug() << "RootNode creation failed!!!!!!!!!!";
else
......@@ -76,11 +74,8 @@ EffectsEngine::EffectsEngine( void ) : m_patch( NULL ), m_bypassPatch( NULL )
EffectsEngine::~EffectsEngine()
{
stop();
if ( m_patch )
EffectNode::deleteRootNode( "RootNode" );