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

Commit da1fb346 authored by Nicolas Carion's avatar Nicolas Carion

Big step in deconnecting old effectstack and timeline

parent a3041f64
......@@ -96,7 +96,6 @@ add_subdirectory(doc)
add_subdirectory(dvdwizard)
add_subdirectory(effects)
add_subdirectory(effectslist)
add_subdirectory(effectstack)
add_subdirectory(lib)
add_subdirectory(mltcontroller)
add_subdirectory(monitor)
......@@ -105,7 +104,6 @@ add_subdirectory(project)
add_subdirectory(qml)
add_subdirectory(scopes)
add_subdirectory(simplekeyframes)
add_subdirectory(timeline)
add_subdirectory(timeline2)
add_subdirectory(titler)
add_subdirectory(transitions)
......
......@@ -9,11 +9,11 @@ set(kdenlive_SRCS
assets/model/assetcommand.cpp
assets/view/assetparameterview.cpp
assets/view/widgets/abstractparamwidget.cpp
assets/view/widgets/animationwidget.cpp
#assets/view/widgets/animationwidget.cpp
assets/view/widgets/boolparamwidget.cpp
assets/view/widgets/doubleparamwidget.cpp
assets/view/widgets/keyframeedit.cpp
# assets/view/widgets/keyframeedit.cpp
assets/view/widgets/listparamwidget.cpp
assets/view/widgets/positioneditwidget.cpp
# assets/view/widgets/positioneditwidget.cpp
PARENT_SCOPE)
......@@ -55,7 +55,8 @@ void AssetParameterView::setModel(const std::shared_ptr<AssetParameterModel> &mo
auto type = model->data(index, AssetParameterModel::TypeRole).value<ParamType>();
if (animWidget && (type == ParamType::Geometry || type == ParamType::Animated || type == ParamType::RestrictedAnim)) {
// Animation widget can have some extra params that should'nt build a new widget
animWidget->addParameter(index);
// TODO refac
// animWidget->addParameter(index);
} else {
auto w = AbstractParamWidget::construct(model, index, range, this);
if (type == ParamType::Geometry || type == ParamType::Animated || type == ParamType::RestrictedAnim || type == ParamType::AnimatedRect) {
......
......@@ -82,14 +82,14 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case ParamType::Animated:
case ParamType::RestrictedAnim:
case ParamType::AnimatedRect:
widget = new AnimationWidget(model, index, range, parent);
break;
// widget = new AnimationWidget(model, index, range, parent);
// break;
case ParamType::KeyframeParam:
widget = new KeyframeEdit(model, index, parent);
break;
// widget = new KeyframeEdit(model, index, parent);
// break;
case ParamType::Position:
widget = new PositionEditWidget(model, index, parent);
break;
// widget = new PositionEditWidget(model, index, parent);
// break;
case ParamType::Switch:
case ParamType::Addedgeometry:
case ParamType::Color:
......
......@@ -45,16 +45,13 @@
#include "mlt++/MltAnimation.h"
#include "mlt++/MltProfile.h"
#include "effectstack/animkeyframeruler.h"
#include "animationwidget.h"
#include "assets/model/assetparametermodel.hpp"
#include "core.h"
#include "effectstack/parametercontainer.h"
#include "mltcontroller/effectscontroller.h"
#include "kdenlivesettings.h"
#include "monitor/monitor.h"
#include "timecodedisplay.h"
#include "timeline/keyframeview.h"
#include "widgets/doublewidget.h"
#include "widgets/dragvalue.h"
......
......@@ -18,8 +18,6 @@
#ifndef KEYFRAMEEDIT_H
#define KEYFRAMEEDIT_H
#include "effectstack/keyframehelper.h"
#include "assets/view/widgets/abstractparamwidget.hpp"
#include "definitions.h"
#include "ui_keyframeeditor_ui.h"
......
......@@ -3042,9 +3042,10 @@ void Bin::slotGotFilterJobResults(const QString &id, int startPos, int track, co
void Bin::slotGetCurrentProjectImage(const QString &clipId, bool request)
{
if (!clipId.isEmpty()) {
(pCore->projectManager()->currentTimeline()->hideClip(clipId, request));
}
// TODO refact : look at this
// if (!clipId.isEmpty()) {
// (pCore->projectManager()->currentTimeline()->hideClip(clipId, request));
// }
pCore->monitorManager()->projectMonitor()->slotGetCurrentImage(request);
}
......
......@@ -19,7 +19,6 @@
#include "generators.h"
#include "doc/kthumb.h"
#include "effectstack/parametercontainer.h"
#include "kdenlivesettings.h"
#include "monitor/monitor.h"
......@@ -69,10 +68,10 @@ Generators::Generators(Monitor *monitor, const QString &path, QWidget *parent)
QWidget *frameWidget = new QWidget;
lay->addWidget(frameWidget);
ItemInfo info;
EffectMetaInfo metaInfo;
metaInfo.monitor = monitor;
// TODO refac look after this
/*
EffectMetaInfo metaInfo;
metaInfo.monitor = monitor;
m_container = new ParameterContainer(base, info, &metaInfo, frameWidget);
connect(m_container, &ParameterContainer::parameterChanged, this, &Generators::updateProducer);
*/
......
......@@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "lib/audio/audioStreamInfo.h"
#include "mltcontroller/bincontroller.h"
#include "mltcontroller/clipcontroller.h"
#include "mltcontroller/clip.h"
#include "mltcontroller/clippropertiescontroller.h"
#include "model/markerlistmodel.hpp"
#include "profiles/profilemodel.hpp"
......@@ -39,7 +40,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "projectitemmodel.h"
#include "projectsubclip.h"
#include "timecode.h"
#include "timeline/clip.h"
#include "timeline2/model/snapmodel.hpp"
#include "utils/KoIconUtils.h"
#include "xml/xml.hpp"
......
......@@ -22,7 +22,6 @@
#include "core.h"
#include "definitions.h"
#include "effectslist/initeffects.h"
#include "timeline/transitionhandler.h"
#include "mainwindow.h"
#include "mltcontroller/bincontroller.h"
......
......@@ -39,8 +39,8 @@
#include "project/clipmanager.h"
#include "project/projectcommands.h"
#include "renderer.h"
#include "timeline/transitionhandler.h"
#include "titler/titlewidget.h"
#include "transitions/transitionsrepository.hpp"
#include "utils/KoIconUtils.h"
#include <config-kdenlive.h>
......@@ -384,7 +384,7 @@ QDomDocument KdenliveDoc::createEmptyDocument(const QList<TrackInfo> &tracks)
tractor.insert_track(track, i + 1);
}
QScopedPointer<Mlt::Field> field(tractor.field());
QString compositeService = TransitionHandler::compositeTransition();
QString compositeService = TransitionsRepository::get()->getCompositingTransition();
for (int i = 0; i <= tracks.count(); i++) {
if (i > 0) {
Mlt::Transition tr(docProfile, "mix");
......@@ -1676,22 +1676,6 @@ QStringList KdenliveDoc::getProxyHashList()
return pCore->bin()->getProxyHashList();
}
// static
int KdenliveDoc::compositingMode()
{
QString composite = TransitionHandler::compositeTransition();
if (composite == QLatin1String("composite")) {
// only simple preview compositing enabled
return 0;
}
if (composite == QLatin1String("movit.overlay")) {
// Movit compositing enabled
return 2;
}
// Cairoblend or qtblend available
return 1;
}
std::shared_ptr<MarkerListModel> KdenliveDoc::getGuideModel() const
{
return m_guideModel;
......
......@@ -39,7 +39,6 @@
#include "gentime.h"
#include "mltcontroller/effectscontroller.h"
#include "timecode.h"
#include "timeline/guide.h"
class ClipManager;
class MainWindow;
......@@ -153,8 +152,6 @@ public:
void initCacheDirs();
/** @brief Get a list of all proxy hash used in this project */
QStringList getProxyHashList();
/** @brief Returns true if advanced compositing is available */
static int compositingMode();
/** @brief Move project data files to new url */
void moveProjectData(const QString &src, const QString &dest);
......
......@@ -9,6 +9,7 @@ set(kdenlive_SRCS
effects/effectstack/model/effectgroupmodel.cpp
effects/effectstack/model/effectitemmodel.cpp
effects/effectstack/model/effectstackmodel.cpp
effects/effectstack/view/abstractcollapsiblewidget.cpp
effects/effectstack/view/collapsibleeffectview.cpp
effects/effectstack/view/effectstackview.cpp
effects/keyframes/keyframemodel.cpp
......
/***************************************************************************
* Copyright (C) 2012 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 "abstractcollapsiblewidget.h"
AbstractCollapsibleWidget::AbstractCollapsibleWidget(QWidget *parent)
: QWidget(parent)
{
setupUi(this);
}
/***************************************************************************
* Copyright (C) 2012 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 ABSTRACTCOLLAPSIBLEWIDGET_H
#define ABSTRACTCOLLAPSIBLEWIDGET_H
#include "ui_collapsiblewidget_ui.h"
#include <QDomElement>
#include <QWidget>
class AbstractCollapsibleWidget : public QWidget, public Ui::CollapsibleWidget_UI
{
Q_OBJECT
public:
explicit AbstractCollapsibleWidget(QWidget *parent = nullptr);
virtual void setActive(bool activate) = 0;
virtual bool isGroup() const = 0;
signals:
void addEffect(const QDomElement &e);
/** @brief Move effects in the stack one step up or down. */
void changeEffectPosition(const QList<int> &, bool upwards);
/** @brief Move effects in the stack. */
void moveEffect(const QList<int> &current_pos, int new_pos, int groupIndex, const QString &groupName);
/** @brief An effect was saved, trigger effect list reload. */
void reloadEffects();
};
#endif
......@@ -41,6 +41,7 @@
#include <QPainter>
#include <QProgressBar>
#include <QPropertyAnimation>
#include <QSpinBox>
#include <QStandardPaths>
#include <QVBoxLayout>
#include <QWheelEvent>
......@@ -540,7 +541,7 @@ int CollapsibleEffectView::effectIndex() const
return m_effect.attribute(QStringLiteral("kdenlive_ix")).toInt();
}
void CollapsibleEffectView::updateWidget(const ItemInfo &info, const QDomElement &effect, EffectMetaInfo *metaInfo)
void CollapsibleEffectView::updateWidget(const ItemInfo &info, const QDomElement &effect)
{
// cleanup
/*
......@@ -548,7 +549,7 @@ void CollapsibleEffectView::updateWidget(const ItemInfo &info, const QDomElement
m_paramWidget = nullptr;
*/
m_effect = effect;
setupWidget(info, metaInfo);
setupWidget(info);
}
void CollapsibleEffectView::updateFrameInfo()
......@@ -569,7 +570,7 @@ void CollapsibleEffectView::setActiveKeyframe(int kf)
*/
}
void CollapsibleEffectView::setupWidget(const ItemInfo &info, EffectMetaInfo *metaInfo)
void CollapsibleEffectView::setupWidget(const ItemInfo &info)
{
/*
if (m_effect.isNull()) {
......
......@@ -22,10 +22,9 @@
#ifndef COLLAPSIBLEEFFECTVIEW_H
#define COLLAPSIBLEEFFECTVIEW_H
#include "effectstack/abstractcollapsiblewidget.h"
#include "effectstack/parametercontainer.h"
#include "mltcontroller/effectscontroller.h"
#include "timecode.h"
#include "abstractcollapsiblewidget.h"
#include <QDomElement>
#include <memory>
......@@ -50,13 +49,13 @@ public:
~CollapsibleEffectView();
QLabel *title;
void setupWidget(const ItemInfo &info, EffectMetaInfo *metaInfo);
void setupWidget(const ItemInfo &info);
void updateTimecodeFormat();
void setActive(bool activate) override;
/** @brief Install event filter so that scrolling with mouse wheel does not change parameter value. */
bool eventFilter(QObject *o, QEvent *e) override;
/** @brief Update effect GUI to reflect parameted changes. */
void updateWidget(const ItemInfo &info, const QDomElement &effect, EffectMetaInfo *metaInfo);
void updateWidget(const ItemInfo &info, const QDomElement &effect);
/** @brief Returns effect xml. */
QDomElement effect() const;
/** @brief Returns effect xml with keyframe offset for saving. */
......@@ -117,7 +116,6 @@ private slots:
void animationChanged(const QVariant &geom);
private:
ParameterContainer *m_paramWidget;
AssetParameterView *m_view;
std::shared_ptr<EffectItemModel> m_model;
KDualAction *m_collapse;
......
This diff is collapsed.
set(kdenlive_SRCS
${kdenlive_SRCS}
mltcontroller/bincontroller.cpp
mltcontroller/clip.cpp
mltcontroller/clipcontroller.cpp
mltcontroller/clippropertiescontroller.cpp
mltcontroller/effectscontroller.cpp
......
......@@ -19,9 +19,9 @@
#include "bincontroller.h"
#include "bin/model/markerlistmodel.hpp"
#include "clip.h"
#include "clipcontroller.h"
#include "kdenlivesettings.h"
#include "timeline/clip.h"
static const char *kPlaylistTrackId = "main bin";
......
/*
* 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("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();
// HACK: currently the MLT xml producer, when parsing a <profile>, does change the global profile accordingly.
// causing crash on threaded calls. To avoid this, we discard the profile info from our xml
QDomDocument doc;
doc.setContent(prodXml, true);
QDomNodeList profiles = doc.documentElement().elementsByTagName("profile");
if (!profiles.isEmpty()) {
QDomNode profile = profiles.item(0);
doc.documentElement().removeChild(profile);
}
Mlt::Producer *clone = new Mlt::Producer(*m_producer.profile(), "xml-string", doc.toByteArray().constData());
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
......@@ -28,8 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "lib/audio/audioStreamInfo.h"
#include "mltcontroller/effectscontroller.h"