Commit 6848e265 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Merge branch '2104'

parents a7495c21 7d053acc
......@@ -76,6 +76,8 @@
#include "dialogs/textbasededit.h"
#include "project/dialogs/temporarydata.h"
#include <framework/mlt_version.h>
#ifdef USE_JOGSHUTTLE
#include "jogshuttle/jogmanager.h"
#endif
......@@ -103,6 +105,7 @@
#include <kns3/knewstuffaction.h>
#include <ktogglefullscreenaction.h>
#include <kwidgetsaddons_version.h>
#include <KRun>
#include "kdenlive_debug.h"
#include <QAction>
......@@ -357,9 +360,14 @@ void MainWindow::init(const QString &mltPath)
auto *onlineResources = new ResourceWidget(this);
m_onlineResourcesDock = addDock(i18n("Online Resources"), QStringLiteral("onlineresources"), onlineResources);
connect(onlineResources, &ResourceWidget::previewClip, [&](const QString &path, const QString &title) {
qDebug()<<"MLT VER: "<<LIBMLT_VERSION_INT<<"; QTVER: "<<QT_VERSION_CHECK(6,26,0);
#if LIBMLT_VERSION_INT == QT_VERSION_CHECK(6,26,0)
new KRun(QUrl(path), this);
#else
m_clipMonitor->slotPreviewResource(path, title);
m_clipMonitorDock->show();
m_clipMonitorDock->raise();
#endif
});
connect(onlineResources, &ResourceWidget::addClip, this, &MainWindow::slotAddProjectClip);
......
......@@ -884,6 +884,10 @@ int GLWidget::setProducer(const QString &file)
m_producer.reset();
}
m_producer = std::make_shared<Mlt::Producer>(new Mlt::Producer(pCore->getCurrentProfile()->profile(), nullptr, file.toUtf8().constData()));
if (!m_producer && !m_producer->is_valid()) {
m_producer.reset();
m_producer = m_blackClip;
}
if (m_consumer) {
//m_consumer->stop();
if (!m_consumer->is_stopped()) {
......
......@@ -1736,7 +1736,6 @@ void Monitor::slotPreviewResource(const QString &path, const QString &title)
slotOpenClip(nullptr);
m_streamAction->setVisible(false);
m_glMonitor->setProducer(path);
m_glMonitor->producer();
m_timePos->setRange(0, m_glMonitor->producer()->get_length() - 1);
m_glMonitor->getControllerProxy()->setClipProperties(-1, ClipType::Unknown, false, title);
m_glMonitor->setRulerInfo(m_glMonitor->producer()->get_length() - 1);
......
......@@ -306,11 +306,14 @@ Rectangle {
dragProxy.height = tentativeClip.height
dragProxy.masterObject = tentativeClip
dragProxy.sourceTrack = tk
console.log('missing item', tentativeClip.clipId, ', COORDS: ', tentativeClip.x, 'x', tentativeClip.y, ', TK id: ', tk, ', TKY: ', Logic.getTrackYFromId(tk))
dragProxy.sourceFrame = tentativeClip.modelStart
dragProxy.isComposition = tentativeClip.isComposition
console.log('missing item', tentativeClip.clipId, ', COORDS: ', tentativeClip.x, 'x', tentativeClip.y, ', TK id: ', tk, ', TKY: ', Logic.getTrackYFromId(tk),' STARTFRM: ', dragProxy.sourceFrame)
} else {
console.log('item not found')
if (dragProxy.draggedItem > -1) {
endDrag()
}
}
}
......
......@@ -2105,7 +2105,21 @@ void TimelineController::insertSpace(int trackId, int frame)
pCore->displayMessage(i18n("No clips found to insert space"), ErrorMessage, 500);
return;
}
int start = m_model->getItemPosition(cid);
int start = -1;
if (m_model->isGroup(cid)) {
std::unordered_set<int> sub = m_model->m_groups->getLeaves(cid);
cid = *sub.cbegin();
int start = m_model->getItemPosition(cid);
for (int current_id : sub) {
int st = m_model->getItemPosition(current_id);
if (st < start) {
cid = current_id;
start = st;
}
}
} else {
start = m_model->getItemPosition(cid);
}
requestSpacerEndOperation(cid, start, start + spaceDuration, affectAllTracks ? -1 : trackId);
}
......@@ -2187,8 +2201,10 @@ void TimelineController::changeItemSpeed(int clipId, double speed)
}
QScopedPointer<SpeedDialog> d(new SpeedDialog(QApplication::activeWindow(), std::abs(speed), duration, minSpeed, maxSpeed, speed < 0, pitchCompensate));
if (d->exec() != QDialog::Accepted) {
emit regainFocus();
return;
}
emit regainFocus();
speed = d->getValue();
pitchCompensate = d->getPitchCompensate();
qDebug() << "requesting speed " << speed;
......@@ -3158,6 +3174,7 @@ void TimelineController::editItemDuration(int id)
undo();
}
}
emit regainFocus();
}
void TimelineController::editTitleClip(int id)
......@@ -4152,6 +4169,7 @@ void TimelineController::importSubtitle(const QString path)
}
subtitleModel->importSubtitle(view.subtitle_url->url().toLocalFile(), offset, true);
}
emit regainFocus();
}
void TimelineController::exportSubtitle()
......
......@@ -753,6 +753,7 @@ signals:
void effectZoneChanged();
void masterZonesChanged();
Q_INVOKABLE void ungrabHack();
void regainFocus();
};
#endif
......@@ -68,6 +68,7 @@ TimelineWidget::TimelineWidget(QWidget *parent)
m_proxy = new TimelineController(this);
connect(m_proxy, &TimelineController::zoneMoved, this, &TimelineWidget::zoneMoved);
connect(m_proxy, &TimelineController::ungrabHack, this, &TimelineWidget::slotUngrabHack);
connect(m_proxy, &TimelineController::regainFocus, this, &TimelineWidget::regainFocus, Qt::DirectConnection);
setResizeMode(QQuickWidget::SizeRootObjectToView);
engine()->addImageProvider(QStringLiteral("thumbnail"), new ThumbnailProvider);
setVisible(false);
......@@ -445,6 +446,8 @@ void TimelineWidget::slotUngrabHack()
QTimer::singleShot(200, this, [this]() {
rootObject()->setProperty("mainFrame", -1);
});
QPoint mousePos = mapFromGlobal(QCursor::pos());
QMetaObject::invokeMethod(rootObject(), "regainFocus", Qt::DirectConnection, Q_ARG(QVariant, mousePos));
}
}
......@@ -502,9 +505,10 @@ bool TimelineWidget::eventFilter(QObject *object, QEvent *event)
void TimelineWidget::regainFocus()
{
qDebug()<<"=== REG FOCUS: "<<underMouse();
if (underMouse() && rootObject()) {
QPoint mousePos = mapFromGlobal(QCursor::pos());
QMetaObject::invokeMethod(rootObject(), "regainFocus", Q_ARG(QVariant, mousePos));
QMetaObject::invokeMethod(rootObject(), "regainFocus", Qt::DirectConnection, Q_ARG(QVariant, mousePos));
}
}
......
......@@ -57,7 +57,6 @@ public:
void setTimelineMenu(QMenu *clipMenu, QMenu *compositionMenu, QMenu *timelineMenu, QMenu *timelineRulerMenu, QMenu *guideMenu, QAction *editGuideAction, QMenu *headerMenu, QMenu *thumbsMenu, QMenu *subtitleClipMenu);
bool loading;
void connectSubtitleModel(bool firstConnect);
void regainFocus();
void unsetModel();
protected:
......@@ -79,6 +78,7 @@ public slots:
void endDrag();
/** @brief Show menu to switch track target audio stream */
void showTargetMenu(int tid = -1);
void regainFocus();
private slots:
void slotUngrabHack();
......
......@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>329</width>
<height>618</height>
<height>650</height>
</rect>
</property>
<property name="windowTitle">
......@@ -144,6 +144,9 @@
<property name="text">
<string>Parameters (see &lt;a href=&quot;https://www.mltframework.org/plugins/ConsumerAvformat/&quot;&gt;MLT documentation&lt;/a&gt;)</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
......
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