Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Basic support for dropping effects on clips

parent a459181d
......@@ -41,6 +41,7 @@ void EffectStackModel::appendEffect(const QString &effectId)
{
auto effect = EffectItemModel::construct(effectId, shared_from_this(), rootItem);
effect->setEffectStackEnabled(m_effectStackEnabled);
effect->plant(m_service);
rootItem->appendChild(effect);
}
......
......@@ -182,6 +182,13 @@ void ClipModel::setTimelineEffectsEnabled(bool enabled)
m_effectStack->setEffectStackEnabled(enabled);
}
bool ClipModel::addEffect(const QString &effectId)
{
READ_LOCK();
m_effectStack->appendEffect(effectId);
return true;
}
bool ClipModel::hasAudio() const
{
READ_LOCK();
......
......@@ -82,6 +82,8 @@ public:
/** @brief Returns the bin clip's id */
const QString &binId() const;
bool addEffect(const QString &effectId);
friend class TrackModel;
friend class TimelineModel;
friend class TimelineItemModel;
......
......@@ -21,6 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "timelinefunctions.hpp"
#include "core.h"
#include "clipmodel.hpp"
#include <klocalizedstring.h>
#include <QDebug>
......
......@@ -33,9 +33,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
namespace TimelineFunction {
bool requestClipCut(std::shared_ptr<TimelineItemModel> timeline, int clipId, int position);
int requestSpacerStartOperation(std::shared_ptr<TimelineItemModel> timeline, int trackId, int position);
bool requestSpacerEndOperation(std::shared_ptr<TimelineItemModel> timeline, int clipId, int startPosition, int endPosition);
bool requestClipCut(std::shared_ptr<TimelineItemModel> timeline, int clipId, int position);
int requestSpacerStartOperation(std::shared_ptr<TimelineItemModel> timeline, int trackId, int position);
bool requestSpacerEndOperation(std::shared_ptr<TimelineItemModel> timeline, int clipId, int startPosition, int endPosition);
}
#endif
......@@ -1017,6 +1017,12 @@ std::shared_ptr<ClipModel> TimelineModel::getClipPtr(int clipId) const
return m_allClips.at(clipId);
}
bool TimelineModel::addClipEffect(int clipId, const QString &effectId)
{
Q_ASSERT(m_allClips.count(clipId) > 0);
return m_allClips.at(clipId)->addEffect(effectId);
}
std::shared_ptr<CompositionModel> TimelineModel::getCompositionPtr(int compoId) const
{
Q_ASSERT(m_allCompositions.count(compoId) > 0);
......
......@@ -177,6 +177,7 @@ public:
@param clipId Id of the clip to test
*/
Q_INVOKABLE int getClipPosition(int clipId) const;
Q_INVOKABLE bool addClipEffect(int clipId, const QString &effectId);
/* @brief Returns the in cut position of a clip
@param clipId Id of the clip to test
......
......@@ -16,8 +16,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.2
import QtQuick.Controls 1.0
import QtQuick 2.6
import QtQuick.Controls 1.4
import Kdenlive.Controls 1.0
import QtGraphicalEffects 1.0
import QtQml.Models 2.2
......@@ -129,6 +129,20 @@ Rectangle {
}
}
DropArea { //Drop area for compositions
anchors.fill: clipRoot
keys: 'kdenlive/effect'
property string dropData
onEntered: {
dropData = drag.getDataAsString('kdenlive/effect')
}
onDropped: {
console.log("Add effect: ", dropData)
controller.addClipEffect(clipRoot.clipId, dropData);
drag.acceptProposedAction()
}
}
onAudioLevelsChanged: generateWaveform()
MouseArea {
id: mouseArea
......
......@@ -21,7 +21,7 @@
***************************************************************************/
import QtQuick 2.2
import QtQuick.Controls 1.0
import QtQuick.Controls 1.4
import QtGraphicalEffects 1.0
import QtQml.Models 2.2
import QtQuick.Window 2.2
......
import QtQuick 2.4
import QtQml.Models 2.1
import QtQml.Models 2.2
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
......
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