Commit 1a7fac10 authored by Nicolas Carion's avatar Nicolas Carion

remove references to bincontroller in clipcontroller

parent 7bc5a8ed
......@@ -31,7 +31,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "jobs/thumbjob.hpp"
#include "kdenlivesettings.h"
#include "lib/audio/audioStreamInfo.h"
#include "mltcontroller/bincontroller.h"
#include "mltcontroller/clip.h"
#include "mltcontroller/clipcontroller.h"
#include "mltcontroller/clippropertiescontroller.h"
......@@ -62,7 +61,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
ProjectClip::ProjectClip(const QString &id, const QIcon &thumb, std::shared_ptr<ProjectItemModel> model, std::shared_ptr<Mlt::Producer> producer)
: AbstractProjectItem(AbstractProjectItem::ClipItem, id, model)
, ClipController(id, pCore->binController(), producer)
, ClipController(id, producer)
, m_thumbsProducer(nullptr)
{
m_markerModel = std::make_shared<MarkerListModel>(id, pCore->projectManager()->undoStack());
......@@ -98,7 +97,7 @@ std::shared_ptr<ProjectClip> ProjectClip::construct(const QString &id, const QIc
ProjectClip::ProjectClip(const QString &id, const QDomElement &description, const QIcon &thumb, std::shared_ptr<ProjectItemModel> model)
: AbstractProjectItem(AbstractProjectItem::ClipItem, id, model)
, ClipController(id, pCore->binController())
, ClipController(id)
, m_thumbsProducer(nullptr)
{
m_clipStatus = StatusWaiting;
......
......@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "clipcontroller.h"
#include "bin/model/markerlistmodel.hpp"
#include "bincontroller.h"
#include "doc/docundostack.hpp"
#include "doc/kdenlivedoc.h"
#include "effects/effectstack/model/effectstackmodel.hpp"
......@@ -39,7 +38,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
std::shared_ptr<Mlt::Producer> ClipController::mediaUnavailable;
ClipController::ClipController(const QString clipId, std::shared_ptr<BinController> bincontroller, std::shared_ptr<Mlt::Producer> producer)
ClipController::ClipController(const QString clipId, std::shared_ptr<Mlt::Producer> producer)
: selectedEffectIndex(1)
, m_audioThumbCreated(false)
, m_masterProducer(producer)
......@@ -50,7 +49,6 @@ ClipController::ClipController(const QString clipId, std::shared_ptr<BinControll
, m_videoIndex(0)
, m_clipType(ClipType::Unknown)
, m_hasLimitedDuration(true)
, m_binController(bincontroller)
, m_effectStack(producer ? EffectStackModel::construct(producer, {ObjectType::BinClip, clipId.toInt()}, pCore->undoStack()) : nullptr)
, m_controllerBinId(clipId)
{
......@@ -132,11 +130,39 @@ void ClipController::addMasterProducer(const std::shared_ptr<Mlt::Producer> &pro
connectEffectStack();
}
namespace {
QString producerXml(const std::shared_ptr<Mlt::Producer> &producer, bool includeMeta)
{
Mlt::Consumer c(*producer->profile(), "xml", "string");
Mlt::Service s(producer->get_service());
if (!s.is_valid()) {
return QString();
}
int ignore = s.get_int("ignore_points");
if (ignore != 0) {
s.set("ignore_points", 0);
}
c.set("time_format", "frames");
if (!includeMeta) {
c.set("no_meta", 1);
}
c.set("store", "kdenlive");
c.set("no_root", 1);
c.set("root", "/");
c.connect(s);
c.start();
if (ignore != 0) {
s.set("ignore_points", ignore);
}
return QString::fromUtf8(c.get("string"));
}
}
void ClipController::getProducerXML(QDomDocument &document, bool includeMeta)
{
// TODO refac this is a probable duplicate with Clip::xml
if (m_masterProducer) {
QString xml = BinController::getProducerXML(m_masterProducer, includeMeta);
QString xml = producerXml(m_masterProducer, includeMeta);
document.setContent(xml);
} else {
qCDebug(KDENLIVE_LOG) << " + + ++ NO MASTER PROD";
......@@ -667,10 +693,6 @@ void ClipController::moveEffect(int oldPos, int newPos)
*/
}
void ClipController::reloadTrackProducers()
{
if (auto ptr = m_binController.lock()) ptr->updateTrackProducer(m_controllerBinId);
}
int ClipController::effectsCount()
{
......
......@@ -35,7 +35,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
class QPixmap;
class Bin;
class BinController;
class AudioStreamInfo;
class EffectStackModel;
class MarkerListModel;
......@@ -57,7 +56,7 @@ public:
* @param bincontroller reference to the bincontroller
* @param producer producer to create reference to
*/
explicit ClipController(const QString id, std::shared_ptr<BinController> bincontroller, std::shared_ptr<Mlt::Producer> producer = nullptr);
explicit ClipController(const QString id, std::shared_ptr<Mlt::Producer> producer = nullptr);
public:
virtual ~ClipController();
......@@ -187,8 +186,6 @@ public:
int effectsCount();
/** @brief Move an effect in stack for this bin clip */
void moveEffect(int oldPos, int newPos);
/** @brief Request an update of all track producers */
void reloadTrackProducers();
/** @brief Save an xml playlist of current clip with in/out points as zone.x()/y() */
void saveZone(QPoint zone, const QDir &dir);
......@@ -215,7 +212,6 @@ protected:
int m_videoIndex;
ClipType m_clipType;
bool m_hasLimitedDuration;
std::weak_ptr<BinController> m_binController;
QMutex m_effectMutex;
void getInfoForProducer();
// void rebuildEffectList(ProfileInfo info);
......
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