#include <QIntValidator>
-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),
m_monitorManager(manager),
m_currentClip(NULL),
- m_ruler(new SmallRuler()),
+ m_ruler(new SmallRuler(m_monitorManager)),
m_overlay(NULL),
m_isActive(false),
m_scale(1),
//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());
#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
//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);
void Monitor::updateMarkers(DocClipBase *source)
{
- if (source == m_currentClip) {
+ if (source == m_currentClip && source != NULL) {
m_markerMenu->clear();
QList <CommentedTime> markers = m_currentClip->commentedSnapMarkers();
if (!markers.isEmpty()) {
{
if (m_dragStarted) {
if (m_ui.video_frame->underMouse()) {
- slotPlay();
+ if (isActive()) slotPlay();
+ else activateMonitor();
} else QWidget::mouseReleaseEvent(event);
m_dragStarted = false;
}
mimeData->setData("kdenlive/clip", data);
drag->setMimeData(mimeData);
QPixmap pix = m_currentClip->thumbnail();
- kDebug() << "/ / / /CLIP DRAGGED PIXMAP: " << pix.width() << "x" << pix.height();
drag->setPixmap(pix);
drag->setHotSpot(QPoint(0, 50));
drag->start(Qt::MoveAction);
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)
m_playAction->setIcon(m_pauseIcon);
}
-void Monitor::slotSetXml(DocClipBase *clip, const int position)
+void Monitor::slotSetXml(DocClipBase *clip, QPoint zone, const int position)
{
if (render == NULL) return;
activateMonitor();
- if (!clip && m_currentClip != NULL) {
+ if (clip == NULL && m_currentClip != NULL) {
m_currentClip = NULL;
render->setProducer(NULL, -1);
return;
}
if (clip != m_currentClip) {
m_currentClip = clip;
- updateMarkers(clip);
+ updateMarkers(clip);
if (render->setProducer(clip->producer(), position) == -1) {
// MLT CONSUMER is broken
emit blockMonitors();
}
} else if (position != -1) render->seek(GenTime(position, m_monitorManager->timecode().fps()));
+ if (!zone.isNull()) {
+ m_ruler->setZone(zone.x(), zone.y());
+ render->seek(GenTime(zone.x(), m_monitorManager->timecode().fps()));
+ }
}
void Monitor::slotOpenFile(const QString &file)
}
-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)