X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitor.cpp;h=34f1c7bd0d8bb35258eb0c05f3f1bc2230c69488;hb=5be6421bad48de34d7bf95522b131783edc6eb37;hp=12093fb8cb4cfadb02a49df3e27d2676b8913455;hpb=d2c65ec06ade4d3cb26e649989a5b5a164637e59;p=kdenlive diff --git a/src/monitor.cpp b/src/monitor.cpp index 12093fb8..34f1c7bd 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -47,21 +48,22 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profile, QWidget *parent) : - AbstractMonitor(id, manager, parent), - render(NULL), - m_currentClip(NULL), - m_overlay(NULL), - m_scale(1), - m_length(2), - m_dragStarted(false), - m_contextMenu(NULL), - m_effectWidget(NULL), - m_selectedClip(NULL), - m_loopClipTransition(true), + AbstractMonitor(id, manager, parent) + , render(NULL) + , m_currentClip(NULL) + , m_overlay(NULL) + , m_scale(1) + , m_length(2) + , m_dragStarted(false) + , m_loopClipAction(NULL) + , m_contextMenu(NULL) + , m_effectWidget(NULL) + , m_selectedClip(NULL) + , m_loopClipTransition(true) #ifdef USE_OPENGL - m_glWidget(NULL), + , m_glWidget(NULL) #endif - m_editMarker(NULL) + , m_editMarker(NULL) { QVBoxLayout *layout = new QVBoxLayout; layout->setContentsMargins(0, 0, 0, 0); @@ -206,7 +208,7 @@ Monitor::Monitor(Kdenlive::MONITORID id, MonitorManager *manager, QString profil m_timePos = new TimecodeDisplay(m_monitorManager->timecode(), this); m_toolbar->addWidget(m_timePos); connect(m_timePos, SIGNAL(timeCodeEditingFinished()), this, SLOT(slotSeek())); - m_toolbar->setMaximumHeight(s * 1.5); + m_toolbar->setMaximumHeight(m_timePos->height()); layout->addWidget(m_toolbar); } @@ -293,10 +295,9 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe dropFrames->setCheckable(true); dropFrames->setChecked(true); connect(dropFrames, SIGNAL(toggled(bool)), this, SLOT(slotSwitchDropFrames(bool))); - + m_configMenu->addAction(showTips); m_configMenu->addAction(dropFrames); - } void Monitor::slotGoToMarker(QAction *action) @@ -385,6 +386,11 @@ void Monitor::updateMarkers(DocClipBase *source) } } +void Monitor::setMarkers(QList markers) +{ + m_ruler->setMarkers(markers); +} + void Monitor::slotSeekToPreviousSnap() { if (m_currentClip) slotSeek(getSnapForPos(true).frames(m_monitorManager->timecode().fps())); @@ -453,6 +459,7 @@ void Monitor::slotSetZoneEnd() // virtual void Monitor::mousePressEvent(QMouseEvent * event) { + if (render) render->setActiveMonitor(); if (event->button() != Qt::RightButton) { if (videoBox->geometry().contains(event->pos()) && (!m_overlay || !m_overlay->underMouse())) { m_dragStarted = true; @@ -865,7 +872,7 @@ void Monitor::slotLoopClip() void Monitor::updateClipProducer(Mlt::Producer *prod) { if (render == NULL) return; - render->setProducer(prod, render->seekFramePosition()); + render->setProducer(prod, render->seekFramePosition()); } void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpdate, int position) @@ -873,7 +880,6 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpda if (render == NULL) return; if (clip == NULL && m_currentClip != NULL) { m_currentClip->lastSeekPosition = render->seekFramePosition(); - kDebug()<<"// SETTING NULL CLIP MONITOR"; m_currentClip = NULL; m_length = -1; render->setProducer(NULL, -1); @@ -890,12 +896,17 @@ void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpda if (render->setProducer(prod, position) == -1) { // MLT CONSUMER is broken kDebug(QtWarningMsg) << "ERROR, Cannot start monitor"; - } + } else start(); } else { if (m_currentClip) { slotActivateMonitor(); if (position == -1) position = render->seekFramePosition(); render->seek(position); + if (zone.isNull()) { + zone = m_currentClip->zone(); + m_ruler->setZone(zone.x(), zone.y()); + return; + } } } if (!zone.isNull()) { @@ -1027,10 +1038,10 @@ QStringList Monitor::getZoneInfo() const void Monitor::slotSetSelectedClip(AbstractClipItem* item) { if (item) { - m_loopClipAction->setEnabled(true); + if (m_loopClipAction) m_loopClipAction->setEnabled(true); m_selectedClip = item; } else { - m_loopClipAction->setEnabled(false); + if (m_loopClipAction) m_loopClipAction->setEnabled(false); } } @@ -1142,7 +1153,7 @@ QString Monitor::getMarkerThumb(GenTime pos) { if (!m_currentClip) return QString(); if (!m_currentClip->getClipHash().isEmpty()) { - QString url = m_monitorManager->getProjectFolder() + "thumbs/" + m_currentClip->getClipHash() + '#' + QString::number(pos.frames(m_monitorManager->timecode().fps())) + ".png"; + QString url = m_monitorManager->getProjectFolder() + "thumbs/" + m_currentClip->getClipHash() + '#' + QString::number((int) pos.frames(m_monitorManager->timecode().fps())) + ".png"; if (QFile::exists(url)) return url; } return QString();