QWidget *widget) {
painter->setOpacity(m_opacity);
QBrush paintColor = brush();
-
if (isSelected()) paintColor = QBrush(QColor(79, 93, 121));
QRectF br = rect();
double scale = br.width() / m_cropDuration.frames(m_fps);
return MOVE;
}
+QList <GenTime> ClipItem::snapMarkers() {
+ QList < GenTime > snaps;
+ QList < GenTime > markers = baseClip()->snapMarkers();
+ GenTime pos;
+ double framepos;
+
+ for (int i = 0; i < markers.size(); i++) {
+ pos = markers.at(i) - cropStart();
+ if (pos > GenTime()) {
+ if (pos > duration()) break;
+ else snaps.append(pos + startPos());
+ }
+ }
+ return snaps;
+}
+
void ClipItem::slotPrepareAudioThumb(double pixelForOneFrame, QPainterPath path, int startpixel, int endpixel) {
int channels = 2;
void resetThumbs();
/** update clip properties from base clip */
void refreshClip();
+ /** Returns a list of times for this clip's markers */
+ QList <GenTime> snapMarkers();
protected:
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event);
GenTime end = item->endPos();
m_snapPoints.append(start);
m_snapPoints.append(end);
+ QList < GenTime > markers = item->snapMarkers();
+ for (int i = 0; i < markers.size(); ++i) {
+ GenTime t = markers.at(i);
+ m_snapPoints.append(t);
+ if (t > offset) m_snapPoints.append(t - offset);
+ }
if (offset != GenTime()) {
if (start > offset) m_snapPoints.append(start - offset);
if (end > offset) m_snapPoints.append(end - offset);
m_commandStack->push(command);
}
+void CustomTrackView::slotDeleteClipMarker() {
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
+ if (itemList.count() != 1) {
+ kDebug() << "// CANNOT DELETE MARKER IF MORE TAN ONE CLIP IS SELECTED....";
+ return;
+ }
+ AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
+ if (item->type() != AVWIDGET) return;
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ if (item->startPos() > pos || item->endPos() < pos) return;
+ ClipItem *clip = (ClipItem *) item;
+ int id = clip->baseClip()->getId();
+ GenTime position = pos - item->startPos() + item->cropStart();
+ QString comment = clip->baseClip()->markerComment(position);
+ if (comment.isEmpty()) return;
+ AddMarkerCommand *command = new AddMarkerCommand(this, comment, QString(), id, position, true);
+ m_commandStack->push(command);
+}
+
+void CustomTrackView::slotEditClipMarker() {
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
+ if (itemList.count() != 1) {
+ kDebug() << "// CANNOT DELETE MARKER IF MORE TAN ONE CLIP IS SELECTED....";
+ return;
+ }
+ AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
+ if (item->type() != AVWIDGET) return;
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ if (item->startPos() > pos || item->endPos() < pos) return;
+ ClipItem *clip = (ClipItem *) item;
+ int id = clip->baseClip()->getId();
+ GenTime position = pos - item->startPos() + item->cropStart();
+ QString oldcomment = clip->baseClip()->markerComment(position);
+ if (oldcomment.isEmpty()) return;
+ QString comment = QInputDialog::getText(this, i18n("Add Marker"), i18n("Enter text for marker on clip <b>%1</b>", clip->clipName()), QLineEdit::Normal, oldcomment);
+ if (comment.isEmpty()) return;
+ AddMarkerCommand *command = new AddMarkerCommand(this, oldcomment, comment, id, position, true);
+ m_commandStack->push(command);
+}
+
void CustomTrackView::addMarker(const int id, const GenTime &pos, const QString comment) {
DocClipBase *base = m_document->clipManager()->getClipById(id);
if (!comment.isEmpty()) base->addSnapMarker(pos, comment);
void addClip(QDomElement xml, int clipId, ItemInfo info);
void deleteClip(ItemInfo info);
void slotAddClipMarker();
+ void slotEditClipMarker();
+ void slotDeleteClipMarker();
void addMarker(const int id, const GenTime &pos, const QString comment);
void setScale(double scaleFactor);
void deleteClip(int clipId);
node.normalize();
if (element.tagName() != "kdenliveclip") {
kWarning() <<
- "DocClipBase::createClip() element has unknown tagName : " <<
- element.tagName() << endl;
+ "DocClipBase::createClip() element has unknown tagName : " << element.tagName();
return 0;
}
n = n.nextSibling();
}
if (clip == 0) {
- kWarning() << "DocClipBase::createClip() unable to create clip" <<
- endl;
+ kWarning() << "DocClipBase::createClip() unable to create clip";
} else {
// setup DocClipBase specifics of the clip.
QMap <QString, QString> props;
}
if ((it != m_snapMarkers.end()) && ((*it).time() == time)) {
- kError() <<
- "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo"
- << endl;
+ (*it).setComment(comment);
+ //kError() << "trying to add Snap Marker that already exists, this will cause inconsistancies with undo/redo";
} else {
CommentedTime t(time, comment);
m_snapMarkers.insert(it, t);
if (it != m_snapMarkers.end()) {
(*it).setComment(comment);
} else {
- kError() <<
- "trying to edit Snap Marker that does not already exists" << endl;
+ kError() << "trying to edit Snap Marker that does not already exists";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="15">
+<gui name="kdenlive" version="16">
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
<Action name="clear" />
<Menu name="timeline" ><text>Timeline</text>
<Action name="cut_timeline_clip" />
<Action name="delete_timeline_clip" />
- <Action name="add_clip_marker" />
+ <Menu name="marker_menu" ><text>Markers</text>
+ <Action name="add_clip_marker" />
+ <Action name="edit_clip_marker" />
+ <Action name="delete_clip_marker" />
+ </Menu>
<Menu name="video_effects_menu" ><text>Add Video Effect</text>
</Menu>
<Menu name="audio_effects_menu" ><text>Add Audio Effect</text>
action = actionCollection()->action("delete_timeline_clip");
m_timelineContextClipMenu->addAction(action);
- action = actionCollection()->action("add_clip_marker");
- m_timelineContextClipMenu->addAction(action);
+ QMenu *markersMenu = (QMenu*)(factory()->container("marker_menu", this));
+ m_timelineContextClipMenu->addMenu(markersMenu);
m_timelineContextClipMenu->addMenu(videoEffectsMenu);
m_timelineContextClipMenu->addMenu(audioEffectsMenu);
m_timelineContextClipMenu->addMenu(customEffectsMenu);
actionCollection()->addAction("add_clip_marker", addClipMarker);
connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
+ KAction* deleteClipMarker = new KAction(KIcon("edit-delete"), i18n("Delete Marker from Clip"), this);
+ actionCollection()->addAction("delete_clip_marker", deleteClipMarker);
+ connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
+
+ KAction* editClipMarker = new KAction(KIcon("edit-delete"), i18n("Edit Marker"), this);
+ actionCollection()->addAction("edit_clip_marker", editClipMarker);
+ connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
+
KStandardAction::quit(this, SLOT(queryQuit()),
actionCollection());
}
}
+void MainWindow::slotDeleteClipMarker() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->projectView()->slotDeleteClipMarker();
+ }
+}
+
+void MainWindow::slotEditClipMarker() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->projectView()->slotEditClipMarker();
+ }
+}
+
void MainWindow::slotCutTimelineClip() {
TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) {
void slotRemoveTab();
void slotDeleteTimelineClip();
void slotAddClipMarker();
+ void slotDeleteClipMarker();
+ void slotEditClipMarker();
void slotCutTimelineClip();
void slotAddVideoEffect(QAction *result);
void slotAddAudioEffect(QAction *result);