// const int duration = animate ? 1500 : 1;
CustomTrackView::CustomTrackView(KdenliveDoc *doc, QGraphicsScene * projectscene, QWidget *parent)
- : QGraphicsView(projectscene, parent), m_cursorPos(0), m_dropItem(NULL), m_cursorLine(NULL), m_operationMode(NONE), m_dragItem(NULL), m_visualTip(NULL), m_moveOpMode(NONE), m_animation(NULL), m_projectDuration(0), m_scale(1.0), m_clickPoint(QPoint()), m_document(doc), m_autoScroll(KdenliveSettings::autoscroll()), m_tracksHeight(KdenliveSettings::trackheight()), m_tool(SELECTTOOL), m_dragGuide(NULL) {
+ : QGraphicsView(projectscene, parent), m_cursorPos(0), m_dropItem(NULL), m_cursorLine(NULL), m_operationMode(NONE), m_dragItem(NULL), m_visualTip(NULL), m_moveOpMode(NONE), m_animation(NULL), m_projectDuration(0), m_scale(1.0), m_clickPoint(QPoint()), m_document(doc), m_autoScroll(KdenliveSettings::autoscroll()), m_tracksHeight(KdenliveSettings::trackheight()), m_tool(SELECTTOOL), m_dragGuide(NULL), m_findIndex(0) {
if (doc) m_commandStack = doc->commandStack();
else m_commandStack == NULL;
setMouseTracking(true);
marker = m_searchPoints.at(i).comment();
if (marker.contains(text, Qt::CaseInsensitive)) {
setCursorPos(m_searchPoints.at(i).time().frames(m_document->fps()), true);
- int vert = verticalScrollBar()->value();
- int hor = cursorPos();
- ensureVisible(hor, vert + 10, 2, 2, 50, 0);
+ int vert = verticalScrollBar()->value();
+ int hor = cursorPos();
+ ensureVisible(hor, vert + 10, 2, 2, 50, 0);
+ m_findIndex = i;
return true;
}
}
return false;
}
+bool CustomTrackView::findNextString(const QString &text) {
+ QString marker;
+ for (int i = m_findIndex + 1; i < m_searchPoints.size(); ++i) {
+ marker = m_searchPoints.at(i).comment();
+ if (marker.contains(text, Qt::CaseInsensitive)) {
+ setCursorPos(m_searchPoints.at(i).time().frames(m_document->fps()), true);
+ int vert = verticalScrollBar()->value();
+ int hor = cursorPos();
+ ensureVisible(hor, vert + 10, 2, 2, 50, 0);
+ m_findIndex = i;
+ return true;
+ }
+ }
+ m_findIndex = -1;
+ return false;
+}
+
void CustomTrackView::initSearchStrings() {
m_searchPoints.clear();
void CustomTrackView::clearSearchStrings() {
m_searchPoints.clear();
-
+ m_findIndex = 0;
}
/*
QDomElement xmlInfo();
void editKeyFrame(const GenTime pos, const int track, const int index, const QString keyframes);
bool findString(const QString &text);
+ bool findNextString(const QString &text);
void initSearchStrings();
void clearSearchStrings();
QMenu *m_timelineContextTransitionMenu;
QList <TrackInfo> m_tracksList;
QList <CommentedTime> m_searchStrings;
+ int m_findIndex;
PROJECTTOOL m_tool;
QCursor m_razorCursor;
/** Get the index of the video track that is just below current track */
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
-<gui name="kdenlive" version="19">
+<gui name="kdenlive" version="20">
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
<Action name="project_render" />
<MenuBar>
<Menu name="edit" >
<Action name="project_find" />
+ <Action name="project_find_next" />
</Menu>
<Menu name="project" ><text>Project</text>
connect(m_projectSearch, SIGNAL(triggered(bool)), this, SLOT(slotFind()));
m_projectSearch->setShortcut(Qt::Key_Slash);
+ m_projectSearchNext = new KAction(KIcon("go-down-search"), i18n("Find Next"), this);
+ actionCollection()->addAction("project_find_next", m_projectSearchNext);
+ connect(m_projectSearchNext, SIGNAL(triggered(bool)), this, SLOT(slotFindNext()));
+ m_projectSearchNext->setShortcut(Qt::Key_F3);
+ m_projectSearchNext->setEnabled(false);
+
KAction* profilesAction = new KAction(KIcon("document-new"), i18n("Manage Profiles"), this);
actionCollection()->addAction("manage_profiles", profilesAction);
connect(profilesAction, SIGNAL(triggered(bool)), this, SLOT(slotEditProfiles()));
qApp->installEventFilter(this);
}
+void MainWindow::slotFindNext() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab->projectView()->findNextString(m_findString)) {
+ statusBar()->showMessage(i18n("Found : %1", m_findString));
+ } else {
+ statusBar()->showMessage(i18n("Reached end of project"));
+ }
+ m_findTimer.start(4000);
+}
+
void MainWindow::findAhead() {
TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
- if (currentTab->projectView()->findString(m_findString)) statusBar()->showMessage(i18n("Found : %1", m_findString));
- else statusBar()->showMessage(i18n("Not found : %1", m_findString));
+ if (currentTab->projectView()->findString(m_findString)) {
+ m_projectSearchNext->setEnabled(true);
+ statusBar()->showMessage(i18n("Found : %1", m_findString));
+ } else {
+ m_projectSearchNext->setEnabled(false);
+ statusBar()->showMessage(i18n("Not found : %1", m_findString));
+ }
}
void MainWindow::findTimeout() {
+ m_projectSearchNext->setEnabled(false);
m_findActivated = false;
m_findString = QString();
statusBar()->showMessage(i18n("Find stopped"), 3000);
if (m_findActivated) {
if (event->type() == QEvent::ShortcutOverride) {
QKeyEvent* ke = (QKeyEvent*) event;
+ if (ke->text().trimmed().isEmpty()) return false;
ke->accept();
return true;
} else return false;
KRecentFilesAction *m_fileOpenRecent;
KAction *m_projectSearch;
+ KAction *m_projectSearchNext;
QAction *m_buttonAudioThumbs;
QAction *m_buttonVideoThumbs;
void slotSnapRewind();
void slotFind();
void findTimeout();
+ void slotFindNext();
};
#endif