Commit 8937d07f authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

EffectsEngine: Respecting plugin path reference.

Won't work for windows right now.
parent 3250bf1d
......@@ -71,12 +71,17 @@ EffectsEngine::loadEffect( const QString &fileName )
else
{
type = static_cast<Effect::Type>( typeInt );
if ( m_effects.contains( name ) == true )
{
delete e;
return false;
}
m_effects[name] = e;
emit effectAdded( e, name, type );
return true;
}
}
if ( e->load() == false )
if ( e->load() == false || m_effects.contains( e->name() ) == true )
{
delete e;
return false;
......@@ -94,11 +99,14 @@ void
EffectsEngine::browseDirectory( const QString &path )
{
QDir dir( path );
const QStringList& files = dir.entryList( QDir::Files | QDir::NoDotAndDotDot |
const QFileInfoList& files = dir.entryInfoList( QDir::Files | QDir::NoDotAndDotDot |
QDir::Readable | QDir::Executable );
foreach ( const QString& file, files )
foreach ( const QFileInfo& file, files )
{
loadEffect( path + '/' + file );
if ( file.isDir() )
browseDirectory( file.absoluteFilePath() );
else
loadEffect( file.absoluteFilePath() );
}
}
......@@ -213,3 +221,22 @@ EffectsEngine::initMixers( const MixerList &mixers, quint32 width, quint32 heigh
++it;
}
}
void
EffectsEngine::loadEffects()
{
//FIXME: What should we do for windows ?!
//Refer to http://www.piksel.org/frei0r/1.2/spec/group__pluglocations.html
const QString paths[3] = {
QString( QDir::homePath() + "/.frei0r-1/lib/" ),
QString("/usr/local/lib/frei0r-1/"),
QString("/usr/lib/frei0r-1/" )
};
for ( quint32 i = 0; i < 3; ++i )
{
if ( QFile::exists( paths[i] ) == true )
{
browseDirectory( paths[i] );
}
}
}
......@@ -77,7 +77,7 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
Effect* effect( const QString& name );
bool loadEffect( const QString& fileName );
void browseDirectory( const QString& path );
void loadEffects();
//Filters methods:
static void applyFilters( const FilterList &effects,
......@@ -93,7 +93,9 @@ class EffectsEngine : public QObject, public Singleton<EffectsEngine>
private:
EffectsEngine();
~EffectsEngine();
void browseDirectory( const QString& path );
private:
QHash<QString, Effect*> m_effects;
QSettings *m_cache;
QTime *m_time;
......
......@@ -446,7 +446,7 @@ MainWindow::initializeDockWidgets( void )
QT_TRANSLATE_NOOP( "DockWidgetManager", "Effects List" ),
Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures,
Qt::LeftDockWidgetArea );
EffectsEngine::getInstance()->browseDirectory( "/usr/lib/frei0r-1" );
EffectsEngine::getInstance()->loadEffects();
m_renderer = new WorkflowRenderer();
m_renderer->initializeRenderer();
......@@ -638,7 +638,7 @@ MainWindow::renderVideoSettings( bool exportType )
if ( exportType )
outputFileName = VLMC_GET_STRING( "general/TempFolderLocation" ) + "/" +
VLMC_PROJECT_GET_STRING( "general/ProjectName" ) +
VLMC_PROJECT_GET_STRING( "general/ProjectName" ) +
"-vlmc.mp4";
else
outputFileName = settings->outputFileName();
......@@ -666,23 +666,23 @@ MainWindow::on_actionShare_On_Internet_triggered()
if( !renderVideoSettings( true ) )
return;
checkFolders();
QString fileName = VLMC_GET_STRING( "general/TempFolderLocation" ) + "/" +
VLMC_PROJECT_GET_STRING( "general/ProjectName" ) +
VLMC_PROJECT_GET_STRING( "general/ProjectName" ) +
"-vlmc.mp4";
loadGlobalProxySettings();
ShareOnInternet *shareVideo = new ShareOnInternet();
shareVideo->setVideoFile( fileName );
if ( shareVideo->exec() == QDialog::Rejected )
{
delete shareVideo;
return;
}
delete shareVideo;
}
}
......
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