Remove deprecated timeline 1 files

parent cb1a0bc5
set(kdenlive_SRCS
${kdenlive_SRCS}
PARENT_SCOPE)
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2008 by Marco Gittler (g.marco@freenet.de) *
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef ABSTRACTCLIPITEM_H
#define ABSTRACTCLIPITEM_H
#include "definitions.h"
#include "gentime.h"
#include "keyframeview.h"
#include "mlt++/MltAnimation.h"
#include "mlt++/MltProperties.h"
#include <QGraphicsRectItem>
#include <QGraphicsWidget>
#include <QTimer>
class CustomTrackScene;
class QGraphicsSceneMouseEvent;
class AbstractClipItem : public QObject, public QGraphicsRectItem
{
Q_OBJECT
Q_PROPERTY(QRectF rect READ rect WRITE setRect)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
AbstractClipItem(const ItemInfo &info, const QRectF &rect, double fps);
virtual ~AbstractClipItem();
ItemInfo info() const;
CustomTrackScene *projectScene();
void updateRectGeometry();
void updateItem(int track);
void setItemLocked(bool locked);
bool isItemLocked() const;
void closeAnimation();
virtual OperationType operationMode(const QPointF &pos, Qt::KeyboardModifiers modifiers) = 0;
virtual void updateKeyframes(const QDomElement &effect) = 0;
virtual GenTime startPos() const;
virtual GenTime endPos() const;
virtual int track() const;
virtual GenTime cropStart() const;
virtual GenTime cropDuration() const;
/** @brief Return the current item's height */
static int itemHeight();
/** @brief Return the current item's vertical offset
* For example transitions are drawn at 1/3 of track height */
static int itemOffset();
/** @brief Resizes the clip from the start.
* @param posx Absolute position of new in point
* @param hasSizeLimit (optional) Whether the clip has a maximum size */
virtual void resizeStart(int posx, bool hasSizeLimit = true, bool emitChange = true);
void updateKeyFramePos(int frame, const double y);
int selectedKeyFramePos() const;
int originalKeyFramePos() const;
void prepareKeyframeMove();
int keyframesCount();
double editedKeyFrameValue();
double getKeyFrameClipHeight(const double y);
QAction *parseKeyframeActions(const QList<QAction *> &list);
void editKeyframeType(const QDomElement &effect, int type);
void attachKeyframeToEnd(const QDomElement &effect, bool attach);
bool isAttachedToEnd() const;
/** @brief Resizes the clip from the end.
* @param posx Absolute position of new out point */
virtual void resizeEnd(int posx, bool emitChange = true);
virtual double fps() const;
virtual void updateFps(double fps);
virtual GenTime maxDuration() const;
virtual void setCropStart(const GenTime &pos);
/** @brief Set this clip as the main selected clip (or not). */
void setMainSelectedClip(bool selected);
/** @brief Is this clip selected as the main clip. */
bool isMainSelectedClip();
void insertKeyframe(QDomElement effect, int pos, double val, bool defaultValue = false);
void movedKeyframe(QDomElement effect, int newpos, int oldpos = -1, double value = -1);
void removeKeyframe(QDomElement effect, int frame);
private slots:
void doUpdate(const QRectF &r);
void slotSelectItem();
protected:
ItemInfo m_info;
GenTime m_maxDuration;
int m_visibleParam;
int m_selectedEffect;
QTimer m_selectionTimer;
double m_fps;
/** @brief True if this is the last clip the user selected */
bool m_isMainSelectedClip;
KeyframeView m_keyframeView;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
int trackForPos(int position);
int posForTrack(int track);
bool resizeGeometries(QDomElement effect, int width, int height, int previousDuration, int start, int duration, int cropstart);
QString resizeAnimations(QDomElement effect, int previousDuration, int start, int duration, int cropstart);
bool switchKeyframes(QDomElement param, int in, int oldin, int out, int oldout);
signals:
void selectItem(AbstractClipItem *);
};
#endif
This diff is collapsed.
/***************************************************************************
* Copyright (C) 2008 by Marco Gittler (g.marco@freenet.de) *
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#ifndef ABSTRACTGROUPITEM
#define ABSTRACTGROUPITEM
#include "definitions.h"
#include <QGraphicsItemGroup>
#include <QGraphicsSceneMouseEvent>
class CustomTrackScene;
class AbstractClipItem;
class QGraphicsSceneMouseEvent;
class AbstractGroupItem : public QObject, public QGraphicsItemGroup
{
Q_OBJECT
public:
explicit AbstractGroupItem(double fps);
int type() const override;
CustomTrackScene *projectScene();
void addItem(QGraphicsItem *item);
void removeItem(QGraphicsItem *item);
int track() const;
QPainterPath clipGroupShape(const QPointF &offset) const;
QPainterPath clipGroupSpacerShape(const QPointF &offset) const;
QPainterPath transitionGroupShape(const QPointF &offset) const;
void setItemLocked(bool locked);
bool isItemLocked() const;
QList<AbstractClipItem *> childClips() const;
// ItemInfo info() const;
/** @brief Resizes all clips in this group from start.
*@param diff Difference to startPos stored in m_resizeInfos */
void resizeStart(int diff);
/** @brief Resizes all clips in this group from end.
* @param diff Difference to endPos stored in m_resizeInfos */
void resizeEnd(int diff);
/** @brief Gets the duration (length) of the group. */
GenTime duration() const;
/** @brief Gets the start frame of the group. */
GenTime startPos() const;
QGraphicsItem *otherClip(QGraphicsItem *item);
protected:
QVariant itemChange(GraphicsItemChange change, const QVariant &value) override;
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *) override;
void dragEnterEvent(QGraphicsSceneDragDropEvent *event) override;
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event) override;
void dropEvent(QGraphicsSceneDragDropEvent *event) override;
void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
int trackForPos(int position);
int posForTrack(int track);
private:
QPainterPath groupShape(GraphicsRectItem type, const QPointF &offset) const;
QPainterPath spacerGroupShape(GraphicsRectItem type, const QPointF &offset) const;
};
#endif
/*
* Kdenlive timeline clip handling MLT producer
* Copyright 2015 Kdenlive team <kdenlive@kde.org>
* Author: Vincent Pinon <vpinon@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "clip.h"
#include <QDebug>
#include <QDomDocument>
#include <mlt++/Mlt.h>
Clip::Clip(Mlt::Producer &producer)
: QObject()
, m_producer(producer)
{
}
Clip::Clip(Clip &other)
: QObject()
{
m_producer = other.producer();
}
Clip::~Clip() = default;
Clip &Clip::operator=(Clip &other)
{
m_producer = other.producer();
return *this;
}
Mlt::Producer &Clip::producer()
{
return m_producer;
}
void Clip::setProducer(Mlt::Producer &producer)
{
m_producer = producer;
}
void Clip::adjustEffectsLength()
{
int ct = 0;
Mlt::Filter *filter = m_producer.filter(ct);
while (filter != nullptr) {
if (filter->get_int("kdenlive:sync_in_out") == 1) {
filter->set_in_and_out(m_producer.get_in(), m_producer.get_out());
}
ct++;
delete filter;
filter = m_producer.filter(ct);
}
}
void Clip::addEffects(Mlt::Service &service, bool skipFades)
{
for (int ix = 0; ix < service.filter_count(); ++ix) {
QScopedPointer<Mlt::Filter> effect(service.filter(ix));
// Only duplicate Kdenlive filters, and skip the fade in effects
if (effect->is_valid()) {
QString effectId = QString::fromLatin1(effect->get("kdenlive_id"));
if (effectId.isEmpty() || (skipFades && (effectId == QLatin1String("fadein") || effectId == QLatin1String("fade_from_black")))) {
continue;
}
// no easy filter copy: do it by hand!
auto *copy = new Mlt::Filter(*effect->profile(), effect->get("mlt_service"));
if ((copy != nullptr) && copy->is_valid()) {
for (int i = 0; i < effect->count(); ++i) {
QString paramName = QString::fromLatin1(effect->get_name(i));
if (paramName == QLatin1String("kdenlive:sync_in_out") && QString::fromLatin1(effect->get(i)) == QLatin1String("1")) {
// Effect in/out must be synced with clip in/out
copy->set_in_and_out(m_producer.get_in(), m_producer.get_out());
}
if (paramName.at(0) != QLatin1Char('_')) {
copy->set(effect->get_name(i), effect->get(i));
}
}
m_producer.attach(*copy);
}
delete copy;
}
}
}
void Clip::replaceEffects(Mlt::Service &service)
{
// remove effects first
int ct = 0;
Mlt::Filter *filter = m_producer.filter(ct);
while (filter != nullptr) {
QString ix = QString::fromLatin1(filter->get("kdenlive_ix"));
if (!ix.isEmpty()) {
if (m_producer.detach(*filter) == 0) {
} else {
ct++;
}
} else {
ct++;
}
delete filter;
filter = m_producer.filter(ct);
}
addEffects(service);
}
void Clip::deleteEffects()
{
// remove effects
int ct = 0;
Mlt::Filter *filter = m_producer.filter(ct);
while (filter != nullptr) {
QString ix = QString::fromLatin1(filter->get("kdenlive_id"));
if (!ix.isEmpty()) {
if (m_producer.detach(*filter) == 0) {
} else {
ct++;
}
} else {
ct++;
}
delete filter;
filter = m_producer.filter(ct);
}
}
void Clip::disableEffects(bool disable)
{
int ct = 0;
Mlt::Filter *filter = m_producer.filter(ct);
while (filter != nullptr) {
QString ix = QString::fromLatin1(filter->get("kdenlive_ix"));
if (!ix.isEmpty()) {
if (disable && filter->get_int("disable") == 0) {
filter->set("disable", 1);
filter->set("auto_disable", 1);
} else if (!disable && filter->get_int("auto_disable") == 1) {
filter->set("disable", (char *)nullptr);
filter->set("auto_disable", (char *)nullptr);
}
}
ct++;
delete filter;
filter = m_producer.filter(ct);
}
}
const QByteArray Clip::xml()
{
Mlt::Consumer c(*m_producer.profile(), "xml", "string");
Mlt::Service s(m_producer.get_service());
int ignore = s.get_int("ignore_points");
if (ignore != 0) {
s.set("ignore_points", 0);
}
c.connect(s);
c.set("time_format", "frames");
c.set("no_meta", 1);
c.set("no_root", 1);
c.set("no_profile", 1);
c.set("root", "/");
c.set("store", "kdenlive");
c.start();
if (ignore != 0) {
s.set("ignore_points", ignore);
}
return c.get("string");
}
Mlt::Producer *Clip::clone()
{
QByteArray prodXml = xml();
Mlt::Producer *clone = new Mlt::Producer(*m_producer.profile(), "xml-string", prodXml);
return clone;
}
Mlt::Producer *Clip::softClone(const char *list)
{
QString service = QString::fromLatin1(m_producer.get("mlt_service"));
QString resource = QString::fromLatin1(m_producer.get("resource"));
Mlt::Producer *clone = new Mlt::Producer(*m_producer.profile(), service.toUtf8().constData(), resource.toUtf8().constData());
Mlt::Properties original(m_producer.get_properties());
Mlt::Properties cloneProps(clone->get_properties());
cloneProps.pass_list(original, list);
return clone;
}
/*
* Kdenlive timeline clip handling MLT producer
* Copyright 2015 Kdenlive team <kdenlive@kde.org>
* Author: Vincent Pinon <vpinon@kde.org>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License or (at your option) version 3 or any later version
* accepted by the membership of KDE e.V. (or its successor approved
* by the membership of KDE e.V.), which shall act as a proxy
* defined in Section 14 of version 3 of the license.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef CLIP_H
#define CLIP_H
#include <QObject>
#include <mlt++/MltProducer.h>
#include <mlt++/MltService.h>
class Clip : public QObject
{
Q_OBJECT
Q_PROPERTY(Mlt::Producer producer READ producer WRITE setProducer)
public:
explicit Clip(Mlt::Producer &producer);
Clip(Clip &other);
~Clip();
Clip &operator=(Clip &other);
const QByteArray xml();
/** @brief: Clone a producer (creates a completely independent copy). */
Mlt::Producer *clone();
/** @brief: Clone a producer without using xml-string producer.
* When Movit is used, we must use this because xml-string crashes (probably attaches some normalizers)
*/
Mlt::Producer *softClone(const char *list);
void deleteEffects();
void addEffects(Mlt::Service &service, bool skipFades = false);
void replaceEffects(Mlt::Service &service);
void delEffect(int index);
/** @brief: Dis/enable all kdenlive effects on a clip. */
void disableEffects(bool disable);
void adjustEffectsLength();
Mlt::Producer &producer();
public Q_SLOTS:
void setProducer(Mlt::Producer &producer);
private:
Mlt::Producer m_producer;
};
#endif // CLIP_H
/***************************************************************************
* Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
***************************************************************************/
#include "clipdurationdialog.h"
#include "clipitem.h"
#include <QFontDatabase>
#include <QWheelEvent>
ClipDurationDialog::ClipDurationDialog(AbstractClipItem *clip, const Timecode &tc, const GenTime &min, const GenTime &max, QWidget *parent)
: QDialog(parent)
, m_clip(clip)
, m_min(min)
, m_max(max)
{
setFont(QFontDatabase::systemFont(QFontDatabase::SmallestReadableFont));
setupUi(this);
m_pos = new TimecodeDisplay(tc);
m_cropStart = new TimecodeDisplay(tc);
m_dur = new TimecodeDisplay(tc);
m_cropEnd = new TimecodeDisplay(tc);
clip_position_box->addWidget(m_pos);
crop_start_box->addWidget(m_cropStart);
clip_duration_box->addWidget(m_dur);
crop_end_box->addWidget(m_cropEnd);
bool allowCrop = true;
if (clip->type() == AVWidget) {
ClipItem *item = static_cast<ClipItem *>(clip);
const int t = item->clipType();
if (t == Color || t == Image || t == Text) {
allowCrop = false;
}
}
if (!allowCrop || clip->type() == TransitionWidget) {
m_cropStart->setHidden(true);
crop_label->hide();
m_cropEnd->setHidden(true), end_label->hide();
}
m_crop = m_clip->cropStart();
m_pos->setValue(m_clip->startPos());
m_dur->setValue(m_clip->cropDuration());
m_cropStart->setValue(m_clip->cropStart());
m_cropEnd->setValue(m_clip->maxDuration() - m_clip->cropDuration() - m_clip->cropStart());
connect(m_pos, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckStart);
connect(m_dur, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckDuration);
connect(m_cropStart, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckCrop);
connect(m_cropEnd, &TimecodeDisplay::timeCodeEditingFinished, this, &ClipDurationDialog::slotCheckEnd);
adjustSize();
}
ClipDurationDialog::~ClipDurationDialog()
{
delete m_pos;
delete m_dur;
delete m_cropStart;
delete m_cropEnd;
}
void ClipDurationDialog::slotCheckStart()
{
GenTime start = m_pos->gentime();
GenTime duration = m_dur->gentime();
if (m_min != GenTime() && start < m_min) {
m_pos->setValue(m_min);
} else if (m_max != GenTime() && start + duration > m_max) {
m_pos->setValue(m_max - duration);
}
}
void ClipDurationDialog::slotCheckDuration()
{
GenTime start = m_pos->gentime();
GenTime duration = m_dur->gentime();
GenTime cropStart = m_cropStart->gentime();