for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (!e.isNull() && e.attribute("type") == "keyframe") {
- e.setAttribute("keyframes", keyframes);
- if (ix == m_selectedEffect) {
- m_keyframes.clear();
- double max = e.attribute("max").toDouble();
- double min = e.attribute("min").toDouble();
- m_keyframeFactor = 100.0 / (max - min);
- m_keyframeDefault = e.attribute("default").toDouble();
- // parse keyframes
- QStringList keyframes = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
- foreach(QString str, keyframes) {
- int pos = str.section(":", 0, 0).toInt();
- double val = str.section(":", 1, 1).toDouble();
- m_keyframes[pos] = val;
- }
- update();
- return;
- }
- break;
+ e.setAttribute("keyframes", keyframes);
+ if (ix == m_selectedEffect) {
+ m_keyframes.clear();
+ double max = e.attribute("max").toDouble();
+ double min = e.attribute("min").toDouble();
+ m_keyframeFactor = 100.0 / (max - min);
+ m_keyframeDefault = e.attribute("default").toDouble();
+ // parse keyframes
+ QStringList keyframes = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
+ foreach(QString str, keyframes) {
+ int pos = str.section(":", 0, 0).toInt();
+ double val = str.section(":", 1, 1).toDouble();
+ m_keyframes[pos] = val;
+ }
+ update();
+ return;
+ }
+ break;
}
}
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
if (!e.isNull() && e.attribute("type") == "keyframe") {
- result = e.attribute("keyframes");
- break;
- }
+ result = e.attribute("keyframes");
+ break;
+ }
}
return result;
}
if (item && event->buttons() == Qt::NoButton) {
AbstractClipItem *clip = (AbstractClipItem*) item;
- if (m_tool == RAZORTOOL) {
- // razor tool over a clip, display current frame in monitor
- if (item->type() == AVWIDGET) {
- emit showClipFrame(((ClipItem *) item)->baseClip(), mapToScene(event->pos()).x() / m_scale - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
- }
- QGraphicsView::mouseMoveEvent(event);
- return;
- }
+ if (m_tool == RAZORTOOL) {
+ // razor tool over a clip, display current frame in monitor
+ if (item->type() == AVWIDGET) {
+ emit showClipFrame(((ClipItem *) item)->baseClip(), mapToScene(event->pos()).x() / m_scale - (clip->startPos() - clip->cropStart()).frames(m_document->fps()));
+ }
+ QGraphicsView::mouseMoveEvent(event);
+ return;
+ }
opMode = clip->operationMode(mapToScene(event->pos()), m_scale);
double size = 8;
if (opMode == m_moveOpMode) {
setCursor(Qt::PointingHandCursor);
}
} // no clip under mouse
- else if (m_tool == RAZORTOOL) {
- QGraphicsView::mouseMoveEvent(event);
- return;
- }
- else if (opMode == MOVEGUIDE) {
+ else if (m_tool == RAZORTOOL) {
+ QGraphicsView::mouseMoveEvent(event);
+ return;
+ } else if (opMode == MOVEGUIDE) {
m_moveOpMode = opMode;
setCursor(Qt::SplitHCursor);
} else {
if (item->type() == AVWIDGET || item->type() == TRANSITIONWIDGET) {
if (m_tool == RAZORTOOL) {
if (item->type() == TRANSITIONWIDGET) {
- emit displayMessage(i18n("Cannot cut a transition"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("Cannot cut a transition"), ErrorMessage);
+ return;
+ }
AbstractClipItem *clip = (AbstractClipItem *) item;
ItemInfo info;
info.startPos = clip->startPos();
int pos = m_document->timecode().getFrameCount(view.kfr_position->text(), m_document->fps());
m_dragItem->updateKeyFramePos(GenTime(pos, m_document->fps()) + m_dragItem->cropStart(), (double) view.kfr_value->value() * m_dragItem->keyFrameFactor());
ClipItem *item = (ClipItem *)m_dragItem;
- QString previous = item->keyframes(item->selectedEffectIndex());
- item->updateKeyframeEffect();
- QString next = item->keyframes(item->selectedEffectIndex());
- EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
- m_commandStack->push(command);
+ QString previous = item->keyframes(item->selectedEffectIndex());
+ item->updateKeyframeEffect();
+ QString next = item->keyframes(item->selectedEffectIndex());
+ EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
+ m_commandStack->push(command);
updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
}
GenTime keyFramePos = GenTime((int)(mapToScene(event->pos()).x() / m_scale), m_document->fps()) - m_dragItem->startPos() + m_dragItem->cropStart();
m_dragItem->addKeyFrame(keyFramePos, mapToScene(event->pos()).toPoint().y());
ClipItem * item = (ClipItem *) m_dragItem;
- QString previous = item->keyframes(item->selectedEffectIndex());
+ QString previous = item->keyframes(item->selectedEffectIndex());
item->updateKeyframeEffect();
- QString next = item->keyframes(item->selectedEffectIndex());
- EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
- m_commandStack->push(command);
+ QString next = item->keyframes(item->selectedEffectIndex());
+ EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
+ m_commandStack->push(command);
updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
}
}
void CustomTrackView::editKeyFrame(const GenTime pos, const int track, const int index, const QString keyframes) {
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), track);
if (clip) {
- clip->setKeyframes(index, keyframes);
- updateEffect(m_tracksList.count() - clip->track(), clip->startPos(), clip->effectAt(index));
- }
- else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage);
+ clip->setKeyframes(index, keyframes);
+ updateEffect(m_tracksList.count() - clip->track(), clip->startPos(), clip->effectAt(index));
+ } else emit displayMessage(i18n("Cannot find clip with keyframe"), ErrorMessage);
}
int track = m_tracksList.count() - clip->track();
GenTime pos = clip->startPos();
if (!m_document->renderer()->mltRemoveEffect(track, pos, "-1", false)) {
- emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
- return;
+ emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
+ return;
}
bool success = true;
for (int i = 0; i < clip->effectsCount(); i++) {
if (clip) {
QMap <QString, QString> effectParams = clip->addEffect(effect);
if (!m_document->renderer()->mltAddEffect(track, pos, effectParams))
- emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
+ emit displayMessage(i18n("Problem adding effect to clip"), ErrorMessage);
emit clipItemSelected(clip);
- }
- else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
+ } else emit displayMessage(i18n("Cannot find clip to add effect"), ErrorMessage);
}
void CustomTrackView::deleteEffect(int track, GenTime pos, QDomElement effect) {
QString index = effect.attribute("kdenlive_ix");
if (!m_document->renderer()->mltRemoveEffect(track, pos, index)) {
- emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
- return;
+ emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
+ return;
}
ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()) + 1, m_tracksList.count() - track);
if (clip) {
if (effectParams.value("disabled") == "1") {
QString index = effectParams.value("kdenlive_ix");
if (!m_document->renderer()->mltRemoveEffect(track, pos, index))
- emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
+ emit displayMessage(i18n("Problem deleting effect"), ErrorMessage);
} else if (!m_document->renderer()->mltEditEffect(m_tracksList.count() - clip->track(), clip->startPos(), effectParams))
- emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
m_document->setModified(true);
}
// move clip
if (m_dragItem->type() == AVWIDGET && (m_dragItemInfo.startPos != info.startPos || m_dragItemInfo.track != info.track)) {
bool success = m_document->renderer()->mltMoveClip((int)(m_tracksList.count() - m_dragItemInfo.track), (int)(m_tracksList.count() - m_dragItem->track()), (int) m_dragItemInfo.startPos.frames(m_document->fps()), (int)(m_dragItem->startPos().frames(m_document->fps())));
- if (success) {
- MoveClipCommand *command = new MoveClipCommand(this, m_dragItemInfo, info, false);
- m_commandStack->push(command);
- }
- else {
- // undo last move and emit error message
- MoveClipCommand *command = new MoveClipCommand(this, info, m_dragItemInfo, true);
- m_commandStack->push(command);
- emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
- }
+ if (success) {
+ MoveClipCommand *command = new MoveClipCommand(this, m_dragItemInfo, info, false);
+ m_commandStack->push(command);
+ } else {
+ // undo last move and emit error message
+ MoveClipCommand *command = new MoveClipCommand(this, info, m_dragItemInfo, true);
+ m_commandStack->push(command);
+ emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
+ }
}
if (m_dragItem->type() == TRANSITIONWIDGET && (m_dragItemInfo.startPos != info.startPos || m_dragItemInfo.track != info.track)) {
MoveTransitionCommand *command = new MoveTransitionCommand(this, m_dragItemInfo, info, false);
} else if (m_operationMode == KEYFRAME) {
// update the MLT effect
ClipItem * item = (ClipItem *) m_dragItem;
- QString previous = item->keyframes(item->selectedEffectIndex());
+ QString previous = item->keyframes(item->selectedEffectIndex());
item->updateKeyframeEffect();
- QString next = item->keyframes(item->selectedEffectIndex());
- EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
- m_commandStack->push(command);
+ QString next = item->keyframes(item->selectedEffectIndex());
+ EditKeyFrameCommand *command = new EditKeyFrameCommand(this, item->track(), item->startPos(), item->selectedEffectIndex(), previous, next, false);
+ m_commandStack->push(command);
updateEffect(m_tracksList.count() - item->track(), item->startPos(), item->selectedEffect());
}
return;
}
//kDebug() << "---------------- Move CLIP FROM: " << startPos.x() << ", END:" << endPos.x() << ",TRACKS: " << startPos.y() << " TO " << endPos.y();
-
+
bool success = m_document->renderer()->mltMoveClip((int)(m_tracksList.count() - start.track), (int)(m_tracksList.count() - end.track), (int) start.startPos.frames(m_document->fps()), (int)end.startPos.frames(m_document->fps()));
- if (success) {
- item->moveTo((int) end.startPos.frames(m_document->fps()), m_scale, (int)((end.track - start.track) * m_tracksHeight), end.track);
- }
- else {
- // undo last move and emit error message
- emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
- }
+ if (success) {
+ item->moveTo((int) end.startPos.frames(m_document->fps()), m_scale, (int)((end.track - start.track) * m_tracksHeight), end.track);
+ } else {
+ // undo last move and emit error message
+ emit displayMessage(i18n("Cannot move clip to requested position"), ErrorMessage);
+ }
}
void CustomTrackView::moveTransition(const ItemInfo start, const ItemInfo end) {
EffectsList::setParameter(oldeffect, "out", QString::number(end));
QMap <QString, QString> effectParams = item->getEffectArgs(oldeffect);
if (!m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams))
- emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
} else {
int start = item->fadeOut();
EffectsList::setParameter(oldeffect, "out", QString::number(end));
QMap <QString, QString> effectParams = item->getEffectArgs(oldeffect);
if (m_document->renderer()->mltEditEffect(m_tracksList.count() - item->track(), item->startPos(), effectParams))
- emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
}
}
}
void CustomTrackView::updateSnapPoints(AbstractClipItem *selected) {
m_snapPoints.clear();
- if (!KdenliveSettings::snaptopoints()) return;
+ if (!KdenliveSettings::snaptopoints()) return;
GenTime offset;
if (selected) offset = selected->duration();
QList<QGraphicsItem *> itemList = items();
}
AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
if (item->type() != AVWIDGET) {
- emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
+ return;
+ }
GenTime pos = GenTime(m_cursorPos, m_document->fps());
if (item->startPos() > pos || item->endPos() < pos) {
- emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
+ return;
+ }
ClipItem *clip = (ClipItem *) item;
int id = clip->baseClip()->getId();
GenTime position = pos - item->startPos() + item->cropStart();
QString comment = clip->baseClip()->markerComment(position);
if (comment.isEmpty()) {
- emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
+ return;
+ }
AddMarkerCommand *command = new AddMarkerCommand(this, comment, QString(), id, position, true);
m_commandStack->push(command);
}
}
AbstractClipItem *item = (AbstractClipItem *)itemList.at(0);
if (item->type() != AVWIDGET) {
- emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("No clip at cursor time"), ErrorMessage);
+ return;
+ }
GenTime pos = GenTime(m_cursorPos, m_document->fps());
if (item->startPos() > pos || item->endPos() < pos) {
- emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("No selected clip at cursor time"), ErrorMessage);
+ return;
+ }
ClipItem *clip = (ClipItem *) item;
int id = clip->baseClip()->getId();
GenTime position = pos - item->startPos() + item->cropStart();
QString oldcomment = clip->baseClip()->markerComment(position);
if (oldcomment.isEmpty()) {
- emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
- return;
- }
+ emit displayMessage(i18n("No marker found at cursor time"), ErrorMessage);
+ return;
+ }
CommentedTime marker(position, oldcomment);
MarkerDialog d(clip->baseClip(), marker, m_document->timecode(), this);
} else if (pos > GenTime()) addGuide(pos, comment);
else {
// remove guide
- bool found = false;
+ bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == oldPos) {
Guide *item = m_guides.takeAt(i);
delete item;
- found = true;
+ found = true;
break;
}
}
- if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
+ if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
}
}
bool CustomTrackView::addGuide(const GenTime pos, const QString &comment) {
for (int i = 0; i < m_guides.count(); i++) {
- if (m_guides.at(i)->position() == pos) {
- emit displayMessage(i18n("A guide already exists at that position"), ErrorMessage);
- return false;
- }
+ if (m_guides.at(i)->position() == pos) {
+ emit displayMessage(i18n("A guide already exists at that position"), ErrorMessage);
+ return false;
+ }
}
Guide *g = new Guide(this, pos, comment, m_scale, m_document->fps(), m_tracksHeight * m_tracksList.count());
scene()->addItem(g);
m_guides.append(g);
- return true;
+ return true;
}
void CustomTrackView::slotAddGuide() {
if (addGuide(GenTime(m_cursorPos, m_document->fps()), i18n("guide"))) {
- EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), GenTime(m_cursorPos, m_document->fps()), i18n("guide"), false);
- m_commandStack->push(command);
- }
+ EditGuideCommand *command = new EditGuideCommand(this, GenTime(), QString(), GenTime(m_cursorPos, m_document->fps()), i18n("guide"), false);
+ m_commandStack->push(command);
+ }
}
void CustomTrackView::slotDeleteGuide() {
GenTime pos = GenTime(m_cursorPos, m_document->fps());
- bool found = false;
+ bool found = false;
for (int i = 0; i < m_guides.count(); i++) {
if (m_guides.at(i)->position() == pos) {
EditGuideCommand *command = new EditGuideCommand(this, m_guides.at(i)->position(), m_guides.at(i)->label(), GenTime(), QString(), true);
m_commandStack->push(command);
- found = true;
+ found = true;
break;
}
}
- if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
+ if (!found) emit displayMessage(i18n("No guide at cursor time"), ErrorMessage);
}
void CustomTrackView::setTool(PROJECTTOOL tool) {
void activateDocumentMonitor();
void trackHeightChanged();
void displayMessage(const QString, MessageType);
- void showClipFrame(DocClipBase *, const int);
+ void showClipFrame(DocClipBase *, const int);
};
#endif
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) {
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"));
+ else if (m_pos <= GenTime()) setText(i18n("Delete guide"));
else setText(i18n("Move guide"));
kDebug() << "/// CREATE GUIDE COMMAND, TIMES: " << m_oldPos.frames(25) << "x" << m_pos.frames(25);
}
// virtual
void EditKeyFrameCommand::redo() {
if (m_doIt) {
- m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
+ m_view->editKeyFrame(m_pos, m_track, m_index, m_newkfr);
}
m_doIt = true;
}
if (m_type == VIDEOTRACK) {
view.frame->setBackgroundRole(QPalette::AlternateBase);
view.frame->setAutoFillBackground(true);
- view.buttonVideo->setIcon(KIcon("kdenlive-show-video"));
+ view.buttonVideo->setIcon(KIcon("kdenlive-show-video"));
} else {
view.buttonVideo->setHidden(true);
}
- view.buttonAudio->setIcon(KIcon("kdenlive-show-audio"));
+ view.buttonAudio->setIcon(KIcon("kdenlive-show-audio"));
view.buttonVideo->setChecked(!info.isBlind);
view.buttonAudio->setChecked(!info.isMute);
connect(view.buttonVideo, SIGNAL(clicked()), this, SLOT(switchVideo()));
#include "mainwindow.h"
KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, MltVideoProfile profile, QUndoGroup *undoGroup, MainWindow *parent): QObject(parent), m_render(NULL), m_url(url), m_projectFolder(projectFolder), m_profile(profile), m_fps((double)profile.frame_rate_num / profile.frame_rate_den), m_width(profile.width), m_height(profile.height), m_commandStack(new KUndoStack(undoGroup)), m_modified(false), m_documentLoadingProgress(0), m_documentLoadingStep(0.0), m_startPos(0) {
- kDebug()<<"// init profile, ratnum: "<<profile.frame_rate_num<<", "<<profile.frame_rate_num<<", width: "<<profile.width;
+ kDebug() << "// init profile, ratnum: " << profile.frame_rate_num << ", " << profile.frame_rate_num << ", width: " << profile.width;
m_clipManager = new ClipManager(this);
if (!url.isEmpty()) {
QString tmpFile;
westley.appendChild(tractor);
}
m_scenelist = m_document.toString();
- kDebug() << "KDEnnlive document, init timecode: "<<m_fps;
+ kDebug() << "KDEnnlive document, init timecode: " << m_fps;
if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
else m_timecode.setFormat((int) m_fps);
}
m_fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
m_width = m_profile.width;
m_height = m_profile.height;
- kDebug() << "KDEnnlive document, init timecode from path: "<<path<<", "<<m_fps;
+ kDebug() << "KDEnnlive document, init timecode from path: " << path << ", " << m_fps;
if (m_fps == 30000.0 / 1001.0) m_timecode.setFormat(30, true);
else m_timecode.setFormat((int) m_fps);
}
QWidget *p4 = new QWidget;
m_configCapture.setupUi(p4);
page4 = addPage(p4, i18n("Capture"), "audio-card");
- m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
+ m_configCapture.tabWidget->setCurrentIndex(KdenliveSettings::defaultcapture());
QWidget *p5 = new QWidget;
m_configShuttle.setupUi(p5);
projectListDock->raise();
tabifyDockWidget(clipMonitorDock, projectMonitorDock);
- tabifyDockWidget(clipMonitorDock, recMonitorDock);
+ tabifyDockWidget(clipMonitorDock, recMonitorDock);
setCentralWidget(m_timelineArea);
setupGUI(Default, NULL /*"kdenliveui.rc"*/);
setAutoSaveSettings();
if (KdenliveSettings::openlastproject()) {
- KSharedConfigPtr config = KGlobal::config();
- QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
- openFile(KUrl(Lastproject));
+ KSharedConfigPtr config = KGlobal::config();
+ QString Lastproject = config->group("Recent Files").readPathEntry("File1", QString());
+ openFile(KUrl(Lastproject));
} else newFile();
m_toolGroup->addAction(m_buttonSelectTool);
m_toolGroup->addAction(m_buttonRazorTool);
m_toolGroup->setExclusive(true);
- toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ toolbar->setToolButtonStyle(Qt::ToolButtonIconOnly);
- QWidget * actionWidget;
- actionWidget = toolbar->widgetForAction( m_buttonSelectTool );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ QWidget * actionWidget;
+ actionWidget = toolbar->widgetForAction(m_buttonSelectTool);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
- actionWidget = toolbar->widgetForAction( m_buttonRazorTool );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ actionWidget = toolbar->widgetForAction(m_buttonRazorTool);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
toolbar->setStyleSheet(style1);
connect(m_toolGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotChangeTool(QAction *)));
m_buttonFitZoom->setCheckable(false);
connect(m_buttonFitZoom, SIGNAL(triggered()), this, SLOT(slotFitZoom()));
- actionWidget = toolbar->widgetForAction( m_buttonFitZoom );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ actionWidget = toolbar->widgetForAction(m_buttonFitZoom);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
m_zoomSlider = new QSlider(Qt::Horizontal, this);
m_zoomSlider->setMaximum(13);
layout->addWidget(toolbar);
- actionWidget = toolbar->widgetForAction( m_buttonVideoThumbs );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ actionWidget = toolbar->widgetForAction(m_buttonVideoThumbs);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
- actionWidget = toolbar->widgetForAction( m_buttonAudioThumbs );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ actionWidget = toolbar->widgetForAction(m_buttonAudioThumbs);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
- actionWidget = toolbar->widgetForAction( m_buttonShowMarkers );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ actionWidget = toolbar->widgetForAction(m_buttonShowMarkers);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
- actionWidget = toolbar->widgetForAction( m_buttonSnap );
- actionWidget->setMaximumWidth(24);
- actionWidget->setMinimumHeight(17);
+ actionWidget = toolbar->widgetForAction(m_buttonSnap);
+ actionWidget->setMaximumWidth(24);
+ actionWidget->setMinimumHeight(17);
m_messageLabel = new StatusBarMessageLabel(this);
m_messageLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::MinimumExpanding);
actionCollection()->addAction("show_video_thumbs", m_buttonVideoThumbs);
actionCollection()->addAction("show_audio_thumbs", m_buttonAudioThumbs);
- actionCollection()->addAction("show_markers", m_buttonShowMarkers);
- actionCollection()->addAction("snap", m_buttonSnap);
+ actionCollection()->addAction("show_markers", m_buttonShowMarkers);
+ actionCollection()->addAction("snap", m_buttonSnap);
actionCollection()->addAction("zoom_fit", m_buttonFitZoom);
delete w;
}
MltVideoProfile prof;
- if (!profileName.isEmpty()) prof = ProfilesDialog::getVideoProfile(profileName);
- else prof = ProfilesDialog::getVideoProfile("dv_pal");
+ if (!profileName.isEmpty()) prof = ProfilesDialog::getVideoProfile(profileName);
+ else prof = ProfilesDialog::getVideoProfile("dv_pal");
if (prof.width == 0) prof = ProfilesDialog::getVideoProfile("dv_pal");
KdenliveDoc *doc = new KdenliveDoc(KUrl(), projectFolder, prof, m_commandStack, this);
TrackView *trackView = new TrackView(doc, this);
disconnect(trackView, SIGNAL(transitionItemSelected(Transition*)), this, SLOT(slotActivateTransitionView()));
disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
disconnect(trackView->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
- disconnect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
+ disconnect(trackView->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
disconnect(m_activeDocument, SIGNAL(docModified(bool)), this, SLOT(slotUpdateDocumentState(bool)));
disconnect(effectStack, SIGNAL(updateClipEffect(ClipItem*, QDomElement, QDomElement)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, QDomElement, QDomElement)));
void slotSwitchVideoThumbs();
void slotSwitchAudioThumbs();
void slotSwitchMarkersComments();
- void slotSwitchSnap();
+ void slotSwitchSnap();
void slotRenderProject();
void slotDoRender(const QString &dest, const QString &render, const QStringList &avformat_args, bool zoneOnly, bool playAfter);
void slotFullScreen();
m_view.marker_comment->selectAll();
m_view.marker_comment->setFocus();
- QPixmap p((int) (100 * m_dar), 100);
+ QPixmap p((int)(100 * m_dar), 100);
QString colour = clip->getProperty("colour");
switch (m_clip->clipType()) {
case VIDEO:
m_contextMenu->addMenu(playMenu);
QAction *extractFrame = m_contextMenu->addAction(KIcon("document-new"), i18n("Extract frame"));
connect(extractFrame, SIGNAL(triggered()), this, SLOT(slotExtractCurrentFrame()));
- connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
+ connect(m_ruler, SIGNAL(seekRenderer(int)), this, SLOT(slotSeek(int)));
kDebug() << "/////// BUILDING MONITOR, ID: " << ui.video_frame->winId();
}
if (render == NULL) return;
if (!m_isActive) m_monitorManager->activateMonitor(m_name);
if (!clip) return;
- if (clip != m_currentClip) {
- m_currentClip = clip;
- QDomDocument doc;
- QDomElement westley = doc.createElement("westley");
- doc.appendChild(westley);
- westley.appendChild(doc.importNode(m_currentClip->toXML(), true));
- render->setSceneList(doc, 0);
- m_ruler->slotNewValue(0);
- m_timePos->setText("00:00:00:00");
- m_position = 0;
- }
- if (position != -1) render->seek(GenTime(position, render->fps()));
+ if (clip != m_currentClip) {
+ m_currentClip = clip;
+ QDomDocument doc;
+ QDomElement westley = doc.createElement("westley");
+ doc.appendChild(westley);
+ westley.appendChild(doc.importNode(m_currentClip->toXML(), true));
+ render->setSceneList(doc, 0);
+ m_ruler->slotNewValue(0);
+ m_timePos->setText("00:00:00:00");
+ m_position = 0;
+ }
+ if (position != -1) render->seek(GenTime(position, render->fps()));
}
void Monitor::slotOpenFile(const QString &file) {
KRestrictedLine *m_timePos;
QAction *m_playAction;
QMenu *m_contextMenu;
- DocClipBase *m_currentClip;
+ DocClipBase *m_currentClip;
private slots:
void adjustRulerSize(int length);
#include <KLocale>
#include <KStandardDirs>
#include <KComboBox>
+#include <KIO/NetAccess>
#include "gentime.h"
#include "kdenlivesettings.h"
}
void RecMonitor::slotVideoDeviceChanged(int ix) {
- switch (ix) {
- case SCREENGRAB:
- m_discAction->setEnabled(false);
- m_rewAction->setEnabled(false);
- m_fwdAction->setEnabled(false);
- m_recAction->setEnabled(true);
- m_stopAction->setEnabled(false);
- m_playAction->setEnabled(false);
- break;
- case VIDEO4LINUX:
- m_discAction->setEnabled(false);
- m_rewAction->setEnabled(false);
- m_fwdAction->setEnabled(false);
- m_recAction->setEnabled(true);
- m_stopAction->setEnabled(false);
- m_playAction->setEnabled(true);
- break;
- default: // FIREWIRE
- m_discAction->setEnabled(true);
- m_recAction->setEnabled(false);
- m_stopAction->setEnabled(false);
- m_playAction->setEnabled(false);
- m_rewAction->setEnabled(false);
- m_fwdAction->setEnabled(false);
- break;
+ switch (ix) {
+ case SCREENGRAB:
+ m_discAction->setEnabled(false);
+ m_rewAction->setEnabled(false);
+ m_fwdAction->setEnabled(false);
+ m_recAction->setEnabled(true);
+ m_stopAction->setEnabled(false);
+ m_playAction->setEnabled(false);
+ ui.video_frame->setText(i18n("Press record button\nto start screen capture"));
+ break;
+ case VIDEO4LINUX:
+ m_discAction->setEnabled(false);
+ m_rewAction->setEnabled(false);
+ m_fwdAction->setEnabled(false);
+ m_recAction->setEnabled(true);
+ m_stopAction->setEnabled(false);
+ m_playAction->setEnabled(true);
+ checkDeviceAvailability();
+ break;
+ default: // FIREWIRE
+ m_discAction->setEnabled(true);
+ m_recAction->setEnabled(false);
+ m_stopAction->setEnabled(false);
+ m_playAction->setEnabled(false);
+ m_rewAction->setEnabled(false);
+ m_fwdAction->setEnabled(false);
+ ui.video_frame->setText(i18n("Press connect button\nto initialize connection"));
+ break;
}
}
+void RecMonitor::checkDeviceAvailability() {
+ if (!KIO::NetAccess::exists(KUrl(KdenliveSettings::video4vdevice()), KIO::NetAccess::SourceSide , this)) {
+ m_playAction->setEnabled(false);
+ m_recAction->setEnabled(false);
+ ui.video_frame->setText(i18n("Cannot read from device %1\nPlease check drivers and access rights.", KdenliveSettings::video4vdevice()));
+ } else ui.video_frame->setText(i18n("Press play or record button\nto start video capture"));
+}
+
void RecMonitor::slotDisconnect() {
if (captureProcess->state() == QProcess::NotRunning) {
slotStartCapture(false);
m_fwdAction->setEnabled(true);
} else {
captureProcess->write("q", 1);
- m_discAction->setIcon(KIcon("network-connect"));
- m_discAction->setText(i18n("Connect"));
- m_recAction->setEnabled(false);
- m_stopAction->setEnabled(false);
- m_playAction->setEnabled(false);
- m_rewAction->setEnabled(false);
- m_fwdAction->setEnabled(false);
}
}
void RecMonitor::slotStopCapture() {
// stop capture
- switch (ui.device_selector->currentIndex()) {
+ switch (ui.device_selector->currentIndex()) {
case FIREWIRE:
captureProcess->write("\e", 2);
m_playAction->setIcon(m_playIcon);
m_isPlaying = false;
- break;
+ break;
case VIDEO4LINUX:
- captureProcess->kill();
- displayProcess->kill();
- if (m_isCapturing && ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
- break;
+ QTimer::singleShot(1000, captureProcess, SLOT(kill()));
+ captureProcess->write("q\n", 3);
+
+ break;
case SCREENGRAB:
- QTimer::singleShot(1000, captureProcess, SLOT(kill()));
- if (m_isCapturing && ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
- break;
- default:
- break;
- }
+ QTimer::singleShot(1000, captureProcess, SLOT(kill()));
+ if (m_isCapturing && ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
+ break;
+ default:
+ break;
+ }
}
void RecMonitor::slotStartCapture(bool play) {
m_displayArgs.clear();
m_isPlaying = false;
- switch (ui.device_selector->currentIndex()) {
+ switch (ui.device_selector->currentIndex()) {
case FIREWIRE:
m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-";
m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
- captureProcess->setStandardOutputProcess(displayProcess);
+ captureProcess->setStandardOutputProcess(displayProcess);
captureProcess->setWorkingDirectory(KdenliveSettings::capturefolder());
captureProcess->start("dvgrab", m_captureArgs);
if (play) captureProcess->write(" ", 1);
m_discAction->setEnabled(true);
- break;
+ break;
case VIDEO4LINUX:
m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-";
m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
- captureProcess->setStandardOutputProcess(displayProcess);
- captureProcess->start("ffmpeg", m_captureArgs);
- break;
- default:
- break;
+ captureProcess->setStandardOutputProcess(displayProcess);
+ captureProcess->start("ffmpeg", m_captureArgs);
+ break;
+ default:
+ break;
}
if (ui.device_selector->currentIndex() != SCREENGRAB) {
- displayProcess->start("ffplay", m_displayArgs);
- ui.video_frame->setText(i18n("Initialising..."));
- } else {
- // do something when starting screen grab
- }
+ displayProcess->start("ffplay", m_displayArgs);
+ ui.video_frame->setText(i18n("Initialising..."));
+ } else {
+ // do something when starting screen grab
+ }
}
void RecMonitor::slotRecord() {
slotStartCapture();
}
if (m_isCapturing) {
- switch (ui.device_selector->currentIndex()) {
- case FIREWIRE:
+ switch (ui.device_selector->currentIndex()) {
+ case FIREWIRE:
captureProcess->write("\e", 2);
m_playAction->setIcon(m_playIcon);
m_isCapturing = false;
m_isPlaying = false;
m_recAction->setChecked(false);
- break;
+ break;
case VIDEO4LINUX:
slotStopCapture();
- m_isCapturing = false;
+ //m_isCapturing = false;
QTimer::singleShot(1000, this, SLOT(slotStartCapture()));
- break;
+ break;
case SCREENGRAB:
- captureProcess->write("q\n", 3);
- // in case ffmpeg doesn't exit with the 'q' command, kill it one second later
- QTimer::singleShot(1000, captureProcess, SLOT(kill()));
- break;
+ captureProcess->write("q\n", 3);
+ // in case ffmpeg doesn't exit with the 'q' command, kill it one second later
+ QTimer::singleShot(1000, captureProcess, SLOT(kill()));
+ break;
}
return;
} else if (ui.device_selector->currentIndex() == FIREWIRE) {
}
if (captureProcess->state() == QProcess::NotRunning) {
m_recAction->setChecked(true);
- QString extension = "mpg";
- if (ui.device_selector->currentIndex() == SCREENGRAB) extension = KdenliveSettings::screengrabextension();
+ QString extension = "mpg";
+ if (ui.device_selector->currentIndex() == SCREENGRAB) extension = KdenliveSettings::screengrabextension();
QString path = KdenliveSettings::capturefolder() + "/capture0000." + extension;
int i = 1;
while (QFile::exists(path)) {
m_captureArgs.clear();
m_displayArgs.clear();
- QString args;
+ QString args;
- switch (ui.device_selector->currentIndex()) {
- case FIREWIRE:
+ switch (ui.device_selector->currentIndex()) {
+ case FIREWIRE:
m_captureArgs << "--format" << "hdv" << "-i" << "capture" << "-";
m_displayArgs << "-f" << "mpegts" << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
- captureProcess->setStandardOutputProcess(displayProcess);
- captureProcess->start("dvgrab", m_captureArgs);
- break;
- case VIDEO4LINUX:
+ captureProcess->setStandardOutputProcess(displayProcess);
+ captureProcess->start("dvgrab", m_captureArgs);
+ break;
+ case VIDEO4LINUX:
m_captureArgs << KdenliveSettings::video4capture().simplified().split(' ') << "-y" << m_captureFile.path() << "-f" << KdenliveSettings::video4vencoding() << "-";
m_displayArgs << KdenliveSettings::video4playback().simplified().split(' ') << "-x" << QString::number(ui.video_frame->width()) << "-y" << QString::number(ui.video_frame->height()) << "-";
- captureProcess->setStandardOutputProcess(displayProcess);
- captureProcess->start("ffmpeg", m_captureArgs);
- break;
- case SCREENGRAB:
- if (KdenliveSettings::fullscreengrab()) {
- const QRect rect = QApplication::desktop()->screenGeometry();
- args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(rect.width()) + "x" + QString::number(rect.height())).replace("%offset", QString());
- kDebug()<<"// capture params: "<<args;
- m_captureArgs << args.simplified().split(' ') <<KdenliveSettings::screengrabencoding().simplified().split(' ')<<m_captureFile.path();
- ui.video_frame->setText(i18n("Capturing..."));
- m_isCapturing = true;
- captureProcess->start("ffmpeg", m_captureArgs);
- }
- else {
- ui.video_frame->setText(i18n("Select region..."));
- rgnGrab = new RegionGrabber();
- connect( rgnGrab, SIGNAL( regionGrabbed( const QRect&) ), SLOT( slotStartGrab( const QRect & ) ) );
- }
- break;
- default:
- break;
- }
+ captureProcess->setStandardOutputProcess(displayProcess);
+ captureProcess->start("ffmpeg", m_captureArgs);
+ break;
+ case SCREENGRAB:
+ if (KdenliveSettings::fullscreengrab()) {
+ const QRect rect = QApplication::desktop()->screenGeometry();
+ args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(rect.width()) + "x" + QString::number(rect.height())).replace("%offset", QString());
+ kDebug() << "// capture params: " << args;
+ m_captureArgs << args.simplified().split(' ') << KdenliveSettings::screengrabencoding().simplified().split(' ') << m_captureFile.path();
+ ui.video_frame->setText(i18n("Capturing..."));
+ m_isCapturing = true;
+ captureProcess->start("ffmpeg", m_captureArgs);
+ } else {
+ ui.video_frame->setText(i18n("Select region..."));
+ rgnGrab = new RegionGrabber();
+ connect(rgnGrab, SIGNAL(regionGrabbed(const QRect&)), SLOT(slotStartGrab(const QRect &)));
+ }
+ break;
+ default:
+ break;
+ }
//ui.video_frame->setScaledContents(false);
if (ui.device_selector->currentIndex() != SCREENGRAB) {
- m_isCapturing = true;
- displayProcess->start("ffplay", m_displayArgs);
- ui.video_frame->setText(i18n("Initialising..."));
- }
+ m_isCapturing = true;
+ displayProcess->start("ffplay", m_displayArgs);
+ ui.video_frame->setText(i18n("Initialising..."));
+ }
} else {
// stop capture
displayProcess->kill();
}
}
-void RecMonitor::slotStartGrab(const QRect &rect)
-{
- rgnGrab->deleteLater();
- QApplication::restoreOverrideCursor();
- show();
- if (rect.isNull()) return;
- int width = rect.width();
- int height = rect.height();
- if (width % 2 != 0) width--;
- if (height % 2 != 0) height--;
- QString args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(width) + "x" + QString::number(height)).replace("%offset", "+" + QString::number(rect.x()) + "," + QString::number(rect.y()));
- kDebug()<<"// capture params: "<<args;
- m_captureArgs << args.simplified().split(' ') <<KdenliveSettings::screengrabencoding().simplified().split(' ')<<m_captureFile.path();
- m_isCapturing = true;
- ui.video_frame->setText(i18n("Capturing..."));
- captureProcess->start("ffmpeg", m_captureArgs);
+void RecMonitor::slotStartGrab(const QRect &rect) {
+ rgnGrab->deleteLater();
+ QApplication::restoreOverrideCursor();
+ show();
+ if (rect.isNull()) return;
+ int width = rect.width();
+ int height = rect.height();
+ if (width % 2 != 0) width--;
+ if (height % 2 != 0) height--;
+ QString args = KdenliveSettings::screengrabcapture().replace("%size", QString::number(width) + "x" + QString::number(height)).replace("%offset", "+" + QString::number(rect.x()) + "," + QString::number(rect.y()));
+ kDebug() << "// capture params: " << args;
+ m_captureArgs << args.simplified().split(' ') << KdenliveSettings::screengrabencoding().simplified().split(' ') << m_captureFile.path();
+ m_isCapturing = true;
+ ui.video_frame->setText(i18n("Capturing..."));
+ captureProcess->start("ffmpeg", m_captureArgs);
}
void RecMonitor::slotProcessStatus(QProcess::ProcessState status) {
if (status == QProcess::NotRunning) {
- if (m_isCapturing && ui.device_selector->currentIndex() == SCREENGRAB) {
- if (ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
- }
+ displayProcess->kill();
+ if (m_isCapturing && ui.device_selector->currentIndex() != FIREWIRE)
+ if (ui.autoaddbox->isChecked()) emit addProjectClip(m_captureFile);
+ if (ui.device_selector->currentIndex() == FIREWIRE) {
+ m_discAction->setIcon(KIcon("network-connect"));
+ m_discAction->setText(i18n("Connect"));
+ m_recAction->setEnabled(false);
+ m_stopAction->setEnabled(false);
+ m_playAction->setEnabled(false);
+ m_rewAction->setEnabled(false);
+ m_fwdAction->setEnabled(false);
+ }
m_isCapturing = false;
m_isPlaying = false;
m_playAction->setIcon(m_playIcon);
m_recAction->setChecked(false);
m_stopAction->setEnabled(false);
ui.device_selector->setEnabled(true);
- if (captureProcess && captureProcess->exitStatus() == QProcess::CrashExit) {
- ui.video_frame->setText(i18n("Capture crashed, please check your parameters"));
- }
- else ui.video_frame->setText(i18n("Not connected"));
+ if (captureProcess && captureProcess->exitStatus() == QProcess::CrashExit) {
+ ui.video_frame->setText(i18n("Capture crashed, please check your parameters"));
+ } else ui.video_frame->setText(i18n("Not connected"));
} else {
m_stopAction->setEnabled(true);
ui.device_selector->setEnabled(false);
RecMonitor(QString name, QWidget *parent = 0);
QString name() const;
-enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB =2};
+ enum CAPTUREDEVICE {FIREWIRE = 0, VIDEO4LINUX = 1, SCREENGRAB = 2};
protected:
virtual void mousePressEvent(QMouseEvent * event);
Ui::RecMonitor_UI ui;
QString m_tmpFolder;
QString m_name;
- RegionGrabber *rgnGrab;
+ RegionGrabber *rgnGrab;
bool m_isActive;
QAction *m_rewAction;
QAction *m_stopAction;
QAction *m_discAction;
+ void checkDeviceAvailability();
private slots:
void slotStartCapture(bool play = true);
void slotRewind();
void slotForward();
void slotDisconnect();
- void slotStartGrab(const QRect &rect);
+ void slotStartGrab(const QRect &rect);
public slots:
void refreshRecMonitor(bool visible);
#include <klocale.h>
#include <KWindowSystem>
-RegionGrabber::RegionGrabber( ) :
- QWidget( 0 ), selection(), mouseDown( false ), newSelection( false ),
- handleSize( 10 ), mouseOverHandle( 0 ), idleTimer(),
- showHelp( true ), grabbing( false ),
- TLHandle(0,0,handleSize,handleSize), TRHandle(0,0,handleSize,handleSize),
- BLHandle(0,0,handleSize,handleSize), BRHandle(0,0,handleSize,handleSize),
- LHandle(0,0,handleSize,handleSize), THandle(0,0,handleSize,handleSize),
- RHandle(0,0,handleSize,handleSize), BHandle(0,0,handleSize,handleSize)
-{
+RegionGrabber::RegionGrabber() :
+ QWidget(0), selection(), mouseDown(false), newSelection(false),
+ handleSize(10), mouseOverHandle(0), idleTimer(),
+ showHelp(true), grabbing(false),
+ TLHandle(0, 0, handleSize, handleSize), TRHandle(0, 0, handleSize, handleSize),
+ BLHandle(0, 0, handleSize, handleSize), BRHandle(0, 0, handleSize, handleSize),
+ LHandle(0, 0, handleSize, handleSize), THandle(0, 0, handleSize, handleSize),
+ RHandle(0, 0, handleSize, handleSize), BHandle(0, 0, handleSize, handleSize) {
handles << &TLHandle << &TRHandle << &BLHandle << &BRHandle
- << &LHandle << &THandle << &RHandle << &BHandle;
- setMouseTracking( true );
- setWindowFlags( Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
+ << &LHandle << &THandle << &RHandle << &BHandle;
+ setMouseTracking(true);
+ setWindowFlags(Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
int timeout = KWindowSystem::compositingActive() ? 200 : 50;
- QTimer::singleShot( timeout, this, SLOT(init()) );
- connect( &idleTimer, SIGNAL( timeout() ), this, SLOT( displayHelp() ) );
- idleTimer.start( 3000 );
+ QTimer::singleShot(timeout, this, SLOT(init()));
+ connect(&idleTimer, SIGNAL(timeout()), this, SLOT(displayHelp()));
+ idleTimer.start(3000);
}
-RegionGrabber::~RegionGrabber()
-{
+RegionGrabber::~RegionGrabber() {
}
-void RegionGrabber::init()
-{
- pixmap = QPixmap::grabWindow( QApplication::desktop()->winId() );
+void RegionGrabber::init() {
+ pixmap = QPixmap::grabWindow(QApplication::desktop()->winId());
showFullScreen();
- resize( pixmap.size() );
+ resize(pixmap.size());
move(0, 0);
- setCursor( Qt::CrossCursor );
+ setCursor(Qt::CrossCursor);
}
-void RegionGrabber::displayHelp()
-{
+void RegionGrabber::displayHelp() {
showHelp = true;
update();
}
-void RegionGrabber::paintEvent( QPaintEvent* e )
-{
- Q_UNUSED( e );
- if ( grabbing ) // grabWindow() should just get the background
+void RegionGrabber::paintEvent(QPaintEvent* e) {
+ Q_UNUSED(e);
+ if (grabbing) // grabWindow() should just get the background
return;
- QPainter painter( this );
+ QPainter painter(this);
QPalette pal(QToolTip::palette());
QFont font = QToolTip::font();
- QColor handleColor = pal.color( QPalette::Active, QPalette::Highlight );
- handleColor.setAlpha( 160 );
- QColor overlayColor( 0, 0, 0, 160 );
- QColor textColor = pal.color( QPalette::Active, QPalette::Text );
- QColor textBackgroundColor = pal.color( QPalette::Active, QPalette::Base );
+ QColor handleColor = pal.color(QPalette::Active, QPalette::Highlight);
+ handleColor.setAlpha(160);
+ QColor overlayColor(0, 0, 0, 160);
+ QColor textColor = pal.color(QPalette::Active, QPalette::Text);
+ QColor textBackgroundColor = pal.color(QPalette::Active, QPalette::Base);
painter.drawPixmap(0, 0, pixmap);
painter.setFont(font);
-
- QRect r = selection.normalized().adjusted( 0, 0, -1, -1 );
- if ( !selection.isNull() )
- {
- QRegion grey( rect() );
- grey = grey.subtracted( r );
- painter.setPen( handleColor );
- painter.setBrush( overlayColor );
- painter.setClipRegion( grey );
- painter.drawRect( -1, -1, rect().width() + 1, rect().height() + 1 );
- painter.setClipRect( rect() );
- painter.setBrush( Qt::NoBrush );
- painter.drawRect( r );
+
+ QRect r = selection.normalized().adjusted(0, 0, -1, -1);
+ if (!selection.isNull()) {
+ QRegion grey(rect());
+ grey = grey.subtracted(r);
+ painter.setPen(handleColor);
+ painter.setBrush(overlayColor);
+ painter.setClipRegion(grey);
+ painter.drawRect(-1, -1, rect().width() + 1, rect().height() + 1);
+ painter.setClipRect(rect());
+ painter.setBrush(Qt::NoBrush);
+ painter.drawRect(r);
}
- if ( showHelp )
- {
- painter.setPen( textColor );
- painter.setBrush( textBackgroundColor );
- QString helpText = i18n( "Select a region using the mouse. To take the snapshot, press the Enter key. Press Esc to quit." );
- QRect textRect = painter.boundingRect( rect().adjusted( 2, 2, -2, -2 ), Qt::TextWordWrap, helpText );
- textRect.adjust( -2, -2, 4, 2 );
- painter.drawRect( textRect );
- textRect.moveTopLeft( QPoint( 3, 3 ) );
- painter.drawText( textRect, helpText );
+ if (showHelp) {
+ painter.setPen(textColor);
+ painter.setBrush(textBackgroundColor);
+ QString helpText = i18n("Select a region using the mouse. To take the snapshot, press the Enter key. Press Esc to quit.");
+ QRect textRect = painter.boundingRect(rect().adjusted(2, 2, -2, -2), Qt::TextWordWrap, helpText);
+ textRect.adjust(-2, -2, 4, 2);
+ painter.drawRect(textRect);
+ textRect.moveTopLeft(QPoint(3, 3));
+ painter.drawText(textRect, helpText);
}
- if ( selection.isNull() )
- {
+ if (selection.isNull()) {
return;
}
// The grabbed region is everything which is covered by the drawn
// rectangles (border included). This means that there is no 0px
// selection, since a 0px wide rectangle will always be drawn as a line.
- QString txt = QString( "%1x%2" ).arg( selection.width() == 0 ? 2 : selection.width() )
- .arg( selection.height() == 0 ? 2 : selection.height() );
- QRect textRect = painter.boundingRect( rect(), Qt::AlignLeft, txt );
- QRect boundingRect = textRect.adjusted( -4, 0, 0, 0);
-
- if ( textRect.width() < r.width() - 2*handleSize &&
- textRect.height() < r.height() - 2*handleSize &&
- ( r.width() > 100 && r.height() > 100 ) ) // center, unsuitable for small selections
- {
- boundingRect.moveCenter( r.center() );
- textRect.moveCenter( r.center() );
- }
- else if ( r.y() - 3 > textRect.height() &&
- r.x() + textRect.width() < rect().right() ) // on top, left aligned
- {
- boundingRect.moveBottomLeft( QPoint( r.x(), r.y() - 3 ) );
- textRect.moveBottomLeft( QPoint( r.x() + 2, r.y() - 3 ) );
- }
- else if ( r.x() - 3 > textRect.width() ) // left, top aligned
- {
- boundingRect.moveTopRight( QPoint( r.x() - 3, r.y() ) );
- textRect.moveTopRight( QPoint( r.x() - 5, r.y() ) );
- }
- else if ( r.bottom() + 3 + textRect.height() < rect().bottom() &&
- r.right() > textRect.width() ) // at bottom, right aligned
- {
- boundingRect.moveTopRight( QPoint( r.right(), r.bottom() + 3 ) );
- textRect.moveTopRight( QPoint( r.right() - 2, r.bottom() + 3 ) );
- }
- else if ( r.right() + textRect.width() + 3 < rect().width() ) // right, bottom aligned
- {
- boundingRect.moveBottomLeft( QPoint( r.right() + 3, r.bottom() ) );
- textRect.moveBottomLeft( QPoint( r.right() + 5, r.bottom() ) );
+ QString txt = QString("%1x%2").arg(selection.width() == 0 ? 2 : selection.width())
+ .arg(selection.height() == 0 ? 2 : selection.height());
+ QRect textRect = painter.boundingRect(rect(), Qt::AlignLeft, txt);
+ QRect boundingRect = textRect.adjusted(-4, 0, 0, 0);
+
+ if (textRect.width() < r.width() - 2*handleSize &&
+ textRect.height() < r.height() - 2*handleSize &&
+ (r.width() > 100 && r.height() > 100)) { // center, unsuitable for small selections
+ boundingRect.moveCenter(r.center());
+ textRect.moveCenter(r.center());
+ } else if (r.y() - 3 > textRect.height() &&
+ r.x() + textRect.width() < rect().right()) { // on top, left aligned
+ boundingRect.moveBottomLeft(QPoint(r.x(), r.y() - 3));
+ textRect.moveBottomLeft(QPoint(r.x() + 2, r.y() - 3));
+ } else if (r.x() - 3 > textRect.width()) { // left, top aligned
+ boundingRect.moveTopRight(QPoint(r.x() - 3, r.y()));
+ textRect.moveTopRight(QPoint(r.x() - 5, r.y()));
+ } else if (r.bottom() + 3 + textRect.height() < rect().bottom() &&
+ r.right() > textRect.width()) { // at bottom, right aligned
+ boundingRect.moveTopRight(QPoint(r.right(), r.bottom() + 3));
+ textRect.moveTopRight(QPoint(r.right() - 2, r.bottom() + 3));
+ } else if (r.right() + textRect.width() + 3 < rect().width()) { // right, bottom aligned
+ boundingRect.moveBottomLeft(QPoint(r.right() + 3, r.bottom()));
+ textRect.moveBottomLeft(QPoint(r.right() + 5, r.bottom()));
}
// if the above didn't catch it, you are running on a very tiny screen...
- painter.setPen( textColor );
- painter.setBrush( textBackgroundColor );
- painter.drawRect( boundingRect );
- painter.drawText( textRect, txt );
-
- if ( ( r.height() > handleSize*2 && r.width() > handleSize*2 )
- || !mouseDown )
- {
+ painter.setPen(textColor);
+ painter.setBrush(textBackgroundColor);
+ painter.drawRect(boundingRect);
+ painter.drawText(textRect, txt);
+
+ if ((r.height() > handleSize*2 && r.width() > handleSize*2)
+ || !mouseDown) {
updateHandles();
- painter.setPen( handleColor );
- handleColor.setAlpha( 60 );
- painter.setBrush( handleColor );
- painter.drawRects( handleMask().rects() );
+ painter.setPen(handleColor);
+ handleColor.setAlpha(60);
+ painter.setBrush(handleColor);
+ painter.drawRects(handleMask().rects());
}
}
-void RegionGrabber::resizeEvent( QResizeEvent* e )
-{
- Q_UNUSED( e );
- if ( selection.isNull() )
+void RegionGrabber::resizeEvent(QResizeEvent* e) {
+ Q_UNUSED(e);
+ if (selection.isNull())
return;
QRect r = selection;
- r.setTopLeft( limitPointToRect( r.topLeft(), rect() ) );
- r.setBottomRight( limitPointToRect( r.bottomRight(), rect() ) );
- if ( r.width() <= 1 || r.height() <= 1 ) //this just results in ugly drawing...
+ r.setTopLeft(limitPointToRect(r.topLeft(), rect()));
+ r.setBottomRight(limitPointToRect(r.bottomRight(), rect()));
+ if (r.width() <= 1 || r.height() <= 1) //this just results in ugly drawing...
r = QRect();
selection = r;
}
-void RegionGrabber::mousePressEvent( QMouseEvent* e )
-{
+void RegionGrabber::mousePressEvent(QMouseEvent* e) {
showHelp = false;
idleTimer.stop();
- if ( e->button() == Qt::LeftButton )
- {
+ if (e->button() == Qt::LeftButton) {
mouseDown = true;
dragStartPoint = e->pos();
selectionBeforeDrag = selection;
- if ( !selection.contains( e->pos() ) )
- {
+ if (!selection.contains(e->pos())) {
newSelection = true;
selection = QRect();
showHelp = true;
+ } else {
+ setCursor(Qt::ClosedHandCursor);
}
- else
- {
- setCursor( Qt::ClosedHandCursor );
- }
- }
- else if ( e->button() == Qt::RightButton )
- {
+ } else if (e->button() == Qt::RightButton) {
newSelection = false;
selection = QRect();
- setCursor( Qt::CrossCursor );
+ setCursor(Qt::CrossCursor);
}
update();
}
-void RegionGrabber::mouseMoveEvent( QMouseEvent* e )
-{
- if ( mouseDown )
- {
- if ( newSelection )
- {
+void RegionGrabber::mouseMoveEvent(QMouseEvent* e) {
+ if (mouseDown) {
+ if (newSelection) {
QPoint p = e->pos();
QRect r = rect();
- selection = QRect( dragStartPoint, limitPointToRect( p, r ) ).normalized();
- }
- else if ( mouseOverHandle == 0 ) // moving the whole selection
- {
+ selection = QRect(dragStartPoint, limitPointToRect(p, r)).normalized();
+ } else if (mouseOverHandle == 0) { // moving the whole selection
QRect r = rect().normalized(), s = selectionBeforeDrag.normalized();
QPoint p = s.topLeft() + e->pos() - dragStartPoint;
- r.setBottomRight( r.bottomRight() - QPoint( s.width(), s.height() ) );
- if ( !r.isNull() && r.isValid() )
- selection.moveTo( limitPointToRect( p, r ) );
- }
- else // dragging a handle
- {
+ r.setBottomRight(r.bottomRight() - QPoint(s.width(), s.height()));
+ if (!r.isNull() && r.isValid())
+ selection.moveTo(limitPointToRect(p, r));
+ } else { // dragging a handle
QRect r = selectionBeforeDrag;
QPoint offset = e->pos() - dragStartPoint;
- if ( mouseOverHandle == &TLHandle || mouseOverHandle == &THandle
- || mouseOverHandle == &TRHandle ) // dragging one of the top handles
- {
- r.setTop( r.top() + offset.y() );
+ if (mouseOverHandle == &TLHandle || mouseOverHandle == &THandle
+ || mouseOverHandle == &TRHandle) { // dragging one of the top handles
+ r.setTop(r.top() + offset.y());
}
- if ( mouseOverHandle == &TLHandle || mouseOverHandle == &LHandle
- || mouseOverHandle == &BLHandle ) // dragging one of the left handles
- {
- r.setLeft( r.left() + offset.x() );
+ if (mouseOverHandle == &TLHandle || mouseOverHandle == &LHandle
+ || mouseOverHandle == &BLHandle) { // dragging one of the left handles
+ r.setLeft(r.left() + offset.x());
}
- if ( mouseOverHandle == &BLHandle || mouseOverHandle == &BHandle
- || mouseOverHandle == &BRHandle ) // dragging one of the bottom handles
- {
- r.setBottom( r.bottom() + offset.y() );
+ if (mouseOverHandle == &BLHandle || mouseOverHandle == &BHandle
+ || mouseOverHandle == &BRHandle) { // dragging one of the bottom handles
+ r.setBottom(r.bottom() + offset.y());
}
- if ( mouseOverHandle == &TRHandle || mouseOverHandle == &RHandle
- || mouseOverHandle == &BRHandle ) // dragging one of the right handles
- {
- r.setRight( r.right() + offset.x() );
+ if (mouseOverHandle == &TRHandle || mouseOverHandle == &RHandle
+ || mouseOverHandle == &BRHandle) { // dragging one of the right handles
+ r.setRight(r.right() + offset.x());
}
r = r.normalized();
- r.setTopLeft( limitPointToRect( r.topLeft(), rect() ) );
- r.setBottomRight( limitPointToRect( r.bottomRight(), rect() ) );
+ r.setTopLeft(limitPointToRect(r.topLeft(), rect()));
+ r.setBottomRight(limitPointToRect(r.bottomRight(), rect()));
selection = r;
}
update();
- }
- else
- {
- if ( selection.isNull() )
+ } else {
+ if (selection.isNull())
return;
bool found = false;
- foreach( QRect* r, handles )
- {
- if ( r->contains( e->pos() ) )
- {
+ foreach(QRect* r, handles) {
+ if (r->contains(e->pos())) {
mouseOverHandle = r;
found = true;
break;
}
}
- if ( !found )
- {
+ if (!found) {
mouseOverHandle = 0;
- if ( selection.contains( e->pos() ) )
- setCursor( Qt::OpenHandCursor );
+ if (selection.contains(e->pos()))
+ setCursor(Qt::OpenHandCursor);
else
- setCursor( Qt::CrossCursor );
- }
- else
- {
- if ( mouseOverHandle == &TLHandle || mouseOverHandle == &BRHandle )
- setCursor( Qt::SizeFDiagCursor );
- if ( mouseOverHandle == &TRHandle || mouseOverHandle == &BLHandle )
- setCursor( Qt::SizeBDiagCursor );
- if ( mouseOverHandle == &LHandle || mouseOverHandle == &RHandle )
- setCursor( Qt::SizeHorCursor );
- if ( mouseOverHandle == &THandle || mouseOverHandle == &BHandle )
- setCursor( Qt::SizeVerCursor );
+ setCursor(Qt::CrossCursor);
+ } else {
+ if (mouseOverHandle == &TLHandle || mouseOverHandle == &BRHandle)
+ setCursor(Qt::SizeFDiagCursor);
+ if (mouseOverHandle == &TRHandle || mouseOverHandle == &BLHandle)
+ setCursor(Qt::SizeBDiagCursor);
+ if (mouseOverHandle == &LHandle || mouseOverHandle == &RHandle)
+ setCursor(Qt::SizeHorCursor);
+ if (mouseOverHandle == &THandle || mouseOverHandle == &BHandle)
+ setCursor(Qt::SizeVerCursor);
}
}
}
-void RegionGrabber::mouseReleaseEvent( QMouseEvent* e )
-{
+void RegionGrabber::mouseReleaseEvent(QMouseEvent* e) {
mouseDown = false;
newSelection = false;
idleTimer.start();
- if ( mouseOverHandle == 0 && selection.contains( e->pos() ) )
- setCursor( Qt::OpenHandCursor );
+ if (mouseOverHandle == 0 && selection.contains(e->pos()))
+ setCursor(Qt::OpenHandCursor);
update();
}
-void RegionGrabber::mouseDoubleClickEvent( QMouseEvent* )
-{
+void RegionGrabber::mouseDoubleClickEvent(QMouseEvent*) {
grabRect();
}
-void RegionGrabber::keyPressEvent( QKeyEvent* e )
-{
- if ( e->key() == Qt::Key_Escape )
- {
- emit regionGrabbed( QRect() );
- close();
- }
- else if ( e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return )
- {
+void RegionGrabber::keyPressEvent(QKeyEvent* e) {
+ if (e->key() == Qt::Key_Escape) {
+ emit regionGrabbed(QRect());
+ close();
+ } else if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
grabRect();
- }
- else
- {
+ } else {
e->ignore();
}
}
-void RegionGrabber::grabRect()
-{
+void RegionGrabber::grabRect() {
QRect r = selection.normalized();
- if ( !r.isNull() && r.isValid() )
- {
- grabbing = true;
- emit regionGrabbed( r );
+ if (!r.isNull() && r.isValid()) {
+ grabbing = true;
+ emit regionGrabbed(r);
}
- close();
+ close();
}
-void RegionGrabber::updateHandles()
-{
- QRect r = selection.normalized().adjusted( 0, 0, -1, -1 );
+void RegionGrabber::updateHandles() {
+ QRect r = selection.normalized().adjusted(0, 0, -1, -1);
int s2 = handleSize / 2;
- TLHandle.moveTopLeft( r.topLeft() );
- TRHandle.moveTopRight( r.topRight() );
- BLHandle.moveBottomLeft( r.bottomLeft() );
- BRHandle.moveBottomRight( r.bottomRight() );
+ TLHandle.moveTopLeft(r.topLeft());
+ TRHandle.moveTopRight(r.topRight());
+ BLHandle.moveBottomLeft(r.bottomLeft());
+ BRHandle.moveBottomRight(r.bottomRight());
- LHandle.moveTopLeft( QPoint( r.x(), r.y() + r.height() / 2 - s2) );
- THandle.moveTopLeft( QPoint( r.x() + r.width() / 2 - s2, r.y() ) );
- RHandle.moveTopRight( QPoint( r.right(), r.y() + r.height() / 2 - s2 ) );
- BHandle.moveBottomLeft( QPoint( r.x() + r.width() / 2 - s2, r.bottom() ) );
+ LHandle.moveTopLeft(QPoint(r.x(), r.y() + r.height() / 2 - s2));
+ THandle.moveTopLeft(QPoint(r.x() + r.width() / 2 - s2, r.y()));
+ RHandle.moveTopRight(QPoint(r.right(), r.y() + r.height() / 2 - s2));
+ BHandle.moveBottomLeft(QPoint(r.x() + r.width() / 2 - s2, r.bottom()));
}
-QRegion RegionGrabber::handleMask() const
-{
+QRegion RegionGrabber::handleMask() const {
// note: not normalized QRects are bad here, since they will not be drawn
QRegion mask;
- foreach( QRect* rect, handles ) mask += QRegion( *rect );
+ foreach(QRect* rect, handles) mask += QRegion(*rect);
return mask;
}
-QPoint RegionGrabber::limitPointToRect( const QPoint &p, const QRect &r ) const
-{
+QPoint RegionGrabber::limitPointToRect(const QPoint &p, const QRect &r) const {
QPoint q;
- q.setX( p.x() < r.x() ? r.x() : p.x() < r.right() ? p.x() : r.right() );
- q.setY( p.y() < r.y() ? r.y() : p.y() < r.bottom() ? p.y() : r.bottom() );
+ q.setX(p.x() < r.x() ? r.x() : p.x() < r.right() ? p.x() : r.right());
+ q.setY(p.y() < r.y() ? r.y() : p.y() < r.bottom() ? p.y() : r.bottom());
return q;
}
class QResizeEvent;
class QMouseEvent;
-class RegionGrabber : public QWidget
-{
+class RegionGrabber : public QWidget {
Q_OBJECT
public:
RegionGrabber();
void displayHelp();
signals:
- void regionGrabbed( const QRect & );
+ void regionGrabbed(const QRect &);
protected:
- void paintEvent( QPaintEvent* e );
- void resizeEvent( QResizeEvent* e );
- void mousePressEvent( QMouseEvent* e );
- void mouseMoveEvent( QMouseEvent* e );
- void mouseReleaseEvent( QMouseEvent* e );
- void mouseDoubleClickEvent( QMouseEvent* );
- void keyPressEvent( QKeyEvent* e );
+ void paintEvent(QPaintEvent* e);
+ void resizeEvent(QResizeEvent* e);
+ void mousePressEvent(QMouseEvent* e);
+ void mouseMoveEvent(QMouseEvent* e);
+ void mouseReleaseEvent(QMouseEvent* e);
+ void mouseDoubleClickEvent(QMouseEvent*);
+ void keyPressEvent(QKeyEvent* e);
void updateHandles();
QRegion handleMask() const;
- QPoint limitPointToRect( const QPoint &p, const QRect &r ) const;
+ QPoint limitPointToRect(const QPoint &p, const QRect &r) const;
void grabRect();
QRect selection;
if (m_mltProducer->get_speed() == 0.0) m_mltProducer->set_speed(1.0);
else {
m_isBlocked = true;
- m_mltProducer->set_speed(0.0);
+ m_mltProducer->set_speed(0.0);
//m_mltConsumer->set("refresh", 0);
m_mltProducer->seek((int) m_framePosition);
m_isBlocked = false;
QMap<QString, QString>::Iterator it = args.begin();
if (!args.value("keyframes").isEmpty() || /*it.key().startsWith("#") || */tag.startsWith("ladspa") || tag == "sox" || tag == "autotrack_rectangle") {
// This is a keyframe effect, to edit it, we remove it and re-add it.
- bool success = mltRemoveEffect(track, position, index);
+ bool success = mltRemoveEffect(track, position, index);
if (success) success = mltAddEffect(track, position, args);
- return success;
+ return success;
}
// create filter
Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
trackPlaylist.consolidate_blanks(0);
if (!trackPlaylist.is_blank_at(moveEnd)) {
- // error, destination is not empty
+ // error, destination is not empty
//int ix = trackPlaylist.get_clip_index_at(moveEnd);
- mlt_service_unlock(m_mltConsumer->get_service());
- m_isBlocked = false;
- return false;
+ mlt_service_unlock(m_mltConsumer->get_service());
+ m_isBlocked = false;
+ return false;
+ } else {
+ trackPlaylist.insert_at(moveEnd, clipProducer, 1);
+ trackPlaylist.consolidate_blanks(0);
}
- else {
- trackPlaylist.insert_at(moveEnd, clipProducer, 1);
- trackPlaylist.consolidate_blanks(0);
- }
//mlt_service_unlock(service.get_service());
} else {
Mlt::Producer destTrackProducer(tractor.track(endTrack));
Mlt::Playlist destTrackPlaylist((mlt_playlist) destTrackProducer.get_service());
- if (!destTrackPlaylist.is_blank_at(moveEnd)) {
- // error, destination is not empty
- mlt_service_unlock(m_mltConsumer->get_service());
- m_isBlocked = false;
- return false;
- }
- else {
- Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
- trackPlaylist.consolidate_blanks(0);
- destTrackPlaylist.consolidate_blanks(1);
- destTrackPlaylist.insert_at(moveEnd, clipProducer, 1);
- destTrackPlaylist.consolidate_blanks(0);
- }
+ if (!destTrackPlaylist.is_blank_at(moveEnd)) {
+ // error, destination is not empty
+ mlt_service_unlock(m_mltConsumer->get_service());
+ m_isBlocked = false;
+ return false;
+ } else {
+ Mlt::Producer clipProducer(trackPlaylist.replace_with_blank(clipIndex));
+ trackPlaylist.consolidate_blanks(0);
+ destTrackPlaylist.consolidate_blanks(1);
+ destTrackPlaylist.insert_at(moveEnd, clipProducer, 1);
+ destTrackPlaylist.consolidate_blanks(0);
+ }
}
mltCheckLength();
mlt_service_unlock(m_mltConsumer->get_service());
m_isBlocked = false;
m_mltConsumer->set("refresh", 1);
- return true;
+ return true;
}
void Render::mltMoveTransition(QString type, int startTrack, int newTrack, int newTransitionTrack, GenTime oldIn, GenTime oldOut, GenTime newIn, GenTime newOut) {
if (resource == tag && b_track == currentTrack && currentIn <= old_pos && currentOut >= old_pos) {
//kDebug() << " / / / / /DELETE TRANS DOOOMNE";
mlt_field_disconnect_service(field->get_field(), nextservice);
- mlt_service_close(nextservice);
+ mlt_service_close(nextservice);
break;
}
nextservice = mlt_service_producer(nextservice);
}
void SmallRuler::slotNewValue(int _value) {
- m_cursorPosition = (int)(_value ); /// pixelPerMark());
+ m_cursorPosition = (int)(_value); /// pixelPerMark());
KRuler::slotNewValue(_value * pixelPerMark());
}
}
}
item->addEffect(clipeffect, false);
- item->effectsCounter();
+ item->effectsCounter();
}
}