return true;
}
-void CustomTrackView::slotAddGuide()
+void CustomTrackView::slotAddGuide(bool dialog)
{
CommentedTime marker(GenTime(m_cursorPos, m_document->fps()), i18n("Guide"));
- MarkerDialog d(NULL, marker, m_document->timecode(), i18n("Add Guide"), this);
- if (d.exec() != QDialog::Accepted) return;
- if (addGuide(d.newMarker().time(), d.newMarker().comment())) {
- EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), d.newMarker().time(), d.newMarker().comment(), false);
+ if (dialog) {
+ MarkerDialog d(NULL, marker, m_document->timecode(), i18n("Add Guide"), this);
+ if (d.exec() != QDialog::Accepted) return;
+ marker.setComment(d.newMarker().comment());
+ } else {
+ marker.setComment(m_document->timecode().getDisplayTimecodeFromFrames(m_cursorPos, false));
+ }
+ if (addGuide(marker.time(), marker.comment())) {
+ EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), marker.time(), marker.comment(), false);
m_commandStack->push(command);
}
}
void slotSwitchTrackVideo(int ix);
void slotSwitchTrackLock(int ix);
void slotUpdateClip(const QString &clipId, bool reload = true);
+
+ /** @brief Creates a AddClipCommand to add, edit or delete a marker.
+ * @param id Id of the marker's clip
+ * @param t Position of the marker
+ * @param c Comment of the marker */
void slotAddClipMarker(const QString &id, GenTime t, QString c);
bool addGuide(const GenTime pos, const QString &comment);
- void slotAddGuide();
+
+ /** @brief Shows a dialog for adding a guide.
+ * @param dialog (default = true) false = do not show the dialog but use current position as position and comment */
+ void slotAddGuide(bool dialog = true);
void slotEditGuide(CommentedTime guide);
void slotEditGuide(int guidePos = -1);
void slotDeleteGuide(int guidePos = -1);
collection->addAction("edit_clip_marker", editClipMarker);
connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
+ KAction *addMarkerGuideQuickly = new KAction(KIcon("bookmark-new"), i18n("Add Marker/Guide quickly"), this);
+ addMarkerGuideQuickly->setShortcut(Qt::Key_Asterisk);
+ collection->addAction("add_marker_guide_quickly", addMarkerGuideQuickly);
+ connect(addMarkerGuideQuickly, SIGNAL(triggered(bool)), this, SLOT(slotAddMarkerGuideQuickly()));
+
KAction* splitAudio = new KAction(KIcon("document-new"), i18n("Split Audio"), this);
collection->addAction("split_audio", splitAudio);
connect(splitAudio, SIGNAL(triggered(bool)), this, SLOT(slotSplitAudio()));
}
}
+void MainWindow::slotAddMarkerGuideQuickly()
+{
+ if (!m_activeTimeline || !m_activeDocument)
+ return;
+
+ if (m_clipMonitor->isActive()) {
+ DocClipBase *clip = m_clipMonitor->activeClip();
+ GenTime pos = m_clipMonitor->position();
+
+ if (!clip) {
+ m_messageLabel->setMessage(i18n("Cannot find clip to add marker"), ErrorMessage);
+ return;
+ }
+
+ m_activeTimeline->projectView()->slotAddClipMarker(clip->getId(), pos, m_activeDocument->timecode().getDisplayTimecode(pos, false));
+ } else {
+ m_activeTimeline->projectView()->slotAddGuide(false);
+ }
+}
+
void MainWindow::slotAddGuide()
{
if (m_activeTimeline)
void slotDeleteClipMarker();
void slotDeleteAllClipMarkers();
void slotEditClipMarker();
+
+ /** @brief Adds marker or auide at the current position without showing the marker dialog.
+ *
+ * Adds a marker if clip monitor is active, otherwise a guide.
+ * The comment is set to the current position (therefore not dialog).
+ * This can be useful to mark something during playback. */
+ void slotAddMarkerGuideQuickly();
void slotCutTimelineClip();
void slotInsertClipOverwrite();
void slotSelectTimelineClip();