resizeclipcommand.cpp
razorclipcommand.cpp
addtimelineclipcommand.cpp
+ addmarkercommand.cpp
kthumb.cpp
clipmanager.cpp
effectslist.cpp
--- /dev/null
+/***************************************************************************
+ addtransitioncommand.cpp - description
+ -------------------
+ begin : 2008
+ copyright : (C) 2008 by Marco Gittler
+ email : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+#include <KLocale>
+
+#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) {
+ if (m_comment.isEmpty()) setText(i18n("Delete marker"));
+ else setText(i18n("Add marker"));
+}
+
+
+// virtual
+void AddMarkerCommand::undo() {
+ m_view->addMarker(m_id, m_pos, m_oldcomment);
+}
+// virtual
+void AddMarkerCommand::redo() {
+ if (m_doIt) {
+ m_view->addMarker(m_id, m_pos, m_comment);
+ }
+ m_doIt = true;
+}
+
+#include "addmarkercommand.moc"
--- /dev/null
+/***************************************************************************
+ addmarkercommand.h - description
+ -------------------
+ begin : 2008
+ copyright : (C) 2008 by Jean-Baptiste Mardelle
+ email : jb@kdenlive.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ ***************************************************************************/
+
+#ifndef MARKERCOMMAND_H
+#define MARKERCOMMAND_H
+
+#include <QUndoCommand>
+#include <QGraphicsView>
+#include <QPointF>
+#include <QDomElement>
+#include <KDebug>
+
+#include "gentime.h"
+#include "definitions.h"
+class CustomTrackView;
+
+
+class AddMarkerCommand : public QUndoCommand {
+public:
+ AddMarkerCommand(CustomTrackView *view, const QString &oldcomment, const QString &comment, const int id, const GenTime &pos, bool doIt);
+ virtual void undo();
+ virtual void redo();
+
+private:
+ CustomTrackView *m_view;
+ QString m_oldcomment;
+ QString m_comment;
+ int m_id;
+ GenTime m_pos;
+ bool m_doIt;
+};
+
+#endif
+
//painter->setRenderHints(QPainter::Antialiasing);
QPainterPath roundRectPathUpper = upperRectPart(br), roundRectPathLower = lowerRectPart(br);
-
painter->setClipRect(option->exposedRect);
// build path around clip
if (audioThumbCachePic.contains(startCache) && !audioThumbCachePic[startCache].isNull())
painter->drawPixmap((int)(roundRectPathUpper.united(roundRectPathLower).boundingRect().x() + startCache - cropLeft), (int)(path.boundingRect().y()), audioThumbCachePic[startCache]);
}
+ }
+ // draw markers
+ QList < CommentedTime > markers = baseClip()->commentedSnapMarkers();
+ QList < CommentedTime >::Iterator it = markers.begin();
+ GenTime pos;
+ double framepos;
+ const int markerwidth = 4;
+ QBrush markerBrush;
+ markerBrush = QBrush(QColor(120, 120, 0, 100));
+ QPen pen = painter->pen();
+ pen.setColor(QColor(255, 255, 255, 200));
+ pen.setStyle(Qt::DotLine);
+ painter->setPen(pen);
+ for (; it != markers.end(); ++it) {
+ pos = (*it).time() - cropStart();
+ if (pos > GenTime()) {
+ if (pos > duration()) break;
+ framepos = scale * pos.frames(m_fps);
+ QLineF l(br.x() + framepos, br.y() + 5, br.x() + framepos, br.y() + br.height() - 5);
+ painter->drawLine(l);
+ if (KdenliveSettings::showmarkers()) {
+ const QRectF txtBounding = painter->boundingRect(br.x() + framepos + 1, br.y() + 5, br.width() - framepos - 2, br.height() - 10, Qt::AlignLeft | Qt::AlignTop, " " + (*it).comment() + " ");
+ QPainterPath path;
+ path.addRoundedRect(txtBounding, 3, 3);
+ painter->fillPath(path, markerBrush);
+ painter->drawText(txtBounding, Qt::AlignCenter, (*it).comment());
+ }
+ //painter->fillRect(QRect(br.x() + framepos, br.y(), 10, br.height()), QBrush(QColor(0, 0, 0, 150)));
+ }
}
+ pen.setColor(Qt::black);
+ pen.setStyle(Qt::SolidLine);
+
/*
// draw start / end fades
}
}
*/
- QPen pen = painter->pen();
- pen.setColor(Qt::white);
+
//pen.setStyle(Qt::DashDotDotLine); //Qt::DotLine);
// Draw effects names
}
-
// virtual
void ClipItem::mousePressEvent(QGraphicsSceneMouseEvent * event) {
/*m_resizeMode = operationMode(event->pos());
#include <QDomDocument>
#include <QScrollBar>
#include <QApplication>
+#include <QInputDialog>
#include <KDebug>
#include <KLocale>
#include "moveeffectcommand.h"
#include "addtransitioncommand.h"
#include "edittransitioncommand.h"
+#include "addmarkercommand.h"
#include "razorclipcommand.h"
#include "kdenlivesettings.h"
#include "transition.h"
}
void CustomTrackView::slotAddEffect(QDomElement effect, GenTime pos, int track) {
- QList<QGraphicsItem *> itemList;
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
if (track == -1)
itemList = items();
else {
}
kDebug() << "// REQUESTING EFFECT ON CLIP: " << pos.frames(25) << ", TRK: " << track;
for (int i = 0; i < itemList.count(); i++) {
- if (itemList.at(i)->type() == AVWIDGET && itemList.at(i)->isSelected()) {
+ if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = (ClipItem *)itemList.at(i);
// the kdenlive_ix int is used to identify an effect in mlt's playlist, should
// not be changed
}
void CustomTrackView::deleteSelectedClips() {
- QList<QGraphicsItem *> itemList = items();
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
for (int i = 0; i < itemList.count(); i++) {
- if (itemList.at(i)->isSelected()) {
- if (itemList.at(i)->type() == AVWIDGET) {
- ClipItem *item = (ClipItem *) itemList.at(i);
- ItemInfo info;
- 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);
- } 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);
- }
+ if (itemList.at(i)->type() == AVWIDGET) {
+ ClipItem *item = (ClipItem *) itemList.at(i);
+ ItemInfo info;
+ 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);
+ } 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);
}
}
}
void CustomTrackView::cutSelectedClips() {
- QList<QGraphicsItem *> itemList = items();
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
GenTime currentPos = GenTime(m_cursorPos, m_document->fps());
for (int i = 0; i < itemList.count(); i++) {
- if (itemList.at(i)->type() == AVWIDGET && itemList.at(i)->isSelected()) {
+ if (itemList.at(i)->type() == AVWIDGET) {
ClipItem *item = (ClipItem *) itemList.at(i);
ItemInfo info;
info.startPos = item->startPos();
setCursorPos((int) res.frames(m_document->fps()));
}
+void CustomTrackView::slotAddClipMarker() {
+ QList<QGraphicsItem *> itemList = scene()->selectedItems();
+ if (itemList.count() != 1) {
+ kDebug() << "// CANNOT ADD MARKER IF MORE TAN ONE CLIP IS SELECTED....";
+ return;
+ }
+ AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
+ if (item->type() != AVWIDGET) return;
+ GenTime pos = GenTime(m_cursorPos, m_document->fps());
+ if (item->startPos() > pos || item->endPos() < pos) return;
+ ClipItem *clip = (ClipItem *) item;
+ int id = clip->baseClip()->getId();
+ GenTime position = pos - item->startPos() + item->cropStart();
+ QString comment = QInputDialog::getText(this, i18n("Add Marker"), i18n("Enter text for marker on clip <b>%1</b>", clip->clipName()), QLineEdit::Normal, i18n("marker"));
+ if (comment.isEmpty()) return;
+ AddMarkerCommand *command = new AddMarkerCommand(this, QString(), comment, id, position, true);
+ m_commandStack->push(command);
+}
+
+void CustomTrackView::addMarker(const int id, const GenTime &pos, const QString comment) {
+ DocClipBase *base = m_document->clipManager()->getClipById(id);
+ if (!comment.isEmpty()) base->addSnapMarker(pos, comment);
+ else base->deleteSnapMarker(pos);
+}
+
void CustomTrackView::setTool(PROJECTTOOL tool) {
m_tool = tool;
}
void resizeClip(const ItemInfo start, const ItemInfo end);
void addClip(QDomElement xml, int clipId, ItemInfo info);
void deleteClip(ItemInfo info);
+ void slotAddClipMarker();
+ void addMarker(const int id, const GenTime &pos, const QString comment);
void setScale(double scaleFactor);
void deleteClip(int clipId);
void slotAddEffect(QDomElement effect, GenTime pos, int track);
<default>true</default>
</entry>
+ <entry name="showmarkers" type="Bool">
+ <label>Display clip markers comments in timeline.</label>
+ <default>false</default>
+ </entry>
+
<entry name="normaliseaudiothumbs" type="Bool">
<label>Normalise audio before creating thumbnails.</label>
<default>true</default>
<Menu name="timeline" ><text>Timeline</text>
<Action name="cut_timeline_clip" />
<Action name="delete_timeline_clip" />
+ <Action name="add_clip_marker" />
<Menu name="video_effects_menu" ><text>Add Video Effect</text>
</Menu>
<Menu name="audio_effects_menu" ><text>Add Audio Effect</text>
action = actionCollection()->action("delete_timeline_clip");
m_timelineContextClipMenu->addAction(action);
+ action = actionCollection()->action("add_clip_marker");
+ m_timelineContextClipMenu->addAction(action);
m_timelineContextClipMenu->addMenu(videoEffectsMenu);
m_timelineContextClipMenu->addMenu(audioEffectsMenu);
m_timelineContextClipMenu->addMenu(customEffectsMenu);
m_buttonAudioThumbs->setCheckable(true);
m_buttonAudioThumbs->setChecked(KdenliveSettings::videothumbnails());
connect(m_buttonAudioThumbs, SIGNAL(triggered()), this, SLOT(slotSwitchAudioThumbs()));
+
+ m_buttonShowMarkers = toolbar->addAction(KIcon("audio-mpeg"), i18n("Show markers comments"));
+ m_buttonShowMarkers->setCheckable(true);
+ m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
+ connect(m_buttonShowMarkers, SIGNAL(triggered()), this, SLOT(slotSwitchMarkersComments()));
layout->addWidget(toolbar);
statusBar()->insertPermanentWidget(0, statusProgressBar, 1);
actionCollection()->addAction("cut_timeline_clip", cutTimelineClip);
connect(cutTimelineClip, SIGNAL(triggered(bool)), this, SLOT(slotCutTimelineClip()));
+ KAction* addClipMarker = new KAction(KIcon("edit-delete"), i18n("Add Marker to Clip"), this);
+ actionCollection()->addAction("add_clip_marker", addClipMarker);
+ connect(addClipMarker, SIGNAL(triggered(bool)), this, SLOT(slotAddClipMarker()));
+
KStandardAction::quit(this, SLOT(queryQuit()),
actionCollection());
m_buttonAudioThumbs->setChecked(KdenliveSettings::audiothumbnails());
}
+void MainWindow::slotSwitchMarkersComments() {
+ KdenliveSettings::setShowmarkers(!KdenliveSettings::showmarkers());
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->refresh();
+ }
+ m_buttonShowMarkers->setChecked(KdenliveSettings::showmarkers());
+}
+
+
+
+
void MainWindow::slotDeleteTimelineClip() {
TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) {
}
}
+void MainWindow::slotAddClipMarker() {
+ TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
+ if (currentTab) {
+ currentTab->projectView()->slotAddClipMarker();
+ }
+}
+
void MainWindow::slotCutTimelineClip() {
TrackView *currentTab = (TrackView *) m_timelineArea->currentWidget();
if (currentTab) {
QAction *m_buttonAudioThumbs;
QAction *m_buttonVideoThumbs;
+ QAction *m_buttonShowMarkers;
QAction *m_buttonFitZoom;
QAction *m_buttonSelectTool;
QAction *m_buttonRazorTool;
void slotGotProgressInfo(KUrl url, int progress);
void slotSwitchVideoThumbs();
void slotSwitchAudioThumbs();
+ void slotSwitchMarkersComments();
void slotRenderProject();
void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
void slotFullScreen();
void slotFitZoom();
void slotRemoveTab();
void slotDeleteTimelineClip();
+ void slotAddClipMarker();
void slotCutTimelineClip();
void slotAddVideoEffect(QAction *result);
void slotAddAudioEffect(QAction *result);
<rect>
<x>0</x>
<y>0</y>
- <width>335</width>
- <height>188</height>
+ <width>353</width>
+ <height>255</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2" >
</layout>
</widget>
</item>
- <item row="1" column="0" colspan="3" >
- <widget class="QCheckBox" name="kcfg_autoscroll" >
- <property name="text" >
- <string>Autoscroll while playing</string>
- </property>
- </widget>
- </item>
- <item row="2" column="0" >
+ <item row="4" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Track height</string>
</property>
</widget>
</item>
- <item row="2" column="1" >
+ <item row="4" column="1" >
<widget class="QSpinBox" name="kcfg_trackheight" />
</item>
- <item row="2" column="2" >
+ <item row="4" column="2" >
<spacer name="horizontalSpacer_2" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
- <item row="3" column="1" >
+ <item row="5" column="1" >
<spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
</spacer>
</item>
+ <item row="2" column="0" colspan="2" >
+ <widget class="QCheckBox" name="kcfg_showmarkers" >
+ <property name="text" >
+ <string>Display clip markers comments</string>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" colspan="3" >
+ <widget class="QCheckBox" name="kcfg_autoscroll" >
+ <property name="text" >
+ <string>Autoscroll while playing</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>