[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdenlive/refactoring_timeline] src: better enum to be used from qml
From:       Nicolas Carion <null () kde ! org>
Date:       2018-04-30 22:26:41
Message-ID: E1fDHFp-0003w7-Hm () code ! kde ! org
[Download RAW message or body]

Git commit 72198cb6adba963619127a1c766e59fc3615b426 by Nicolas Carion.
Committed on 30/04/2018 at 22:27.
Pushed by alcinos into branch 'refactoring_timeline'.

better enum to be used from qml

M  +2    -2    src/bin/projectclip.cpp
M  +3    -2    src/bin/projectclip.h
M  +2    -2    src/definitions.cpp
M  +7    -4    src/definitions.h
M  +7    -0    src/main.cpp
M  +1    -1    src/mltcontroller/clipcontroller.cpp
M  +1    -1    src/mltcontroller/clipcontroller.h
M  +2    -2    src/timeline2/model/builders/meltBuilder.cpp
M  +10   -10   src/timeline2/model/clipmodel.cpp
M  +8    -7    src/timeline2/model/clipmodel.hpp
M  +8    -8    src/timeline2/model/timelinefunctions.cpp
M  +3    -3    src/timeline2/model/timelinefunctions.hpp
M  +4    -1    src/timeline2/model/timelinemodel.cpp
M  +1    -1    src/timeline2/model/timelinemodel.hpp
M  +9    -15   src/timeline2/view/qml/ClipMenu.qml
M  +1    -1    src/timeline2/view/timelinecontroller.cpp
M  +1    -1    src/timeline2/view/timelinecontroller.h

https://commits.kde.org/kdenlive/72198cb6adba963619127a1c766e59fc3615b426

diff --git a/src/bin/projectclip.cpp b/src/bin/projectclip.cpp
index b67acbb1d..4d3104812 100644
--- a/src/bin/projectclip.cpp
+++ b/src/bin/projectclip.cpp
@@ -427,7 +427,7 @@ void ProjectClip::createVideoMasterProducer()
         m_videoProducer->set("set.test_image", 0);
     }
 }
