#include "addmarkercommand.h"
#include "customtrackview.h"
-AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const int id, const GenTime &pos, bool doIt) : m_view(view), m_oldcomment(oldcomment), m_comment(comment), m_id(id), m_pos(pos), m_doIt(doIt) {
+AddMarkerCommand::AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const int id, const GenTime &pos, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_oldcomment(oldcomment), m_comment(comment), m_id(id), m_pos(pos), m_doIt(doIt) {
if (m_comment.isEmpty()) setText(i18n("Delete marker"));
else if (m_oldcomment.isEmpty()) setText(i18n("Add marker"));
else setText(i18n("Edit marker"));
class AddMarkerCommand : public QUndoCommand {
public:
- AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const int id, const GenTime &pos, bool doIt);
+ AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const int id, const GenTime &pos, bool doIt, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
#include "addtimelineclipcommand.h"
#include "customtrackview.h"
-AddTimelineClipCommand::AddTimelineClipCommand(CustomTrackView *view, QDomElement xml, int clipId, ItemInfo info, bool doIt, bool doRemove)
- : m_view(view), m_xml(xml), m_clipId(clipId), m_clipInfo(info), m_doIt(doIt), m_remove(doRemove) {
+AddTimelineClipCommand::AddTimelineClipCommand(CustomTrackView *view, QDomElement xml, int clipId, ItemInfo info, bool doIt, bool doRemove, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_xml(xml), m_clipId(clipId), m_clipInfo(info), m_doIt(doIt), m_remove(doRemove) {
if (!m_remove) setText(i18n("Add timeline clip"));
else setText(i18n("Delete timeline clip"));
}
class AddTimelineClipCommand : public QUndoCommand {
public:
- AddTimelineClipCommand(CustomTrackView *view, QDomElement xml, int clipId, ItemInfo info, bool doIt, bool doRemove);
+ AddTimelineClipCommand(CustomTrackView *view, QDomElement xml, int clipId, ItemInfo info, bool doIt, bool doRemove, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
#include "addtransitioncommand.h"
#include "customtrackview.h"
-AddTransitionCommand::AddTransitionCommand(CustomTrackView *view, ItemInfo info, int transitiontrack, QDomElement params, bool remove, bool doIt) : m_view(view), m_info(info), m_track(transitiontrack), m_params(params), m_remove(remove), m_doIt(doIt) {
+AddTransitionCommand::AddTransitionCommand(CustomTrackView *view, ItemInfo info, int transitiontrack, QDomElement params, bool remove, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_info(info), m_track(transitiontrack), m_params(params), m_remove(remove), m_doIt(doIt) {
if (m_remove) setText(i18n("Delete transition from clip"));
else setText(i18n("Add transition to clip"));
}
class AddTransitionCommand : public QUndoCommand {
public:
- AddTransitionCommand(CustomTrackView *view, ItemInfo info, int transitiontrack, QDomElement params, bool remove, bool doIt);
+ AddTransitionCommand(CustomTrackView *view, ItemInfo info, int transitiontrack, QDomElement params, bool remove, bool doIt, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
m_contextMenu = new QMenu(this);
QAction *addGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Add Guide"));
connect(addGuide, SIGNAL(triggered()), m_view, SLOT(slotAddGuide()));
- QAction *delGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Delete Guide"));
- connect(delGuide, SIGNAL(triggered()), m_view, SLOT(slotDeleteGuide()));
- QAction *editGuide = m_contextMenu->addAction(KIcon("document-new"), i18n("Edit Guide"));
+ QAction *editGuide = m_contextMenu->addAction(KIcon("document-properties"), i18n("Edit Guide"));
connect(editGuide, SIGNAL(triggered()), m_view, SLOT(slotEditGuide()));
+ QAction *delGuide = m_contextMenu->addAction(KIcon("edit-delete"), i18n("Delete Guide"));
+ connect(delGuide, SIGNAL(triggered()), m_view, SLOT(slotDeleteGuide()));
+ QAction *delAllGuides = m_contextMenu->addAction(KIcon("edit-delete"), i18n("Delete All Guides"));
+ connect(delAllGuides, SIGNAL(triggered()), m_view, SLOT(slotDeleteAllGuides()));
setMouseTracking(true);
}
}
void CustomTrackView::deleteSelectedClips() {
+
+ QUndoCommand *deleteSelected = new QUndoCommand();
+ deleteSelected->setText("Delete selected items");
+
QList<QGraphicsItem *> itemList = scene()->selectedItems();
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
info.startPos = item->startPos();
info.endPos = item->endPos();
info.track = item->track();
- AddTimelineClipCommand *command = new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), info, true, true);
- m_commandStack->push(command);
+ new AddTimelineClipCommand(this, item->xml(), item->clipProducer(), info, true, true, deleteSelected);
} else if (itemList.at(i)->type() == TRANSITIONWIDGET) {
Transition *item = (Transition *) itemList.at(i);
ItemInfo info;
info.startPos = item->startPos();
info.endPos = item->endPos();
info.track = item->track();
- AddTransitionCommand *command = new AddTransitionCommand(this, info, item->transitionEndTrack(), QDomElement(), true, true);
- m_commandStack->push(command);
+ new AddTransitionCommand(this, info, item->transitionEndTrack(), QDomElement(), true, true, deleteSelected);
}
}
+ m_commandStack->push(deleteSelected);
}
void CustomTrackView::cutSelectedClips() {
}
AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
if (item->type() != AVWIDGET) {
- emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
+ emit displayMessage(i18n("No clip selected"), ErrorMessage);
return;
}
GenTime pos = GenTime(m_cursorPos, m_document->fps());
m_commandStack->push(command);
}
+void CustomTrackView::slotDeleteAllClipMarkers() {
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
+ if (itemList.count() != 1) {
+ emit displayMessage(i18n("Cannot delete marker if more than one clip is selected"), ErrorMessage);
+ kDebug() << "// CANNOT DELETE MARKER IF MORE TAN ONE CLIP IS SELECTED....";
+ return;
+ }
+ AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
+ if (item->type() != AVWIDGET) {
+ emit displayMessage(i18n("No clip selected"), ErrorMessage);
+ return;
+ }
+
+ ClipItem *clip = static_cast <ClipItem *>(item);
+ QList <CommentedTime> markers = clip->baseClip()->commentedSnapMarkers();
+
+ if (markers.isEmpty()) {
+ emit displayMessage(i18n("Clip has no markers"), ErrorMessage);
+ return;
+ }
+ int id = clip->baseClip()->getId();
+ QUndoCommand *deleteMarkers = new QUndoCommand();
+ deleteMarkers->setText("Delete clip markers");
+
+ for (int i = 0; i < markers.size(); i++) {
+ new AddMarkerCommand(this, markers.at(i).comment(), QString(), id, markers.at(i).time(), true, deleteMarkers);
+ }
+ m_commandStack->push(deleteMarkers);
+}
+
void CustomTrackView::slotEditClipMarker() {
QList<QGraphicsItem *> itemList = scene()->selectedItems();
if (itemList.count() != 1) {
if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
}
+void CustomTrackView::slotDeleteAllGuides() {
+ QUndoCommand *deleteAll = new QUndoCommand();
+ deleteAll->setText("Delete all guides");
+ for (int i = 0; i < m_guides.count(); i++) {
+ EditGuideCommand *command = new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(), QString(), true, deleteAll);
+ }
+ m_commandStack->push(deleteAll);
+}
+
void CustomTrackView::setTool(PROJECTTOOL tool) {
m_tool = tool;
}
void slotAddClipMarker();
void slotEditClipMarker();
void slotDeleteClipMarker();
+ void slotDeleteAllClipMarkers();
void addMarker(const int id, const GenTime &pos, const QString comment);
void setScale(double scaleFactor);
void deleteClip(int clipId);
void slotEditGuide(CommentedTime guide);
void slotEditGuide();
void slotDeleteGuide();
+ void slotDeleteAllGuides();
void editGuide(const GenTime oldPos, const GenTime pos, const QString &comment);
protected:
#include "editguidecommand.h"
#include "customtrackview.h"
-EditGuideCommand::EditGuideCommand(CustomTrackView *view, const GenTime oldPos, const QString &oldcomment, const GenTime pos, const QString &comment, bool doIt) : m_view(view), m_oldPos(oldPos), m_oldcomment(oldcomment), m_pos(pos), m_comment(comment), m_doIt(doIt) {
+EditGuideCommand::EditGuideCommand(CustomTrackView *view, const GenTime oldPos, const QString &oldcomment, const GenTime pos, const QString &comment, bool doIt, QUndoCommand * parent) : QUndoCommand(parent), m_view(view), m_oldPos(oldPos), m_oldcomment(oldcomment), m_pos(pos), m_comment(comment), m_doIt(doIt) {
if (m_oldcomment.isEmpty()) setText(i18n("Add guide"));
else if (m_oldPos == m_pos) setText(i18n("Edit guide"));
else if (m_pos <= GenTime()) setText(i18n("Delete guide"));
class EditGuideCommand : public QUndoCommand {
public:
- EditGuideCommand(CustomTrackView *view, const GenTime oldPos, const QString &oldcomment, const GenTime pos, const QString &comment, bool doIt);
+ EditGuideCommand(CustomTrackView *view, const GenTime oldPos, const QString &oldcomment, const GenTime pos, const QString &comment, bool doIt, QUndoCommand * parent = 0);
virtual void undo();
virtual void redo();
<Action name="add_clip_marker" />
<Action name="edit_clip_marker" />
<Action name="delete_clip_marker" />
+ <Action name="delete_all_clip_markers" />
</Menu>
+ <Menu name="guide_menu" ><text>Guides</text>
+ <Action name="add_guide" />
+ <Action name="edit_guide" />
+ <Action name="delete_guide" />
+ <Action name="delete_all_guides" />
+ </Menu>
+ <Separator />
<Menu name="video_effects_menu" ><text>Add Video Effect</text>
</Menu>
<Menu name="audio_effects_menu" ><text>Add Audio Effect</text>
actionCollection()->addAction("delete_clip_marker", deleteClipMarker);
connect(deleteClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotDeleteClipMarker()));
+ KAction* deleteAllClipMarkers = new KAction(KIcon("edit-delete"), i18n("Delete All Markers from Clip"), this);
+ actionCollection()->addAction("delete_all_clip_markers", deleteAllClipMarkers);
+ connect(deleteAllClipMarkers, SIGNAL(triggered(bool)), this, SLOT(slotDeleteAllClipMarkers()));
+
KAction* editClipMarker = new KAction(KIcon("document-properties"), i18n("Edit Marker"), this);
actionCollection()->addAction("edit_clip_marker", editClipMarker);
connect(editClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotEditClipMarker()));
+ KAction *addGuide = new KAction(KIcon("document-new"), i18n("Add Guide"), this);
+ actionCollection()->addAction("add_guide", addGuide);
+ connect(addGuide, SIGNAL(triggered()), this, SLOT(slotAddGuide()));
+
+ QAction *delGuide = new KAction(KIcon("edit-delete"), i18n("Delete Guide"), this);
+ actionCollection()->addAction("delete_guide", delGuide);
+ connect(delGuide, SIGNAL(triggered()), this, SLOT(slotDeleteGuide()));
+
+ QAction *editGuide = new KAction(KIcon("document-properties"), i18n("Edit Guide"), this);
+ actionCollection()->addAction("edit_guide", editGuide);
+ connect(editGuide, SIGNAL(triggered()), this, SLOT(slotEditGuide()));
+
+ QAction *delAllGuides = new KAction(KIcon("edit-delete"), i18n("Delete All Guides"), this);
+ actionCollection()->addAction("delete_all_guides", delAllGuides);
+ connect(delAllGuides, SIGNAL(triggered()), this, SLOT(slotDeleteAllGuides()));
+
KStandardAction::quit(this, SLOT(queryQuit()),
actionCollection());
void MainWindow::updateConfiguration() {
//TODO: we should apply settings to all projects, not only the current one
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->refresh();
- currentTab->projectView()->checkAutoScroll();
- currentTab->projectView()->checkTrackHeight();
+ if (m_activeTimeline) {
+ m_activeTimeline->refresh();
+ m_activeTimeline->projectView()->checkAutoScroll();
+ m_activeTimeline->projectView()->checkTrackHeight();
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
void MainWindow::slotSwitchVideoThumbs() {
KdenliveSettings::setVideothumbnails(!KdenliveSettings::videothumbnails());
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->refresh();
+ if (m_activeTimeline) {
+ m_activeTimeline->refresh();
}
m_buttonVideoThumbs->setChecked(KdenliveSettings::videothumbnails());
}
void MainWindow::slotSwitchAudioThumbs() {
KdenliveSettings::setAudiothumbnails(!KdenliveSettings::audiothumbnails());
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->refresh();
- currentTab->projectView()->checkAutoScroll();
+ if (m_activeTimeline) {
+ m_activeTimeline->refresh();
+ m_activeTimeline->projectView()->checkAutoScroll();
if (m_activeDocument) m_activeDocument->clipManager()->checkAudioThumbs();
}
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
void MainWindow::slotSwitchMarkersComments() {
KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->refresh();
+ if (m_activeTimeline) {
+ m_activeTimeline->refresh();
}
m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
}
void MainWindow::slotDeleteTimelineClip() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->projectView()->deleteSelectedClips();
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->deleteSelectedClips();
}
}
void MainWindow::slotAddClipMarker() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->projectView()->slotAddClipMarker();
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->slotAddClipMarker();
}
}
void MainWindow::slotDeleteClipMarker() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->projectView()->slotDeleteClipMarker();
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->slotDeleteClipMarker();
+ }
+}
+
+void MainWindow::slotDeleteAllClipMarkers() {
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->slotDeleteAllClipMarkers();
}
}
void MainWindow::slotEditClipMarker() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->projectView()->slotEditClipMarker();
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->slotEditClipMarker();
}
}
+void MainWindow::slotAddGuide() {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotAddGuide();
+}
+
+void MainWindow::slotEditGuide() {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotEditGuide();
+}
+
+void MainWindow::slotDeleteGuide() {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotDeleteGuide();
+}
+
+void MainWindow::slotDeleteAllGuides() {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotDeleteAllGuides();
+}
+
void MainWindow::slotCutTimelineClip() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->projectView()->cutSelectedClips();
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->cutSelectedClips();
}
}
void MainWindow::slotAddTransition(QAction *result) {
if (!result) return;
QDomElement effect = transitions.getEffectByName(result->data().toString());
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- currentTab->projectView()->slotAddTransitionToSelectedClips(effect);
+ if (m_activeTimeline) {
+ m_activeTimeline->projectView()->slotAddTransitionToSelectedClips(effect);
}
}
}
void MainWindow::slotFitZoom() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab) {
- m_zoomSlider->setValue(currentTab->fitZoom());
+ if (m_activeTimeline) {
+ m_zoomSlider->setValue(m_activeTimeline->fitZoom());
}
}
m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
return;
}
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
- connect(&dia, SIGNAL(addMarker(int, GenTime, QString)), currentTab->projectView(), SLOT(slotAddClipMarker(int, GenTime, QString)));
+ connect(&dia, SIGNAL(addMarker(int, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(int, GenTime, QString)));
if (dia.exec() == QDialog::Accepted) {
m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
if (dia.needsTimelineRefresh()) {
// update clip occurences in timeline
-
- currentTab->projectView()->slotUpdateClip(dia.clipId());
+ m_activeTimeline->projectView()->slotUpdateClip(dia.clipId());
}
}
}
void MainWindow::slotSnapRewind() {
if (m_monitorManager->projectMonitorFocused()) {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- currentTab->projectView()->slotSeekToPreviousSnap();
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotSeekToPreviousSnap();
}
}
void MainWindow::slotSnapForward() {
if (m_monitorManager->projectMonitorFocused()) {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- currentTab->projectView()->slotSeekToNextSnap();
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotSeekToNextSnap();
}
}
void MainWindow::slotClipStart() {
if (m_monitorManager->projectMonitorFocused()) {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- currentTab->projectView()->clipStart();
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->clipStart();
}
}
void MainWindow::slotClipEnd() {
if (m_monitorManager->projectMonitorFocused()) {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- currentTab->projectView()->clipEnd();
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->clipEnd();
}
}
}
void MainWindow::slotSetTool(PROJECTTOOL tool) {
- if (m_activeDocument) {
+ if (m_activeDocument && m_activeTimeline) {
//m_activeDocument->setTool(tool);
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- currentTab->projectView()->setTool(tool);
+ m_activeTimeline->projectView()->setTool(tool);
}
}
}
void MainWindow::slotFindNext() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab->projectView()->findNextString(m_findString)) {
+ if (m_activeTimeline && m_activeTimeline->projectView()->findNextString(m_findString)) {
statusBar()->showMessage(i18n("Found : %1", m_findString));
} else {
statusBar()->showMessage(i18n("Reached end of project"));
}
void MainWindow::findAhead() {
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab->projectView()->findString(m_findString)) {
+ if (m_activeTimeline && m_activeTimeline->projectView()->findString(m_findString)) {
m_projectSearchNext->setEnabled(true);
statusBar()->showMessage(i18n("Found : %1", m_findString));
} else {
m_findActivated = false;
m_findString = QString();
statusBar()->showMessage(i18n("Find stopped"), 3000);
- TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- currentTab->projectView()->clearSearchStrings();
+ if (m_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
m_projectSearch->setEnabled(true);
removeEventFilter(this);
}
void slotDeleteTimelineClip();
void slotAddClipMarker();
void slotDeleteClipMarker();
+ void slotDeleteAllClipMarkers();
void slotEditClipMarker();
void slotCutTimelineClip();
void slotAddVideoEffect(QAction *result);
void slotFind();
void findTimeout();
void slotFindNext();
+
+ void slotAddGuide();
+ void slotEditGuide();
+ void slotDeleteGuide();
+ void slotDeleteAllGuides();
};
+
#endif