X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fmonitor.cpp;h=aecfe116b02263972246574d53667ed7ffefd74d;hb=9185a624b1d46d1b4c3a5ac5fe57564e22c3cb1c;hp=7fcdf070e758a22194f6281ea8293b304761232e;hpb=d683f2485a3b6fe85bc26cfde32ad43b71eeb804;p=kdenlive diff --git a/src/monitor.cpp b/src/monitor.cpp index 7fcdf070..aecfe116 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -41,7 +41,7 @@ #include -Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent) : +Monitor::Monitor(QString name, MonitorManager *manager, QString profile, QWidget *parent) : QWidget(parent), render(NULL), m_name(name), @@ -130,12 +130,14 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent) : //m_ruler->setPixelPerMark(3); + if (profile.isEmpty()) profile = KdenliveSettings::current_profile(); + QVBoxLayout *rendererBox = new QVBoxLayout(m_ui.video_frame); rendererBox->setContentsMargins(0, 0, 0, 0); #ifdef Q_WS_MAC m_glWidget = new VideoGLWidget(m_ui.video_frame); rendererBox->addWidget(m_glWidget); - render = new Render(m_name, (int) m_ui.video_frame->winId(), -1, this); + render = new Render(m_name, (int) m_ui.video_frame->winId(), -1, profile, this); m_glWidget->setImageAspectRatio(render->dar()); m_glWidget->setBackgroundColor(KdenliveSettings::window_background()); m_glWidget->resize(m_ui.video_frame->size()); @@ -144,7 +146,7 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent) : #else m_monitorRefresh = new MonitorRefresh(m_ui.video_frame); rendererBox->addWidget(m_monitorRefresh); - render = new Render(m_name, (int) m_monitorRefresh->winId(), -1, this); + render = new Render(m_name, (int) m_monitorRefresh->winId(), -1, profile, this); m_monitorRefresh->setRenderer(render); #endif @@ -195,8 +197,8 @@ void Monitor::setupMenu(QMenu *goMenu, QAction *playZone, QAction *loopZone, QMe //TODO: add save zone to timeline monitor when fixed if (m_name == "clip") { - m_contextMenu->addMenu(m_markerMenu); - m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone())); + m_contextMenu->addMenu(m_markerMenu); + m_contextMenu->addAction(KIcon("document-save"), i18n("Save zone"), this, SLOT(slotSaveZone())); } QAction *extractFrame = m_configMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame())); m_contextMenu->addAction(extractFrame); @@ -285,7 +287,7 @@ DocClipBase *Monitor::activeClip() void Monitor::updateMarkers(DocClipBase *source) { - if (source == m_currentClip) { + if (source == m_currentClip && source != NULL) { m_markerMenu->clear(); QList markers = m_currentClip->commentedSnapMarkers(); if (!markers.isEmpty()) { @@ -386,7 +388,8 @@ void Monitor::mouseReleaseEvent(QMouseEvent * event) { if (m_dragStarted) { if (m_ui.video_frame->underMouse()) { - slotPlay(); + if (isActive()) slotPlay(); + else activateMonitor(); } else QWidget::mouseReleaseEvent(event); m_dragStarted = false; } @@ -486,7 +489,7 @@ void Monitor::slotSetThumbFrame() void Monitor::slotExtractCurrentFrame() { QImage frame = render->extractFrame(render->seekFramePosition()); - KFileDialog *fs = new KFileDialog(KUrl(), "image/png",this); + KFileDialog *fs = new KFileDialog(KUrl(), "image/png", this); fs->setOperationMode(KFileDialog::Saving); fs->setMode(KFile::File); #if KDE_IS_VERSION(4,2,0) @@ -750,7 +753,7 @@ void Monitor::slotSetXml(DocClipBase *clip, const int position) } if (clip != m_currentClip) { m_currentClip = clip; - updateMarkers(clip); + updateMarkers(clip); if (render->setProducer(clip->producer(), position) == -1) { // MLT CONSUMER is broken emit blockMonitors(); @@ -781,10 +784,10 @@ void Monitor::slotSaveZone() } -void Monitor::resetProfile() +void Monitor::resetProfile(const QString profile) { if (render == NULL) return; - render->resetProfile(); + render->resetProfile(profile); } void Monitor::saveSceneList(QString path, QDomElement info)