moving cutter tool over a clip now shows the frame to be cut in clip monitor

svn path=/branches/KDE4/; revision=2268
parent 44f8eaa9
......@@ -226,8 +226,8 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
if (m_tool == RAZORTOOL) {
setCursor(m_razorCursor);
QGraphicsView::mouseMoveEvent(event);
return;
//QGraphicsView::mouseMoveEvent(event);
//return;
}
QList<QGraphicsItem *> itemList = items(event->pos());
......@@ -245,6 +245,14 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) {
if (item && event->buttons() == Qt::NoButton) {
AbstractClipItem *clip = (AbstractClipItem*) item;
if (m_tool == RAZORTOOL) {
// razor tool over a clip, display current frame in monitor
if (item->type() == AVWIDGET) {
emit showClipFrame(((ClipItem *) item)->baseClip(), mapToScene(event->pos()).x() / m_scale - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
}
QGraphicsView::mouseMoveEvent(event);
return;
}
opMode = clip->operationMode(mapToScene(event->pos()), m_scale);
double size = 8;
if (opMode == m_moveOpMode) {
......@@ -454,7 +462,10 @@ void CustomTrackView::mousePressEvent(QMouseEvent * event) {
QGraphicsItem *item = collisionList.at(i);
if (item->type() == AVWIDGET || item->type() == TRANSITIONWIDGET) {
if (m_tool == RAZORTOOL) {
if (item->type() == TRANSITIONWIDGET) return;
if (item->type() == TRANSITIONWIDGET) {
emit displayMessage(i18n("Cannot cut a transition"), ErrorMessage);
return;
}
AbstractClipItem *clip = (AbstractClipItem *) item;
ItemInfo info;
info.startPos = clip->startPos();
......
......@@ -172,6 +172,7 @@ signals:
void activateDocumentMonitor();
void trackHeightChanged();
void displayMessage(const QString, MessageType);
void showClipFrame(DocClipBase *, const int);
};
#endif
......
......@@ -829,6 +829,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
disconnect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
disconnect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
disconnect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
disconnect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
......@@ -839,12 +841,12 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
disconnect(m_activeTimeline->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
}
m_activeDocument->setRenderer(NULL);
disconnect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
disconnect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *)));
m_clipMonitor->stop();
}
m_monitorManager->resetProfiles(doc->profilePath());
m_projectList->setDocument(doc);
connect(m_projectList, SIGNAL(clipSelected(const QDomElement &)), m_clipMonitor, SLOT(slotSetXml(const QDomElement &)));
connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(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)));
......@@ -870,6 +872,8 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
connect(trackView->projectView(), SIGNAL(zoomOut()), this, SLOT(slotZoomOut()));
connect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
connect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
connect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), trackView->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
connect(effectStack, SIGNAL(removeEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, QDomElement)));
......
......@@ -52,7 +52,7 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, QWid
m_view.marker_comment->selectAll();
m_view.marker_comment->setFocus();
QPixmap p;
QPixmap p((int) (100 * m_dar), 100);
QString colour = clip->getProperty("colour");
switch (m_clip->clipType()) {
case VIDEO:
......@@ -66,11 +66,9 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, QWid
break;
case COLOR:
colour = colour.replace(0, 2, "#");
p = QPixmap(m_view.clip_thumb->width(), m_view.clip_thumb->height());
p.fill(QColor(colour.left(7)));
break;
default:
p = QPixmap(m_view.clip_thumb->width(), m_view.clip_thumb->height());
p.fill(Qt::black);
}
if (!p.isNull()) {
......
......@@ -33,9 +33,10 @@
#include "renderer.h"
#include "monitormanager.h"
#include "smallruler.h"
#include "docclipbase.h"
Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent)
: QWidget(parent), render(NULL), m_monitorManager(manager), m_name(name), m_isActive(false) {
: QWidget(parent), render(NULL), m_monitorManager(manager), m_name(name), m_isActive(false), m_currentClip(NULL) {
ui.setupUi(this);
m_scale = 1;
m_ruler = new SmallRuler();
......@@ -263,18 +264,22 @@ void Monitor::slotPlay() {
m_playAction->setIcon(m_pauseIcon);
}
void Monitor::slotSetXml(const QDomElement &e) {
void Monitor::slotSetXml(DocClipBase *clip, const int position) {
if (render == NULL) return;
if (!m_isActive) m_monitorManager->activateMonitor(m_name);
if (e.isNull()) return;
QDomDocument doc;
QDomElement westley = doc.createElement("westley");
doc.appendChild(westley);
westley.appendChild(e);
render->setSceneList(doc, 0);
m_ruler->slotNewValue(0);
m_timePos->setText("00:00:00:00");
m_position = 0;
if (!clip) return;
if (clip != m_currentClip) {
m_currentClip = clip;
QDomDocument doc;
QDomElement westley = doc.createElement("westley");
doc.appendChild(westley);
westley.appendChild(doc.importNode(m_currentClip->toXML(), true));
render->setSceneList(doc, 0);
m_ruler->slotNewValue(0);
m_timePos->setText("00:00:00:00");
m_position = 0;
}
if (position != -1) render->seek(GenTime(position, render->fps()));
}
void Monitor::slotOpenFile(const QString &file) {
......
......@@ -31,6 +31,7 @@
class MonitorManager;
class Render;
class SmallRuler;
class DocClipBase;
class MonitorRefresh : public QWidget {
Q_OBJECT
......@@ -73,6 +74,7 @@ private:
KRestrictedLine *m_timePos;
QAction *m_playAction;
QMenu *m_contextMenu;
DocClipBase *m_currentClip;
private slots:
void adjustRulerSize(int length);
......@@ -82,7 +84,7 @@ private slots:
public slots:
void slotOpenFile(const QString &);
void slotSetXml(const QDomElement &e);
void slotSetXml(DocClipBase *clip, const int position = -1);
void initMonitor();
void refreshMonitor(bool visible);
void slotSeek(int pos);
......
......@@ -129,7 +129,7 @@ ProjectList::~ProjectList() {
void ProjectList::slotEditClip() {
ProjectItem *item = static_cast <ProjectItem*>(listView->currentItem());
if (item && !item->isGroup()) emit clipSelected(item->toXml());
if (item && !item->isGroup()) emit clipSelected(item->referencedClip());
emit showClipProperties(item->referencedClip());
}
......@@ -144,11 +144,11 @@ void ProjectList::slotClipSelected() {
if (item && !item->isGroup()) {
if (item == m_selectedItem) {
// if user clicked on the active clip item, just focus monitor, don't update it.
emit clipSelected(QDomElement());
emit clipSelected(NULL);
return;
}
m_selectedItem = item;
emit clipSelected(item->toXml());
emit clipSelected(item->referencedClip());
}
}
......
......@@ -154,7 +154,7 @@ private slots:
signals:
void clipSelected(const QDomElement &);
void clipSelected(DocClipBase *);
void getFileProperties(const QDomElement&, int);
void receivedClipDuration(int, int);
void showClipProperties(DocClipBase *);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment