Fix dragging bin clip zone onto itself creates duplicate, and 1 frame offset in zones.

Related to #287
parent 50d1e578
......@@ -98,7 +98,7 @@ public:
/** @brief Returns the clip type as defined in definitions.h */
ClipType::ProducerType clipType() const override;
/** @brief Set rating on item */
void setRating(uint rating) override;
......
......@@ -201,6 +201,12 @@ bool ProjectItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action
QStringList clipData = ids.constFirst().split(QLatin1Char('/'));
if (clipData.length() >= 3) {
QString id;
std::shared_ptr<ProjectClip> masterClip = getClipByBinID(clipData.at(0));
std::shared_ptr<ProjectSubClip> sub = masterClip->getSubClip(clipData.at(1).toInt(), clipData.at(2).toInt());
if (sub != nullptr) {
// This zone already exists
return false;
}
return requestAddBinSubClip(id, clipData.at(1).toInt(), clipData.at(2).toInt(), {}, clipData.at(0));
} else {
// error, malformed clip zone, abort
......@@ -213,7 +219,7 @@ bool ProjectItemModel::dropMimeData(const QMimeData *data, Qt::DropAction action
}
if (data->hasFormat(QStringLiteral("kdenlive/effect"))) {
// Dropping effect on a Bin item
// Dropping effect on a Bin item
QStringList effectData;
effectData << QString::fromUtf8(data->data(QStringLiteral("kdenlive/effect")));
QStringList source = QString::fromUtf8(data->data(QStringLiteral("kdenlive/effectsource"))).split(QLatin1Char('-'));
......
......@@ -1425,7 +1425,7 @@ void Monitor::slotOpenClip(const std::shared_ptr<ProjectClip> &controller, int i
if (out == -1) {
m_glMonitor->getControllerProxy()->setZone(m_controller->zone(), false);
} else {
m_glMonitor->getControllerProxy()->setZone(in, out, false);
m_glMonitor->getControllerProxy()->setZone(in, out + 1, false);
}
m_snaps->addPoint((int)m_controller->frameDuration() - 1);
// Loading new clip / zone, stop if playing
......
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