if (m_tool == RAZORTOOL) {
setCursor(m_razorCursor);
- QGraphicsView::mouseMoveEvent(event);
- return;
+ //QGraphicsView::mouseMoveEvent(event);
+ //return;
}
QList<QGraphicsItem *> itemList = items(event->pos());
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) {
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();
void activateDocumentMonitor();
void trackHeightChanged();
void displayMessage(const QString, MessageType);
+ void showClipFrame(DocClipBase *, const int);
};
#endif
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)));
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)));
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)));
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:
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()) {
#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();
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) {
class MonitorManager;
class Render;
class SmallRuler;
+class DocClipBase;
class MonitorRefresh : public QWidget {
Q_OBJECT
KRestrictedLine *m_timePos;
QAction *m_playAction;
QMenu *m_contextMenu;
+ DocClipBase *m_currentClip;
private slots:
void adjustRulerSize(int length);
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);
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());
}
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());
}
}
signals:
- void clipSelected(const QDomElement &);
+ void clipSelected(DocClipBase *);
void getFileProperties(const QDomElement&, int);
void receivedClipDuration(int, int);
void showClipProperties(DocClipBase *);