+void MainWindow::slotShowClipProperties(DocClipBase *clip) {
+ if (clip->clipType() == TEXT) {
+ QString titlepath = m_activeDocument->projectFolder().path() + "/titles/";
+ QString path = clip->getProperty("resource");
+ TitleWidget *dia_ui = new TitleWidget(KUrl(), titlepath, m_projectMonitor->render, this);
+ QDomDocument doc;
+ doc.setContent(clip->getProperty("xmldata"));
+ dia_ui->setXml(doc);
+ if (dia_ui->exec() == QDialog::Accepted) {
+ QPixmap pix = dia_ui->renderedPixmap();
+ pix.save(path);
+ //slotAddClipFile(KUrl("/tmp/kdenlivetitle.png"), QString(), -1);
+ //m_clipManager->slotEditTextClipFile(id, dia_ui->xml().toString());
+ QMap <QString, QString> newprops;
+ newprops.insert("xmldata", dia_ui->xml().toString());
+ EditClipCommand *command = new EditClipCommand(m_projectList, clip->getId(), clip->properties(), newprops, true);
+ m_activeDocument->commandStack()->push(command);
+ m_clipMonitor->refreshMonitor(true);
+ m_activeDocument->setModified(true);
+ }
+ delete dia_ui;
+
+ //m_activeDocument->editTextClip(clip->getProperty("xml"), clip->getId());
+ return;
+ }
+ ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
+ connect(&dia, SIGNAL(addMarker(const QString &, GenTime, QString)), m_activeTimeline->projectView(), SLOT(slotAddClipMarker(const QString &, GenTime, QString)));
+ if (dia.exec() == QDialog::Accepted) {
+ EditClipCommand *command = new EditClipCommand(m_projectList, dia.clipId(), clip->properties(), dia.properties(), true);
+ m_activeDocument->commandStack()->push(command);
+
+ //m_projectList->slotUpdateClipProperties(dia.clipId(), dia.properties());
+ if (dia.needsTimelineRefresh()) {
+ // update clip occurences in timeline
+ m_activeTimeline->projectView()->slotUpdateClip(dia.clipId());
+ }
+ }
+}
+
+void MainWindow::customEvent(QEvent* e) {
+ if (e->type() == QEvent::User) {
+ // The timeline playing position changed...
+ kDebug() << "RECIEVED JOG EVEMNT!!!";
+ }
+}
+void MainWindow::slotActivateEffectStackView() {
+ effectStack->raiseWindow(effectStackDock);
+}
+
+void MainWindow::slotActivateTransitionView() {
+ transitionConfig->raiseWindow(transitionConfigDock);
+}
+
+void MainWindow::slotSnapRewind() {
+ if (m_projectMonitor->isActive()) {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotSeekToPreviousSnap();
+ }
+}
+
+void MainWindow::slotSnapForward() {
+ if (m_projectMonitor->isActive()) {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->slotSeekToNextSnap();
+ }
+}
+
+void MainWindow::slotClipStart() {
+ if (m_projectMonitor->isActive()) {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->clipStart();
+ }
+}
+
+void MainWindow::slotClipEnd() {
+ if (m_projectMonitor->isActive()) {
+ if (m_activeTimeline)
+ m_activeTimeline->projectView()->clipEnd();
+ }
+}
+
+void MainWindow::slotChangeTool(QAction * action) {
+ if (action == m_buttonSelectTool) slotSetTool(SELECTTOOL);
+ else if (action == m_buttonRazorTool) slotSetTool(RAZORTOOL);
+}
+
+void MainWindow::slotSetTool(PROJECTTOOL tool) {
+ if (m_activeDocument && m_activeTimeline) {
+ //m_activeDocument->setTool(tool);
+ m_activeTimeline->projectView()->setTool(tool);
+ }
+}
+
+void MainWindow::slotCopy() {
+ if (!m_activeDocument || !m_activeTimeline) return;
+ m_activeTimeline->projectView()->copyClip();
+}
+
+void MainWindow::slotPaste() {
+ if (!m_activeDocument || !m_activeTimeline) return;
+ m_activeTimeline->projectView()->pasteClip();
+}
+
+void MainWindow::slotPasteEffects() {
+ if (!m_activeDocument || !m_activeTimeline) return;
+ m_activeTimeline->projectView()->pasteClipEffects();
+}
+
+void MainWindow::slotFind() {
+ if (!m_activeDocument || !m_activeTimeline) return;
+ m_projectSearch->setEnabled(false);
+ m_findActivated = true;
+ m_findString = QString();
+ m_activeTimeline->projectView()->initSearchStrings();
+ statusBar()->showMessage(i18n("Starting -- find text as you type"));
+ m_findTimer.start(5000);
+ qApp->installEventFilter(this);
+}
+
+void MainWindow::slotFindNext() {
+ if (m_activeTimeline && m_activeTimeline->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() {
+ if (m_activeTimeline && m_activeTimeline->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_activeTimeline) m_activeTimeline->projectView()->clearSearchStrings();
+ m_projectSearch->setEnabled(true);
+ removeEventFilter(this);
+}
+
+void MainWindow::keyPressEvent(QKeyEvent *ke) {
+ if (m_findActivated) {
+ if (ke->key() == Qt::Key_Backspace) {
+ m_findString = m_findString.left(m_findString.length() - 1);
+
+ if (!m_findString.isEmpty()) {
+ findAhead();
+ } else {
+ findTimeout();
+ }
+
+ m_findTimer.start(4000);
+ ke->accept();
+ return;
+ } else if (ke->key() == Qt::Key_Escape) {
+ findTimeout();
+ ke->accept();
+ return;
+ } else if (ke->key() == Qt::Key_Space || !ke->text().trimmed().isEmpty()) {
+ m_findString += ke->text();
+
+ findAhead();
+
+ m_findTimer.start(4000);
+ ke->accept();
+ return;
+ }
+ } else KXmlGuiWindow::keyPressEvent(ke);
+}
+
+
+/** Gets called when the window gets hidden */
+void MainWindow::hideEvent(QHideEvent *event) {
+ // kDebug() << "I was hidden";
+ // issue http://www.kdenlive.org/mantis/view.php?id=231
+ if (this->isMinimized()) {
+ // kDebug() << "I am minimized";
+ if (m_monitorManager) m_monitorManager->stopActiveMonitor();
+ }
+}
+
+bool MainWindow::eventFilter(QObject *obj, QEvent *event) {
+ 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;
+ } else {
+ // pass the event on to the parent class
+ return QMainWindow::eventFilter(obj, event);
+ }
+}
+
+void MainWindow::slotSaveZone(Render *render, QPoint zone) {
+ KDialog *dialog = new KDialog(this);
+ dialog->setCaption("Save clip zone");
+ dialog->setButtons(KDialog::Ok | KDialog::Cancel);
+
+ QWidget *widget = new QWidget(dialog);
+ dialog->setMainWidget(widget);
+
+ QVBoxLayout *vbox = new QVBoxLayout(widget);
+ QLabel *label1 = new QLabel(i18n("Save clip zone as:"), this);
+ QString path = m_activeDocument->projectFolder().path();
+ path.append("/");
+ path.append("untitled.westley");
+ KUrlRequester *url = new KUrlRequester(KUrl(path), this);
+ url->setFilter("video/mlt-playlist");
+ QLabel *label2 = new QLabel(i18n("Description:"), this);
+ KLineEdit *edit = new KLineEdit(this);
+ vbox->addWidget(label1);
+ vbox->addWidget(url);
+ vbox->addWidget(label2);
+ vbox->addWidget(edit);
+ if (dialog->exec() == QDialog::Accepted) render->saveZone(url->url(), edit->text(), zone);
+
+}
+
+void MainWindow::slotSetInPoint() {
+ if (m_clipMonitor->isActive()) {
+ m_clipMonitor->slotSetZoneStart();
+ } else m_activeTimeline->projectView()->setInPoint();
+}
+
+void MainWindow::slotSetOutPoint() {
+ if (m_clipMonitor->isActive()) {
+ m_clipMonitor->slotSetZoneEnd();
+ } else m_activeTimeline->projectView()->setOutPoint();
+}
+