m_selectedClip(NULL),
m_loopClipTransition(true),
m_editMarker(NULL)
-
{
QVBoxLayout *layout = new QVBoxLayout;
layout->setContentsMargins(0, 0, 0, 0);
createOpenGlWidget(m_videoBox, profile);
monitorCreated = true;
//m_glWidget->setFixedSize(width, height);
-#elif defined (USE_OPEN_GL)
+#elif defined(USE_OPENGL)
if (KdenliveSettings::openglmonitors()) {
monitorCreated = createOpenGlWidget(m_videoBox, profile);
}
render = new Render(m_name, (int) m_monitorRefresh->winId(), profile, this);
m_monitorRefresh->setRenderer(render);
}
-#if defined (USE_OPEN_GL)
+#ifdef USE_OPENGL
else if (m_glWidget) {
lay->addWidget(m_glWidget);
m_videoBox->setLayout(lay);
connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
connect(render, SIGNAL(rendererStopped(int)), this, SLOT(rendererStopped(int)));
+ connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
if (name != "clip") {
connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
return m_name;
}
-#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
+#ifdef USE_OPENGL
bool Monitor::createOpenGlWidget(QWidget *parent, const QString profile)
{
render = new Render(m_name, 0, profile, this);
void Monitor::slotSetZoneStart()
{
- m_ruler->setZone(render->seekFramePosition(), -1);
+ m_ruler->setZone(m_ruler->position(), -1);
emit zoneUpdated(m_ruler->zone());
checkOverlay();
setClipZone(m_ruler->zone());
void Monitor::slotSetZoneEnd()
{
- m_ruler->setZone(-1, render->seekFramePosition());
+ m_ruler->setZone(-1, m_ruler->position());
emit zoneUpdated(m_ruler->zone());
checkOverlay();
setClipZone(m_ruler->zone());
}
}
+void Monitor::resizeEvent(QResizeEvent *event)
+{
+ Q_UNUSED(event);
+ if (render && isVisible() && isActive()) render->doRefresh();
+}
+
+
void Monitor::slotSwitchFullScreen()
{
m_videoBox->switchFullScreen();
data.append(list.join(";").toUtf8());
mimeData->setData("kdenlive/clip", data);
drag->setMimeData(mimeData);
- QPixmap pix = m_currentClip->thumbnail();
+ /*QPixmap pix = m_currentClip->thumbnail();
drag->setPixmap(pix);
- drag->setHotSpot(QPoint(0, 50));
+ drag->setHotSpot(QPoint(0, 50));*/
drag->start(Qt::MoveAction);
//Qt::DropAction dropAction;
if (fast) {
int delta = m_monitorManager->timecode().fps();
if (eventDelta > 0) delta = 0 - delta;
- slotSeek(render->seekFramePosition() - delta);
+ slotSeek(m_ruler->position() - delta);
} else {
if (eventDelta >= 0) slotForwardOneFrame();
else slotRewindOneFrame();
KFileDialog *fs = new KFileDialog(KUrl(), "image/png", this);
fs->setOperationMode(KFileDialog::Saving);
fs->setMode(KFile::File);
-#if KDE_IS_VERSION(4,2,0)
fs->setConfirmOverwrite(true);
-#endif
fs->setKeepLocation(true);
fs->exec();
QString path = fs->selectedFile();
return m_monitorManager->isActive(m_name);
}
-void Monitor::activateMonitor()
+bool Monitor::activateMonitor()
{
- m_monitorManager->activateMonitor(m_name);
+ return m_monitorManager->activateMonitor(m_name);
}
void Monitor::setTimePos(const QString &pos)
void Monitor::slotSeek(int pos)
{
- //activateMonitor();
if (render == NULL) return;
+ activateMonitor();
render->seekToFrame(pos);
}
void Monitor::checkOverlay()
{
if (m_overlay == NULL) return;
- int pos = render->seekFramePosition();
+ int pos = m_ruler->position();
QPoint zone = m_ruler->zone();
if (pos == zone.x())
m_overlay->setOverlayText(i18n("In Point"));
void Monitor::stop()
{
- disconnect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
if (render) render->stop();
}
void Monitor::start()
{
- if (render && (m_name != "clip" || m_currentClip != NULL)) render->start();
- connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
+ if (!isVisible()) return;
+ if (render) render->start();
}
void Monitor::refreshMonitor(bool visible)
{
if (visible && render) {
- activateMonitor();
- render->doRefresh(); //askForRefresh();
+ if (!activateMonitor()) {
+ // the monitor was already active, simply refreshClipThumbnail
+ render->doRefresh();
+ }
}
}
{
if (render == NULL) return;
activateMonitor();
- if (render->playSpeed() == 0) {
+ if (render->playSpeed() == 0.0) {
m_playAction->setIcon(m_pauseIcon);
render->switchPlay(true);
} else {
m_playAction->setIcon(m_pauseIcon);
}
-void Monitor::slotSetXml(DocClipBase *clip, QPoint zone, const int position)
+void Monitor::updateClipProducer(Mlt::Producer *prod)
+{
+ if (render == NULL) return;
+ render->setProducer(prod, render->seekFramePosition());
+}
+
+void Monitor::slotSetClipProducer(DocClipBase *clip, QPoint zone, bool forceUpdate, int position)
{
if (render == NULL) return;
if (clip == NULL && m_currentClip != NULL) {
+ kDebug()<<"// SETTING NULL CLIP MONITOR";
m_currentClip = NULL;
m_length = -1;
render->setProducer(NULL, -1);
return;
}
- if (clip != m_currentClip) {
+
+ if (clip != m_currentClip || forceUpdate) {
m_currentClip = clip;
if (m_currentClip) activateMonitor();
updateMarkers(clip);
- if (render->setProducer(clip->getProducer(), position) == -1) {
+ Mlt::Producer *prod = NULL;
+ if (clip) prod = clip->getCloneProducer();
+ if (render->setProducer(prod, position) == -1) {
// MLT CONSUMER is broken
kDebug(QtWarningMsg) << "ERROR, Cannot start monitor";
}
} else {
- if (m_currentClip) activateMonitor();
- if (position != -1) render->seek(position);
+ if (m_currentClip) {
+ activateMonitor();
+ if (position == -1) position = render->seekFramePosition();
+ render->seek(position);
+ }
}
if (!zone.isNull()) {
m_ruler->setZone(zone.x(), zone.y());
{
m_timePos->updateTimeCode(m_monitorManager->timecode());
if (render == NULL) return;
- render->resetProfile(profile);
+ if (!render->hasProfile(profile)) {
+ activateMonitor();
+ render->resetProfile(profile);
+ }
if (m_effectWidget)
m_effectWidget->resetProfile(render);
}
if (m_overlay) return;
if (m_monitorRefresh == NULL) {
// Using OpenGL display
-#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
+#ifdef USE_OPENGL
if (m_glWidget->layout()) delete m_glWidget->layout();
m_overlay = new Overlay();
connect(m_overlay, SIGNAL(editMarker()), this, SLOT(slotEditMarker()));
if (m_monitorRefresh) {
m_monitorRefresh->setVisible(!show);
} else {
-#if defined(Q_WS_MAC) || defined(USE_OPEN_GL)
+#ifdef USE_OPENGL
m_glWidget->setVisible(!show);
#endif
}
emit requestFrameForAnalysis(show);
if (show) {
m_effectWidget->getScene()->slotZoomFit();
- render->doRefresh();
}
+ render->doRefresh();
}
}
}
-void MonitorRefresh::resizeEvent(QResizeEvent *event)
-{
- if (m_renderer) m_renderer->doRefresh();
-}
-
Overlay::Overlay(QWidget* parent) :
QLabel(parent)
{