-std::shared_ptr<Mlt::Producer> ProjectClip::getTimelineProducer(int clipId, \
PlaylistState state, double speed) +std::shared_ptr<Mlt::Producer> \
ProjectClip::getTimelineProducer(int clipId, PlaylistState::ClipState state, double \
speed)  {
     if (qFuzzyCompare(speed, 1.0)) {
         // we are requesting a normal speed producer
@@ -476,7 +476,7 @@ std::shared_ptr<Mlt::Producer> \
ProjectClip::getTimelineProducer(int clipId, Play  }
 
 std::pair<std::shared_ptr<Mlt::Producer>, bool> \
ProjectClip::giveMasterAndGetTimelineProducer(int clipId, \
                std::shared_ptr<Mlt::Producer> master,
-                                                                                     \
PlaylistState state) +                                                                \
PlaylistState::ClipState state)  {
     int in = master->get_in();
     int out = master->get_out();
diff --git a/src/bin/projectclip.h b/src/bin/projectclip.h
index a46b438f5..65141dae3 100644
--- a/src/bin/projectclip.h
+++ b/src/bin/projectclip.h
@@ -198,7 +198,7 @@ public:
     /** @brief This function returns a cut to the master producer associated to the \
                timeline clip with given ID.
         Each clip must have a different master producer (see comment of the class)
     */
-    std::shared_ptr<Mlt::Producer> getTimelineProducer(int clipId, PlaylistState st, \
double speed = 1.0); +    std::shared_ptr<Mlt::Producer> getTimelineProducer(int \
clipId, PlaylistState::ClipState st, double speed = 1.0);  
     /* @brief This function should only be used at loading. It takes a producer that \
                was read from mlt, and checks whether the master producer is already \
                in
        use. If yes, then we must create a new one, because of the mixing bug. In any \
case, we return a cut of the master that can be used in the timeline The @@ -206,7 \
                +206,8 @@ public:
            - if true, then the returned cut still possibly has effect on it. You \
                need to rebuild the effectStack based on this
            - if false, the the returned cut don't have effects anymore (it's a fresh \
                one), so you need to reload effects from the old producer
     */
-    std::pair<std::shared_ptr<Mlt::Producer>, bool> \
giveMasterAndGetTimelineProducer(int clipId, std::shared_ptr<Mlt::Producer> master, \
PlaylistState state); +    std::pair<std::shared_ptr<Mlt::Producer>, bool> \
giveMasterAndGetTimelineProducer(int clipId, std::shared_ptr<Mlt::Producer> master, + \
PlaylistState::ClipState state);  
     std::shared_ptr<Mlt::Producer> cloneProducer(Mlt::Profile *destProfile = \
nullptr);  void updateTimelineClips(QVector<int> roles);
diff --git a/src/definitions.cpp b/src/definitions.cpp
index bf55e8768..960636d89 100644
--- a/src/definitions.cpp
+++ b/src/definitions.cpp
@@ -159,11 +159,11 @@ GroupType groupTypeFromStr(const QString &s)
     return GroupType::Normal;
 }
 
-std::pair<bool, bool> stateToBool(PlaylistState state)
+std::pair<bool, bool> stateToBool(PlaylistState::ClipState state)
 {
     return {state == PlaylistState::VideoOnly, state == PlaylistState::AudioOnly};
 }
-PlaylistState stateFromBool(std::pair<bool, bool> av)
+PlaylistState::ClipState stateFromBool(std::pair<bool, bool> av)
 {
     assert(!av.first || !av.second);
     if (av.first) {
diff --git a/src/definitions.h b/src/definitions.h
index 7158b1c20..d15861683 100644
--- a/src/definitions.h
+++ b/src/definitions.h
@@ -77,12 +77,15 @@ enum OperationType {
     ZoomTimeline
 };
 
-enum class PlaylistState { VideoOnly = 1, AudioOnly = 2, Disabled = 3 };
-Q_DECLARE_METATYPE(PlaylistState)
+namespace PlaylistState {
+Q_NAMESPACE
+enum ClipState { VideoOnly = 1, AudioOnly = 2, Disabled = 3 };
+Q_ENUM_NS(ClipState)
+} // namespace PlaylistState
 
 // returns a pair corresponding to (video, audio)
-std::pair<bool, bool> stateToBool(PlaylistState state);
-PlaylistState stateFromBool(std::pair<bool, bool> av);
+std::pair<bool, bool> stateToBool(PlaylistState::ClipState state);
+PlaylistState::ClipState stateFromBool(std::pair<bool, bool> av);
 
 namespace TimelineMode {
 enum EditMode { NormalEdit = 0, OverwriteEdit = 1, InsertEdit = 2 };
diff --git a/src/main.cpp b/src/main.cpp
index 8aaaf9fdf..5a54a024b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -31,6 +31,7 @@
 #include <KIconLoader>
 #include <KSharedConfig>
 
+#include "definitions.h"
 #include "kdenlive_debug.h"
 #include <KDBusService>
 #include <QApplication>
@@ -39,6 +40,7 @@
 #include <QDir>
 #include <QIcon>
 #include <QProcess>
+#include <QQmlEngine>
 #include <QUrl> //new
 #include <klocalizedstring.h>
 
@@ -139,6 +141,11 @@ int main(int argc, char *argv[])
 
     KCrash::initialize();
 
+    qmlRegisterUncreatableMetaObject(PlaylistState::staticMetaObject, // static meta \
object +                                     "com.enums",                     // \
import statement +                                     1, 0,                          \
// major and minor version of the import +                                     \
"ClipState",                     // name in QML +                                     \
"Error: only enums");  QString mltPath = parser.value(QStringLiteral("mlt-path"));
     QUrl url;
     if (parser.positionalArguments().count() != 0) {
diff --git a/src/mltcontroller/clipcontroller.cpp \
b/src/mltcontroller/clipcontroller.cpp index 7f7a83992..9ce2d4216 100644
--- a/src/mltcontroller/clipcontroller.cpp
+++ b/src/mltcontroller/clipcontroller.cpp
@@ -547,7 +547,7 @@ bool ClipController::hasVideo() const
 {
     return m_hasVideo;
 }
-PlaylistState ClipController::defaultState() const
+PlaylistState::ClipState ClipController::defaultState() const
 {
     if (hasVideo()) {
         return PlaylistState::VideoOnly;
diff --git a/src/mltcontroller/clipcontroller.h b/src/mltcontroller/clipcontroller.h
index 1fde5ade5..ea87f73a8 100644
--- a/src/mltcontroller/clipcontroller.h
+++ b/src/mltcontroller/clipcontroller.h
@@ -171,7 +171,7 @@ public:
     /** @brief Returns true if the clip contains at least one video stream */
     bool hasVideo() const;
     /** @brief Returns the default state a clip should be in. If the clips contains \
                both video and audio, this defaults to video */
-    PlaylistState defaultState() const;
+    PlaylistState::ClipState defaultState() const;
     /** @brief Returns info about clip audio */
     const std::unique_ptr<AudioStreamInfo> &audioInfo() const;
     /** @brief Returns true if audio thumbnails for this clip are cached */
diff --git a/src/timeline2/model/builders/meltBuilder.cpp \
b/src/timeline2/model/builders/meltBuilder.cpp index 17963f5bb..27f264d8f 100644
--- a/src/timeline2/model/builders/meltBuilder.cpp
+++ b/src/timeline2/model/builders/meltBuilder.cpp
@@ -192,7 +192,7 @@ bool constructTrackFromMelt(const \
std::shared_ptr<TimelineItemModel> &timeline,  namespace {
 
 // This function tries to recover the state of the producer (audio or video or both)
-PlaylistState inferState(std::shared_ptr<Mlt::Producer> prod)
+PlaylistState::ClipState inferState(std::shared_ptr<Mlt::Producer> prod)
 {
     auto getProperty = [prod](const QString &name) {
         if (prod->parent().is_valid()) {
@@ -250,7 +250,7 @@ bool constructTrackFromMelt(const \
std::shared_ptr<TimelineItemModel> &timeline,  }
             bool ok = false;
             if (pCore->bin()->getBinClip(binId)) {
-                PlaylistState st = inferState(clip);
+                PlaylistState::ClipState st = inferState(clip);
                 int cid = ClipModel::construct(timeline, binId, clip, st);
                 ok = timeline->requestClipMove(cid, tid, position, true, false, \
undo, redo);  } else {
diff --git a/src/timeline2/model/clipmodel.cpp b/src/timeline2/model/clipmodel.cpp
index 98f2056da..a39f6f49a 100644
--- a/src/timeline2/model/clipmodel.cpp
+++ b/src/timeline2/model/clipmodel.cpp
@@ -35,8 +35,8 @@
 #include "gentime.h"
 #include <effects/effectsrepository.hpp>
 
-ClipModel::ClipModel(std::shared_ptr<TimelineModel> parent, \
std::shared_ptr<Mlt::Producer> prod, const QString &binClipId, int id, PlaylistState \
                state,
-                     double speed)
+ClipModel::ClipModel(std::shared_ptr<TimelineModel> parent, \
std::shared_ptr<Mlt::Producer> prod, const QString &binClipId, int id, +              \
PlaylistState::ClipState state, double speed)  : MoveableItem<Mlt::Producer>(parent, \
id)  , m_producer(std::move(prod))
     , m_effectStack(EffectStackModel::construct(m_producer, \
{ObjectType::TimelineClip, m_id}, parent->m_undoStack)) @@ -55,7 +55,7 @@ \
ClipModel::ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt:  }
 }
 
-int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QString \
&binClipId, int id, PlaylistState state) +int ClipModel::construct(const \
std::shared_ptr<TimelineModel> &parent, const QString &binClipId, int id, \
PlaylistState::ClipState state)  {
     id = (id == -1 ? TimelineModel::getNextId() : id);
     std::shared_ptr<ProjectClip> binClip = \
pCore->projectItemModel()->getClipByBinID(binClipId); @@ -74,7 +74,8 @@ int \
ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt  return \
id;  }
 
-int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QString \
&binClipId, std::shared_ptr<Mlt::Producer> producer, PlaylistState state) +int \
ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QString \
&binClipId, std::shared_ptr<Mlt::Producer> producer, +                         \
PlaylistState::ClipState state)  {
 
     // we hand the producer to the bin clip, and in return we get a cut to a good \
master producer @@ -320,7 +321,7 @@ bool ClipModel::isAudioOnly() const
     return m_currentState == PlaylistState::AudioOnly;
 }
 
-void ClipModel::refreshProducerFromBin(PlaylistState state)
+void ClipModel::refreshProducerFromBin(PlaylistState::ClipState state)
 {
     QWriteLocker locker(&m_lock);
     if (getProperty("mlt_service") == QLatin1String("timewarp")) {
@@ -474,16 +475,15 @@ void ClipModel::setShowKeyframes(bool show)
     service()->set("kdenlive:hide_keyframes", (int)!show);
 }
 
-bool ClipModel::setClipState(PlaylistState state)
+bool ClipModel::setClipState(PlaylistState::ClipState state)
 {
     QWriteLocker locker(&m_lock);
-    std::pair<bool, bool> VidAud = stateToBool(state);
-    m_producer->parent().set("set.test_image", int(VidAud.first ? 0 : 1));
-    m_producer->parent().set("set.test_audio", int(VidAud.second ? 0 : 1));
+    refreshProducerFromBin(state);
+    m_currentState = state;
     return true;
 }
 
-PlaylistState ClipModel::clipState() const
+PlaylistState::ClipState ClipModel::clipState() const
 {
     READ_LOCK();
     return m_currentState;
diff --git a/src/timeline2/model/clipmodel.hpp b/src/timeline2/model/clipmodel.hpp
index b7781cdf2..efbb3825b 100644
--- a/src/timeline2/model/clipmodel.hpp
+++ b/src/timeline2/model/clipmodel.hpp
@@ -47,7 +47,7 @@ class ClipModel : public MoveableItem<Mlt::Producer>
 
 protected:
     /* This constructor is not meant to be called, call the static construct instead \
                */
-    ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> \
prod, const QString &binClipId, int id, PlaylistState state, +    \
ClipModel(std::shared_ptr<TimelineModel> parent, std::shared_ptr<Mlt::Producer> prod, \
const QString &binClipId, int id, PlaylistState::ClipState state,  double speed = \
1.);  
 public:
@@ -58,14 +58,15 @@ public:
        @param binClip is the id of the bin clip associated
        @param id Requested id of the clip. Automatic if -1
     */
-    static int construct(const std::shared_ptr<TimelineModel> &parent, const QString \
&binClipId, int id, PlaylistState state); +    static int construct(const \
std::shared_ptr<TimelineModel> &parent, const QString &binClipId, int id, \
PlaylistState::ClipState state);  
     /* @brief Creates a clip, which references itself to the parent timeline
        Returns the (unique) id of the created clip
     This variants assumes a producer is already known, which should typically happen \
                only at loading time.
     Note that there is no guarantee that this producer is actually going to be used. \
                It might be discarded.
     */
-    static int construct(const std::shared_ptr<TimelineModel> &parent, const QString \
&binClipId, std::shared_ptr<Mlt::Producer> producer, PlaylistState state); +    \
static int construct(const std::shared_ptr<TimelineModel> &parent, const QString \
&binClipId, std::shared_ptr<Mlt::Producer> producer, +                         \
PlaylistState::ClipState state);  
     /* @brief returns a property of the clip, or from it's parent if it's a cut
      */
@@ -77,9 +78,9 @@ public:
     Q_INVOKABLE void setShowKeyframes(bool show);
 
     /** @brief Returns the timeline clip status (video / audio only) */
-    PlaylistState clipState() const;
+    PlaylistState::ClipState clipState() const;
     /** @brief Sets the timeline clip status (video / audio only) */
-    bool setClipState(PlaylistState state);
+    bool setClipState(PlaylistState::ClipState state);
 
     /* @brief returns the length of the item on the timeline
      */
@@ -136,7 +137,7 @@ protected:
     void setTimelineEffectsEnabled(bool enabled);
 
     /* @brief This functions should be called when the producer of the binClip \
                changes, to allow refresh */
-    void refreshProducerFromBin(PlaylistState state);
+    void refreshProducerFromBin(PlaylistState::ClipState state);
     void refreshProducerFromBin();
     /* @brief This functions replaces the current producer with a slowmotion one */
     bool useTimewarpProducer(double speed, int extraSpace, Fun &undo, Fun &redo);
@@ -160,7 +161,7 @@ protected:
 
     bool forceThumbReload; // Used to trigger a forced thumb reload, when producer \
changes  
-    PlaylistState m_currentState;
+    PlaylistState::ClipState m_currentState;
 
     double m_speed = -1; // Speed of the clip
 };
diff --git a/src/timeline2/model/timelinefunctions.cpp \
b/src/timeline2/model/timelinefunctions.cpp index 2ba24fc94..1ce8be586 100644
--- a/src/timeline2/model/timelinefunctions.cpp
+++ b/src/timeline2/model/timelinefunctions.cpp
@@ -31,7 +31,7 @@ along with this program.  If not, see \
<http://www.gnu.org/licenses/>.  #include <QDebug>
 #include <klocalizedstring.h>
 
-bool TimelineFunctions::copyClip(std::shared_ptr<TimelineItemModel> timeline, int \
clipId, int &newId, PlaylistState state, Fun &undo, Fun &redo) +bool \
TimelineFunctions::copyClip(std::shared_ptr<TimelineItemModel> timeline, int clipId, \
int &newId, PlaylistState::ClipState state, Fun &undo, Fun &redo)  {
     // Special case: slowmotion clips
     double clipSpeed = timeline->m_allClips[clipId]->getSpeed();
@@ -94,7 +94,7 @@ bool \
TimelineFunctions::processClipCut(std::shared_ptr<TimelineItemModel> timeli  if \
(start > position || (start + duration) < position) {  return false;
     }
-    PlaylistState state = timeline->m_allClips[clipId]->clipState();
+    PlaylistState::ClipState state = timeline->m_allClips[clipId]->clipState();
     bool res = copyClip(timeline, clipId, newId, state, undo, redo);
     res = res && timeline->requestItemResize(clipId, position - start, true, true, \
undo, redo);  int newDuration = timeline->getClipPlaytime(clipId);
@@ -344,7 +344,7 @@ bool \
TimelineFunctions::requestItemCopy(std::shared_ptr<TimelineItemModel> timel  for (int \
id : allIds) {  int newId = -1;
         if (timeline->isClip(id)) {
-            PlaylistState state = timeline->m_allClips[id]->clipState();
+            PlaylistState::ClipState state = timeline->m_allClips[id]->clipState();
             res = copyClip(timeline, id, newId, state, undo, redo);
             res = res && (newId != -1);
         }
@@ -396,9 +396,9 @@ void \
                TimelineFunctions::showCompositionKeyframes(std::shared_ptr<TimelineItemMod
                
     timeline->dataChanged(modelIndex, modelIndex, {TimelineModel::KeyframesRole});
 }
 
-bool TimelineFunctions::changeClipState(std::shared_ptr<TimelineItemModel> timeline, \
int clipId, PlaylistState status) +bool \
TimelineFunctions::changeClipState(std::shared_ptr<TimelineItemModel> timeline, int \
clipId, PlaylistState::ClipState status)  {
-    PlaylistState oldState = timeline->m_allClips[clipId]->clipState();
+    PlaylistState::ClipState oldState = timeline->m_allClips[clipId]->clipState();
     if (oldState == status) {
         return true;
     }
@@ -411,9 +411,9 @@ bool \
TimelineFunctions::changeClipState(std::shared_ptr<TimelineItemModel> timel  return \
result;  }
 
-bool TimelineFunctions::changeClipState(std::shared_ptr<TimelineItemModel> timeline, \
int clipId, PlaylistState status, Fun &undo, Fun &redo) +bool \
TimelineFunctions::changeClipState(std::shared_ptr<TimelineItemModel> timeline, int \
clipId, PlaylistState::ClipState status, Fun &undo, Fun &redo)  {
-    PlaylistState oldState = timeline->m_allClips[clipId]->clipState();
+    PlaylistState::ClipState oldState = timeline->m_allClips[clipId]->clipState();
     if (oldState == status) {
         return true;
     }
@@ -447,7 +447,7 @@ bool \
TimelineFunctions::changeClipState(std::shared_ptr<TimelineItemModel> timel  }
         return res;
     };
-    bool result = reverse();
+    bool result = operation();
     if (result) {
         UPDATE_UNDO_REDO_NOLOCK(operation, reverse, undo, redo);
     }
diff --git a/src/timeline2/model/timelinefunctions.hpp \
b/src/timeline2/model/timelinefunctions.hpp index 5efd9723b..21fe11bd5 100644
--- a/src/timeline2/model/timelinefunctions.hpp
+++ b/src/timeline2/model/timelinefunctions.hpp
@@ -50,7 +50,7 @@ struct TimelineFunctions
     static bool processClipCut(std::shared_ptr<TimelineItemModel> timeline, int \
clipId, int position, int &newId, Fun &undo, Fun &redo);  
     /* @brief Makes a perfect copy of a given clip, but do not insert it */
-    static bool copyClip(std::shared_ptr<TimelineItemModel> timeline, int clipId, \
int &newId, PlaylistState state, Fun &undo, Fun &redo); +    static bool \
copyClip(std::shared_ptr<TimelineItemModel> timeline, int clipId, int &newId, \
PlaylistState::ClipState state, Fun &undo, Fun &redo);  
     /* @brief Request the addition of multiple clips to the timeline
      * If the addition of any of the clips fails, the entire operation is undone.
@@ -80,10 +80,10 @@ struct TimelineFunctions
      * @param status: target status of the clip
      This function creates an undo object and returns true on success
      */
-    static bool changeClipState(std::shared_ptr<TimelineItemModel> timeline, int \
clipId, PlaylistState status); +    static bool \
changeClipState(std::shared_ptr<TimelineItemModel> timeline, int clipId, \
PlaylistState::ClipState status);  /* @brief Same function as above, but accumulates \
                for undo/redo
      */
-    static bool changeClipState(std::shared_ptr<TimelineItemModel> timeline, int \
clipId, PlaylistState status, Fun &undo, Fun &redo); +    static bool \
changeClipState(std::shared_ptr<TimelineItemModel> timeline, int clipId, \
PlaylistState::ClipState status, Fun &undo, Fun &redo);  
     static bool requestSplitAudio(std::shared_ptr<TimelineItemModel> timeline, int \
                clipId, int audioTarget);
     static void setCompositionATrack(std::shared_ptr<TimelineItemModel> timeline, \
                int cid, int aTrack);
diff --git a/src/timeline2/model/timelinemodel.cpp \
b/src/timeline2/model/timelinemodel.cpp index 833b6628f..de4761631 100644
--- a/src/timeline2/model/timelinemodel.cpp
+++ b/src/timeline2/model/timelinemodel.cpp
@@ -553,8 +553,9 @@ bool TimelineModel::requestClipInsertion(const QString \
&binClipId, int trackId,  return result;
 }
 
-bool TimelineModel::requestClipCreation(const QString &binClipId, int &id, \
PlaylistState state, Fun &undo, Fun &redo) +bool \
TimelineModel::requestClipCreation(const QString &binClipId, int &id, \
PlaylistState::ClipState state, Fun &undo, Fun &redo)  {
+    qDebug() << "requestClipCreation " << binClipId;
     int clipId = TimelineModel::getNextId();
     id = clipId;
     Fun local_undo = deregisterClip_lambda(clipId);
@@ -595,6 +596,8 @@ bool TimelineModel::requestClipInsertion(const QString \
&binClipId, int trackId,  {
     std::function<bool(void)> local_undo = []() { return true; };
     std::function<bool(void)> local_redo = []() { return true; };
+    qDebug() << "requestClipInsertion " << binClipId << " "
+             << " " << trackId << " " << position;
     bool res = false;
     if (getTrackById_const(trackId)->isLocked()) {
         return false;
diff --git a/src/timeline2/model/timelinemodel.hpp \
b/src/timeline2/model/timelinemodel.hpp index b7c0bb5fb..50c8bf5c1 100644
--- a/src/timeline2/model/timelinemodel.hpp
+++ b/src/timeline2/model/timelinemodel.hpp
@@ -317,7 +317,7 @@ public:
        @param id: return parameter for the id of the newly created clip.
        @param state: The desired clip state (original, audio/video only).
      */
-    bool requestClipCreation(const QString &binClipId, int &id, PlaylistState state, \
Fun &undo, Fun &redo); +    bool requestClipCreation(const QString &binClipId, int \
&id, PlaylistState::ClipState state, Fun &undo, Fun &redo);  
     /* @brief Deletes the given clip or composition from the timeline This
        action is undoable Returns true on success. If it fails, nothing is
diff --git a/src/timeline2/view/qml/ClipMenu.qml \
b/src/timeline2/view/qml/ClipMenu.qml index a76fcb1a8..acaca0994 100644
--- a/src/timeline2/view/qml/ClipMenu.qml
+++ b/src/timeline2/view/qml/ClipMenu.qml
@@ -1,5 +1,6 @@
 import QtQuick 2.6
 import QtQuick.Controls 1.4 as OLD
+import com.enums 1.0
 
 OLD.Menu {
         id: clipMenu
@@ -50,7 +51,7 @@ OLD.Menu {
         OLD.MenuItem {
             text: i18n('Split Audio')
             onTriggered: timeline.splitAudio(clipId)
-            visible: clipStatus == 0
+            visible: clipStatus == ClipState.VideoOnly
         }
         OLD.MenuItem {
             text: i18n('Remove')
@@ -80,37 +81,30 @@ OLD.Menu {
             onTriggered: timeline.triggerAction('cut_timeline_clip')
         }
         OLD.Menu {
-            title: i18n('Clip Type...')
+            title: i18n('Clip Tape...')
             OLD.ExclusiveGroup {
                 id: radioInputGroup
             }
-            OLD.MenuItem {
-                text: i18n('Original')
-                checkable: true
-                checked: clipStatus == 0
-                exclusiveGroup: radioInputGroup
-                onTriggered: timeline.setClipStatus(clipId, 0)
-            }
             OLD.MenuItem {
                 text: i18n('Video Only')
                 checkable: true
-                checked: clipStatus == 1
+                checked: clipStatus == ClipState.VideoOnly
                 exclusiveGroup: radioInputGroup
-                onTriggered: timeline.setClipStatus(clipId, 1)
+                onTriggered: timeline.setClipStatus(clipId, ClipState.VideoOnly)
             }
             OLD.MenuItem {
                 text: i18n('Audio Only')
                 checkable: true
-                checked: clipStatus == 2
+                checked: clipStatus == ClipState.AudioOnly
                 exclusiveGroup: radioInputGroup
-                onTriggered: timeline.setClipStatus(clipId, 2)
+                onTriggered: timeline.setClipStatus(clipId, ClipState.AudioOnly)
             }
             OLD.MenuItem {
                 text: i18n('Disabled')
                 checkable: true
-                checked: clipStatus == 3
+                checked: clipStatus == ClipState.Disabled
                 exclusiveGroup: radioInputGroup
-                onTriggered: timeline.setClipStatus(clipId, 3)
+                onTriggered: timeline.setClipStatus(clipId, ClipState.Disabled)
             }
         }
 }
diff --git a/src/timeline2/view/timelinecontroller.cpp \
b/src/timeline2/view/timelinecontroller.cpp index d8886e84d..a27e3f789 100644
--- a/src/timeline2/view/timelinecontroller.cpp
+++ b/src/timeline2/view/timelinecontroller.cpp
@@ -1464,7 +1464,7 @@ void TimelineController::showCompositionKeyframes(int clipId, \
bool value)  TimelineFunctions::showCompositionKeyframes(m_model, clipId, value);
 }
 
-void TimelineController::setClipStatus(int clipId, PlaylistState status)
+void TimelineController::setClipStatus(int clipId, PlaylistState::ClipState status)
 {
     TimelineFunctions::changeClipState(m_model, clipId, status);
 }
diff --git a/src/timeline2/view/timelinecontroller.h \
b/src/timeline2/view/timelinecontroller.h index c66e0e81d..96e2dbe9e 100644
--- a/src/timeline2/view/timelinecontroller.h
+++ b/src/timeline2/view/timelinecontroller.h
@@ -252,7 +252,7 @@ public:
     Q_INVOKABLE void removeSpace(int trackId = -1, int frame = -1, bool \
affectAllTracks = false);  /* @brief Change a clip status (normal / audio only / \
                video only)
      */
-    Q_INVOKABLE void setClipStatus(int clipId, PlaylistState status);
+    Q_INVOKABLE void setClipStatus(int clipId, PlaylistState::ClipState status);
 
     Q_INVOKABLE void requestClipCut(int clipId, int position);
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic