From a04d51e10a7b1fcfde9407fbab1feb1be6b568e7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Tue, 8 Jul 2008 22:41:04 +0000 Subject: [PATCH] Some new actions: delete all guides, delete all markers, fix crash in delete clip undo svn path=/branches/KDE4/; revision=2302 --- src/addmarkercommand.cpp | 2 +- src/addmarkercommand.h | 2 +- src/addtimelineclipcommand.cpp | 3 +- src/addtimelineclipcommand.h | 2 +- src/addtransitioncommand.cpp | 2 +- src/addtransitioncommand.h | 2 +- src/customruler.cpp | 8 +- src/customtrackview.cpp | 52 ++++++++++-- src/customtrackview.h | 2 + src/editguidecommand.cpp | 2 +- src/editguidecommand.h | 2 +- src/kdenliveui.rc | 8 ++ src/mainwindow.cpp | 143 ++++++++++++++++++++------------- src/mainwindow.h | 7 ++ 14 files changed, 163 insertions(+), 74 deletions(-) diff --git a/src/addmarkercommand.cpp b/src/addmarkercommand.cpp index f4c47421..5dc764f6 100644 --- a/src/addmarkercommand.cpp +++ b/src/addmarkercommand.cpp @@ -19,7 +19,7 @@ #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")); diff --git a/src/addmarkercommand.h b/src/addmarkercommand.h index 0c839daa..cc16bf61 100644 --- a/src/addmarkercommand.h +++ b/src/addmarkercommand.h @@ -31,7 +31,7 @@ class CustomTrackView; 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(); diff --git a/src/addtimelineclipcommand.cpp b/src/addtimelineclipcommand.cpp index 15ac2bdd..7827b25c 100644 --- a/src/addtimelineclipcommand.cpp +++ b/src/addtimelineclipcommand.cpp @@ -22,8 +22,7 @@ #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")); } diff --git a/src/addtimelineclipcommand.h b/src/addtimelineclipcommand.h index 487e18ea..c09638c8 100644 --- a/src/addtimelineclipcommand.h +++ b/src/addtimelineclipcommand.h @@ -34,7 +34,7 @@ class CustomTrackView; 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(); diff --git a/src/addtransitioncommand.cpp b/src/addtransitioncommand.cpp index 6650bb4a..4d3f0750 100644 --- a/src/addtransitioncommand.cpp +++ b/src/addtransitioncommand.cpp @@ -19,7 +19,7 @@ #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")); } diff --git a/src/addtransitioncommand.h b/src/addtransitioncommand.h index 75af0559..67c3383b 100644 --- a/src/addtransitioncommand.h +++ b/src/addtransitioncommand.h @@ -31,7 +31,7 @@ class CustomTrackView; 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(); diff --git a/src/customruler.cpp b/src/customruler.cpp index 0806f5e9..a7133bb1 100644 --- a/src/customruler.cpp +++ b/src/customruler.cpp @@ -90,10 +90,12 @@ CustomRuler::CustomRuler(Timecode tc, CustomTrackView *parent) 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); } diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 8610843b..95c592ba 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -1188,6 +1188,10 @@ void CustomTrackView::deleteClip(ItemInfo info) { } void CustomTrackView::deleteSelectedClips() { + + QUndoCommand *deleteSelected = new QUndoCommand(); + deleteSelected->setText("Delete selected items"); + QList itemList = scene()->selectedItems(); for (int i = 0; i < itemList.count(); i++) { if (itemList.at(i)->type() == AVWIDGET) { @@ -1196,18 +1200,17 @@ void CustomTrackView::deleteSelectedClips() { 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() { @@ -1538,7 +1541,7 @@ void CustomTrackView::slotDeleteClipMarker() { } 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()); @@ -1558,6 +1561,36 @@ void CustomTrackView::slotDeleteClipMarker() { m_commandStack->push(command); } +void CustomTrackView::slotDeleteAllClipMarkers() { + QList 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 (item); + QList 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 itemList = scene()->selectedItems(); if (itemList.count() != 1) { @@ -1696,6 +1729,15 @@ void CustomTrackView::slotDeleteGuide() { 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; } diff --git a/src/customtrackview.h b/src/customtrackview.h index cc26e6ee..03597a9a 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -59,6 +59,7 @@ public: 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); @@ -114,6 +115,7 @@ public slots: void slotEditGuide(CommentedTime guide); void slotEditGuide(); void slotDeleteGuide(); + void slotDeleteAllGuides(); void editGuide(const GenTime oldPos, const GenTime pos, const QString &comment); protected: diff --git a/src/editguidecommand.cpp b/src/editguidecommand.cpp index 844b860c..10b2b78e 100644 --- a/src/editguidecommand.cpp +++ b/src/editguidecommand.cpp @@ -19,7 +19,7 @@ #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")); diff --git a/src/editguidecommand.h b/src/editguidecommand.h index 742227f8..327ffe28 100644 --- a/src/editguidecommand.h +++ b/src/editguidecommand.h @@ -31,7 +31,7 @@ class CustomTrackView; 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(); diff --git a/src/kdenliveui.rc b/src/kdenliveui.rc index 1e4af504..b1d660cc 100644 --- a/src/kdenliveui.rc +++ b/src/kdenliveui.rc @@ -29,7 +29,15 @@ + + Guides + + + + + + Add Video Effect Add Audio Effect diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3e9693f9..d7107d1a 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -596,10 +596,30 @@ void MainWindow::setupActions() { 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()); @@ -1010,11 +1030,10 @@ void MainWindow::slotPreferences() { 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()); @@ -1025,19 +1044,17 @@ void MainWindow::updateConfiguration() { 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()); @@ -1045,9 +1062,8 @@ void MainWindow::slotSwitchAudioThumbs() { 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()); } @@ -1059,37 +1075,58 @@ void MainWindow::slotSwitchSnap() { 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(); } } @@ -1101,9 +1138,8 @@ void MainWindow::slotAddProjectClip(KUrl url) { 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); } } @@ -1134,9 +1170,8 @@ void MainWindow::slotZoomOut() { } 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()); } } @@ -1156,15 +1191,13 @@ void MainWindow::slotShowClipProperties(DocClipBase *clip) { 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()); } } } @@ -1185,29 +1218,29 @@ void MainWindow::slotActivateTransitionView() { 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(); } } @@ -1217,10 +1250,9 @@ void MainWindow::slotChangeTool(QAction * action) { } 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); } } @@ -1236,8 +1268,7 @@ void MainWindow::slotFind() { } 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")); @@ -1246,8 +1277,7 @@ void MainWindow::slotFindNext() { } 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 { @@ -1261,8 +1291,7 @@ void MainWindow::findTimeout() { 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); } diff --git a/src/mainwindow.h b/src/mainwindow.h index 79d8e779..dd82147b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -185,6 +185,7 @@ private slots: void slotDeleteTimelineClip(); void slotAddClipMarker(); void slotDeleteClipMarker(); + void slotDeleteAllClipMarkers(); void slotEditClipMarker(); void slotCutTimelineClip(); void slotAddVideoEffect(QAction *result); @@ -205,6 +206,12 @@ private slots: void slotFind(); void findTimeout(); void slotFindNext(); + + void slotAddGuide(); + void slotEditGuide(); + void slotDeleteGuide(); + void slotDeleteAllGuides(); }; + #endif -- 2.39.2