[vlmc-devel] commit: EffectsEngine: Loading the effect when starting up. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Wed Jul 28 00:22:04 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Jul 25 21:41:23 2010 +0200| [eb276da55f313be388d7f9b0ffe676b50802c9e5] | committer: Hugo Beauzée-Luyssen 

EffectsEngine: Loading the effect when starting up.

This uses a hardcoded path, this is wrong, and should be removed.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=eb276da55f313be388d7f9b0ffe676b50802c9e5
---

 src/EffectsEngine/EffectsEngine.cpp   |   14 ++++++++++++++
 src/EffectsEngine/EffectsEngine.h     |    1 +
 src/Gui/MainWindow.cpp                |    3 +++
 src/Gui/effectsengine/EffectsList.cpp |    3 +++
 4 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/EffectsEngine/EffectsEngine.cpp b/src/EffectsEngine/EffectsEngine.cpp
index f5a8872..2e33a74 100644
--- a/src/EffectsEngine/EffectsEngine.cpp
+++ b/src/EffectsEngine/EffectsEngine.cpp
@@ -24,6 +24,8 @@
 
 #include "Effect.h"
 
+#include <QDir>
+
 EffectsEngine::EffectsEngine()
 {
     Effect  *e = new Effect("libbw0r");
@@ -61,3 +63,15 @@ EffectsEngine::loadEffect( const QString &fileName )
     emit effectAdded( e, e->type() );
     return true;
 }
+
+void
+EffectsEngine::browseDirectory( const QString &path )
+{
+    QDir    dir( path );
+    const QStringList& files = dir.entryList( QDir::Files | QDir::NoDotAndDotDot |
+                                              QDir::Readable | QDir::Executable );
+    foreach ( const QString& file, files )
+    {
+        loadEffect( path + '/' + file );
+    }
+}
diff --git a/src/EffectsEngine/EffectsEngine.h b/src/EffectsEngine/EffectsEngine.h
index 009fbea..59d9e2c 100644
--- a/src/EffectsEngine/EffectsEngine.h
+++ b/src/EffectsEngine/EffectsEngine.h
@@ -38,6 +38,7 @@ class   EffectsEngine : public QObject, public Singleton<EffectsEngine>
         void        initAll( quint32 width, quint32 height );
         Effect*     effect( qint32 idx );
         bool        loadEffect( const QString& fileName );
+        void        browseDirectory( const QString& path );
     private:
         EffectsEngine();
         ~EffectsEngine();
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index e805541..d57819a 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -38,6 +38,7 @@
 #include "About.h"
 #include "VlmcDebug.h"
 
+#include "EffectsEngine/EffectsEngine.h"
 #include "MainWorkflow.h"
 #include "export/RendererSettings.h"
 #include "export/ShareOnYoutube.h"
@@ -458,6 +459,8 @@ MainWindow::initializeDockWidgets( void )
                                   QT_TRANSLATE_NOOP( "DockWidgetManager", "Effects List" ),
                                   Qt::AllDockWidgetAreas, QDockWidget::AllDockWidgetFeatures,
                                   Qt::LeftDockWidgetArea );
+    //FIXME !!!
+    EffectsEngine::getInstance()->browseDirectory( "/usr/lib/frei0r-1" );
 
     QDockWidget* dock = dockManager->addDockedWidget( UndoStack::getInstance( this ),
                                   QT_TRANSLATE_NOOP( "DockWidgetManager", "History" ),
diff --git a/src/Gui/effectsengine/EffectsList.cpp b/src/Gui/effectsengine/EffectsList.cpp
index bf41c1f..102eb7a 100644
--- a/src/Gui/effectsengine/EffectsList.cpp
+++ b/src/Gui/effectsengine/EffectsList.cpp
@@ -21,6 +21,7 @@
  *****************************************************************************/
 
 #include "EffectsList.h"
+#include "EffectsEngine/EffectsEngine.h"
 #include "ui_EffectsList.h"
 
 #include <QStandardItemModel>
@@ -35,6 +36,8 @@ EffectsList::EffectsList(QWidget *parent) :
 
     m_ui->filterList->setModel( m_filtersModel );
     m_ui->effectsList->setModel( m_effectsModel );
+    connect( EffectsEngine::getInstance(), SIGNAL( effectAdded( Effect*, Effect::Type ) ),
+             this, SLOT( effectAdded(Effect*,Effect::Type) ) );
 }
 
 EffectsList::~EffectsList()



More information about the Vlmc-devel mailing list