svn path=/branches/KDE4/; revision=2404
setMouseTracking(true);
}
setMouseTracking(true);
}
+void CustomRuler::setZone(QPoint p) {
+ m_zoneStart = p.x();
+ m_zoneEnd = p.y();
+ update();
+}
+
// virtual
void CustomRuler::mousePressEvent(QMouseEvent * event) {
if (event->button() == Qt::RightButton) {
// virtual
void CustomRuler::mousePressEvent(QMouseEvent * event) {
if (event->button() == Qt::RightButton) {
int outPoint() const;
int inPoint() const;
void setDuration(int d);
int outPoint() const;
int inPoint() const;
void setDuration(int d);
+ void setZone(QPoint p);
protected:
virtual void paintEvent(QPaintEvent * /*e*/);
protected:
virtual void paintEvent(QPaintEvent * /*e*/);
m_activeDocument->backupMltPlaylist();
if (m_activeTimeline) {
disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
m_activeDocument->backupMltPlaylist();
if (m_activeTimeline) {
disconnect(m_projectMonitor, SIGNAL(renderPosition(int)), m_activeTimeline, SLOT(moveCursorPos(int)));
+ disconnect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
disconnect(m_projectMonitor, SIGNAL(durationChanged(int)), m_activeTimeline, SLOT(setDuration(int)));
disconnect(m_projectList, SIGNAL(projectModified()), m_activeDocument, SLOT(setModified()));
disconnect(m_activeDocument, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(mousePosition(int)), this, SLOT(slotUpdateMousePosition(int)));
connect(m_projectMonitor, SIGNAL(renderPosition(int)), trackView, SLOT(moveCursorPos(int)));
+ connect(m_projectMonitor, SIGNAL(zoneUpdated(QPoint)), trackView, SLOT(slotSetZone(QPoint)));
connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
connect(doc, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
connect(doc, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
connect(m_projectMonitor, SIGNAL(durationChanged(int)), trackView, SLOT(setDuration(int)));
connect(doc, SIGNAL(addProjectClip(DocClipBase *)), m_projectList, SLOT(slotAddClip(DocClipBase *)));
connect(doc, SIGNAL(addProjectFolder(const QString, const QString &, bool, bool)), m_projectList, SLOT(slotAddFolder(const QString, const QString &, bool, bool)));
m_playIcon = KIcon("media-playback-start");
m_pauseIcon = KIcon("media-playback-pause");
m_playIcon = KIcon("media-playback-start");
m_pauseIcon = KIcon("media-playback-pause");
- QAction *m_rewAction = toolbar->addAction(KIcon("media-seek-backward"), i18n("Rewind"));
- connect(m_rewAction, SIGNAL(triggered()), this, SLOT(slotRewind()));
- QAction *m_rew1Action = toolbar->addAction(KIcon("media-skip-backward"), i18n("Rewind 1 frame"));
- connect(m_rew1Action, SIGNAL(triggered()), this, SLOT(slotRewindOneFrame()));
+ toolbar->addAction(KIcon("kdenlive-zone-start"), i18n("Set zone start"), this, SLOT(slotSetZoneStart()));
+ toolbar->addAction(KIcon("kdenlive-zone-end"), i18n("Set zone end"), this, SLOT(slotSetZoneEnd()));
+
+ toolbar->addAction(KIcon("media-seek-backward"), i18n("Rewind"), this, SLOT(slotRewind()));
+ toolbar->addAction(KIcon("media-skip-backward"), i18n("Rewind 1 frame"), this, SLOT(slotRewindOneFrame()));
QToolButton *playButton = new QToolButton(toolbar);
QMenu *playMenu = new QMenu(i18n("Play..."), this);
QToolButton *playButton = new QToolButton(toolbar);
QMenu *playMenu = new QMenu(i18n("Play..."), this);
m_playAction = playMenu->addAction(m_playIcon, i18n("Play"));
m_playAction->setCheckable(true);
connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
m_playAction = playMenu->addAction(m_playIcon, i18n("Play"));
m_playAction->setCheckable(true);
connect(m_playAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
- QAction *m_playSectionAction = playMenu->addAction(m_playIcon, i18n("Play Section"));
- connect(m_playSectionAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
- QAction *m_loopSectionAction = playMenu->addAction(m_playIcon, i18n("Loop Section"));
- connect(m_loopSectionAction, SIGNAL(triggered()), this, SLOT(slotPlay()));
+ playMenu->addAction(m_playIcon, i18n("Play Section"), this, SLOT(slotPlay()));
+ playMenu->addAction(m_playIcon, i18n("Loop Section"), this, SLOT(slotPlay()));
- QAction *m_fwd1Action = toolbar->addAction(KIcon("media-skip-forward"), i18n("Forward 1 frame"));
- connect(m_fwd1Action, SIGNAL(triggered()), this, SLOT(slotForwardOneFrame()));
- QAction *m_fwdAction = toolbar->addAction(KIcon("media-seek-forward"), i18n("Forward"));
- connect(m_fwdAction, SIGNAL(triggered()), this, SLOT(slotForward()));
+ toolbar->addAction(KIcon("media-skip-forward"), i18n("Forward 1 frame"), this, SLOT(slotForwardOneFrame()));
+ toolbar->addAction(KIcon("media-seek-forward"), i18n("Forward"), this, SLOT(slotForward()));
playButton->setDefaultAction(m_playAction);
playButton->setDefaultAction(m_playAction);
QToolButton *configButton = new QToolButton(toolbar);
QMenu *configMenu = new QMenu(i18n("Misc..."), this);
configButton->setIcon(KIcon("system-run"));
QToolButton *configButton = new QToolButton(toolbar);
QMenu *configMenu = new QMenu(i18n("Misc..."), this);
configButton->setIcon(KIcon("system-run"));
m_contextMenu = new QMenu(this);
m_contextMenu->addMenu(playMenu);
m_contextMenu = new QMenu(this);
m_contextMenu->addMenu(playMenu);
- QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"));
- connect(extractFrame, SIGNAL(triggered()), this, SLOT(slotExtractCurrentFrame()));
+ QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"), this, SLOT(slotExtractCurrentFrame()));
connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
connect(render, SIGNAL(durationChanged(int)), this, SLOT(adjustRulerSize(int)));
connect(render, SIGNAL(rendererPosition(int)), this, SLOT(seekCursor(int)));
if (name != "clip") {
connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
connect(render, SIGNAL(durationChanged(int)), this, SIGNAL(durationChanged(int)));
if (name != "clip") {
connect(render, SIGNAL(rendererPosition(int)), this, SIGNAL(renderPosition(int)));
connect(render, SIGNAL(durationChanged(int)), this, SIGNAL(durationChanged(int)));
- QAction *splitView = m_contextMenu->addAction(KIcon("document-new"), i18n("Split view"));
+ QAction *splitView = m_contextMenu->addAction(KIcon("document-new"), i18n("Split view"), render, SLOT(slotSplitView(bool)));
splitView->setCheckable(true);
splitView->setCheckable(true);
- connect(splitView, SIGNAL(toggled(bool)), render, SLOT(slotSplitView(bool)));
configMenu->addAction(splitView);
} else {
configMenu->addAction(splitView);
} else {
- QAction *setThumbFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Set current image as thumbnail"));
- connect(setThumbFrame, SIGNAL(triggered()), this, SLOT(slotSetThumbFrame()));
+ QAction *setThumbFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Set current image as thumbnail"), this, SLOT(slotSetThumbFrame()));
configMenu->addAction(setThumbFrame);
}
configMenu->addSeparator();
configMenu->addAction(setThumbFrame);
}
configMenu->addSeparator();
- QAction *resize1Action = configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"));
- connect(resize1Action, SIGNAL(triggered()), this, SLOT(slotSetSizeOneToOne()));
- QAction *resize2Action = configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"));
- connect(resize2Action, SIGNAL(triggered()), this, SLOT(slotSetSizeOneToTwo()));
+ configMenu->addAction(KIcon("transform-scale"), i18n("Resize (100%)"), this, SLOT(slotSetSizeOneToOne()));
+ configMenu->addAction(KIcon("transform-scale"), i18n("Resize (50%)"), this, SLOT(slotSetSizeOneToTwo()));
//render->createVideoXWindow(ui.video_frame->winId(), -1);
m_length = 0;
m_monitorRefresh->show();
//render->createVideoXWindow(ui.video_frame->winId(), -1);
m_length = 0;
m_monitorRefresh->show();
m_ruler->setZone(start, end);
}
m_ruler->setZone(start, end);
}
+void Monitor::slotSetZoneStart() {
+ m_ruler->setZone(m_position, -1);
+ emit zoneUpdated(m_ruler->zone());
+}
+
+void Monitor::slotSetZoneEnd() {
+ m_ruler->setZone(-1, m_position);
+ emit zoneUpdated(m_ruler->zone());
+}
+
// virtual
void Monitor::mousePressEvent(QMouseEvent * event) {
if (event->button() != Qt::RightButton) {
// virtual
void Monitor::mousePressEvent(QMouseEvent * event) {
if (event->button() != Qt::RightButton) {
void slotSetThumbFrame();
void slotSetSizeOneToOne();
void slotSetSizeOneToTwo();
void slotSetThumbFrame();
void slotSetSizeOneToOne();
void slotSetSizeOneToTwo();
+ void slotSetZoneStart();
+ void slotSetZoneEnd();
public slots:
void slotOpenFile(const QString &);
public slots:
void slotOpenFile(const QString &);
void durationChanged(int);
void refreshClipThumbnail(const QString &);
void adjustMonitorSize();
void durationChanged(int);
void refreshClipThumbnail(const QString &);
void adjustMonitorSize();
+ void zoneUpdated(QPoint);
}
void SmallRuler::setZone(int start, int end) {
}
void SmallRuler::setZone(int start, int end) {
- m_zoneStart = start;
- m_zoneEnd = end;
+ if (start != -1) {
+ if (end != -1 && start >= end) return;
+ else if (end == -1 && start >= m_zoneEnd) return;
+ m_zoneStart = start;
+ }
+ if (end != -1) {
+ if (start != -1 && end <= start) end = m_zoneEnd;
+ else if (start == -1 && end <= m_zoneStart) end = m_zoneEnd;
+ m_zoneEnd = end;
+ }
+QPoint SmallRuler::zone() {
+ return QPoint(m_zoneStart, m_zoneEnd);
+}
+
// virtual
void SmallRuler::mousePressEvent(QMouseEvent * event) {
const int pos = event->x() / m_scale;
// virtual
void SmallRuler::mousePressEvent(QMouseEvent * event) {
const int pos = event->x() / m_scale;
virtual void mouseMoveEvent(QMouseEvent * event);
void adjustScale(int maximum);
void setZone(int start, int end);
virtual void mouseMoveEvent(QMouseEvent * event);
void adjustScale(int maximum);
void setZone(int start, int end);
protected:
virtual void paintEvent(QPaintEvent *e);
protected:
virtual void paintEvent(QPaintEvent *e);
return m_ruler->outPoint();
}
return m_ruler->outPoint();
}
+void TrackView::slotSetZone(QPoint p) {
+ m_ruler->setZone(p);
+}
+
void TrackView::slotClipItemSelected(ClipItem*c) {
emit clipItemSelected(c);
}
void TrackView::slotClipItemSelected(ClipItem*c) {
emit clipItemSelected(c);
}
void slotDeleteClip(const QString &clipId);
void slotChangeZoom(int factor);
void setDuration(int dur);
void slotDeleteClip(const QString &clipId);
void slotChangeZoom(int factor);
void setDuration(int dur);
+ void slotSetZone(QPoint p);
private:
Ui::TimeLine_UI *view;
private:
Ui::TimeLine_UI *view;