[vlmc-devel] commit: EffectUser: Adding an effectType method. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Mon Sep 13 00:00:01 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Sun Sep 12 21:23:02 2010 +0200| [2caf99559a9e7b1490fabfe4ec4631100cef1f7f] | committer: Hugo Beauzée-Luyssen 

EffectUser: Adding an effectType method.

This will avoid using qobject_cast to determine the effect's target
type...

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

 src/EffectsEngine/EffectUser.h |    7 +++++++
 src/Renderer/GenericRenderer.h |    4 ++++
 src/Workflow/ClipWorkflow.cpp  |    6 ++++++
 src/Workflow/ClipWorkflow.h    |    1 +
 src/Workflow/TrackWorkflow.cpp |    6 ++++++
 src/Workflow/TrackWorkflow.h   |    3 ++-
 6 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/EffectsEngine/EffectUser.h b/src/EffectsEngine/EffectUser.h
index 506d5dd..c63add8 100644
--- a/src/EffectsEngine/EffectUser.h
+++ b/src/EffectsEngine/EffectUser.h
@@ -37,6 +37,12 @@ class EffectUser : public QObject
     Q_OBJECT
 
     public:
+        enum    Type
+        {
+            ClipEffectUser,
+            TrackEffectUser,
+            GlobalEffectUser,
+        };
         /**
          *  \brief      Add an effect to the TrackWorkflow
          *
@@ -52,6 +58,7 @@ class EffectUser : public QObject
         qint32                          count( Effect::Type type ) const;
         void                            cleanEffects();
         virtual qint64                  length() const = 0;
+        virtual Type                    effectType() const = 0;
 
     protected:
         EffectUser();
diff --git a/src/Renderer/GenericRenderer.h b/src/Renderer/GenericRenderer.h
index d314c34..79dcaad 100644
--- a/src/Renderer/GenericRenderer.h
+++ b/src/Renderer/GenericRenderer.h
@@ -142,6 +142,10 @@ public:
     {
         return m_isRendering;
     }
+    EffectUser::Type                effectType() const
+    {
+        return EffectUser::GlobalEffectUser;
+    }
 
 protected:
     /**
diff --git a/src/Workflow/ClipWorkflow.cpp b/src/Workflow/ClipWorkflow.cpp
index 65003c8..552bbcf 100644
--- a/src/Workflow/ClipWorkflow.cpp
+++ b/src/Workflow/ClipWorkflow.cpp
@@ -334,3 +334,9 @@ ClipWorkflow::length() const
 {
     return m_clipHelper->length();
 }
+
+EffectUser::Type
+ClipWorkflow::effectType() const
+{
+    return EffectUser::ClipEffectUser;
+}
diff --git a/src/Workflow/ClipWorkflow.h b/src/Workflow/ClipWorkflow.h
index 9ee2909..85e98d7 100644
--- a/src/Workflow/ClipWorkflow.h
+++ b/src/Workflow/ClipWorkflow.h
@@ -204,6 +204,7 @@ class   ClipWorkflow : public EffectUser
 
         void                    save( QXmlStreamWriter& project ) const;
         virtual qint64          length() const;
+        virtual Type            effectType() const;
 
     private:
         void                    setState( State state );
diff --git a/src/Workflow/TrackWorkflow.cpp b/src/Workflow/TrackWorkflow.cpp
index a7e486a..c9554d5 100644
--- a/src/Workflow/TrackWorkflow.cpp
+++ b/src/Workflow/TrackWorkflow.cpp
@@ -650,3 +650,9 @@ TrackWorkflow::length() const
 {
     return m_length;
 }
+
+EffectUser::Type
+TrackWorkflow::effectType() const
+{
+    return TrackEffectUser;
+}
diff --git a/src/Workflow/TrackWorkflow.h b/src/Workflow/TrackWorkflow.h
index 86e84fb..7cef77c 100644
--- a/src/Workflow/TrackWorkflow.h
+++ b/src/Workflow/TrackWorkflow.h
@@ -100,7 +100,8 @@ class   TrackWorkflow : public EffectUser
         //FIXME: this is not thread safe if the list gets modified (but it can't be const, as it is intended to be modified...)
         EffectsEngine::EffectList               *filters();
         EffectsEngine::EffectList               *mixers();
-        qint64                                  length() const;
+        virtual qint64                          length() const;
+        virtual Type                            effectType() const;
 
     private:
         void                                    computeLength();



More information about the Vlmc-devel mailing list