Commit 727438e4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix errors in transition handling, should fix:

http://www.kdenlive.org/mantis/view.php?id=566

svn path=/branches/KDE4/; revision=2901
parent 8e7cd2d3
......@@ -20,7 +20,7 @@
#include "customtrackview.h"
EditTransitionCommand::EditTransitionCommand(CustomTrackView *view, const int track, GenTime pos, QDomElement oldeffect, QDomElement effect, bool doIt)
: m_view(view), m_track(track), m_pos(pos), m_oldeffect(oldeffect), m_doIt(false) {
: m_view(view), m_track(track), m_pos(pos), m_oldeffect(oldeffect), m_doIt(doIt) {
m_effect = effect.cloneNode().toElement();
QString effectName;
QDomNode namenode = effect.elementsByTagName("name").item(0);
......@@ -49,7 +49,7 @@ void EditTransitionCommand::undo() {
}
// virtual
void EditTransitionCommand::redo() {
m_view->updateTransition(m_track, m_pos, m_oldeffect, m_effect, m_doIt);
if (m_doIt) m_view->updateTransition(m_track, m_pos, m_oldeffect, m_effect, m_doIt);
m_doIt = true;
}
......@@ -107,8 +107,8 @@ void GraphicsSceneRectMove::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* e) {
void GraphicsSceneRectMove::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) {
if (m_tool == TITLE_RECTANGLE && m_selectedItem) setSelectedItem(m_selectedItem);
emit actionFinished();
QGraphicsScene::mouseReleaseEvent(e);
emit actionFinished();
}
void GraphicsSceneRectMove::mousePressEvent(QGraphicsSceneMouseEvent* e) {
......
......@@ -54,6 +54,8 @@
#include <knewstuff2/engine.h>
#include <knewstuff2/ui/knewstuffaction.h>
#include "mainwindow.h"
#include "kdenlivesettings.h"
#include "kdenlivesettingsdialog.h"
......@@ -86,6 +88,8 @@
#include "interfaces.h"
// #include "scriptingpart.h"
static const int ID_STATUS_MSG = 1;
static const int ID_EDITMODE_MSG = 2;
static const int ID_TIMELINE_MSG = 3;
......@@ -212,7 +216,11 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
tabifyDockWidget(clipMonitorDock, recMonitorDock);
setCentralWidget(m_timelineArea);
setupGUI();
/*ScriptingPart* sp = new ScriptingPart(this, QStringList());
guiFactory()->addClient(sp);*/
loadPlugins();
//kDebug() << factory() << " " << factory()->container("video_effects_menu", this);
......@@ -1489,7 +1497,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
disconnect(m_activeTimeline->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*, bool)));
disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView()));
disconnect(m_activeTimeline, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
disconnect(m_zoomSlider, SIGNAL(valueChanged(int)), m_activeTimeline, SLOT(slotChangeZoom(int)));
disconnect(m_activeTimeline->projectView(), SIGNAL(displayMessage(const QString&, MessageType)), m_messageLabel, SLOT(setMessage(const QString&, MessageType)));
disconnect(m_activeTimeline->projectView(), SIGNAL(showClipFrame(DocClipBase *, const int)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *, const int)));
......@@ -1546,7 +1554,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha
connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), effectStack, SLOT(slotClipItemSelected(ClipItem*, int)));
connect(trackView->projectView(), SIGNAL(clipItemSelected(ClipItem*, int)), this, SLOT(slotActivateEffectStackView()));
connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), transitionConfig, SLOT(slotTransitionItemSelected(Transition*, bool)));
connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView()));
connect(trackView, SIGNAL(transitionItemSelected(Transition*, bool)), this, SLOT(slotActivateTransitionView(Transition *)));
m_zoomSlider->setValue(doc->zoom());
connect(m_zoomSlider, SIGNAL(valueChanged(int)), trackView, SLOT(slotChangeZoom(int)));
connect(trackView->projectView(), SIGNAL(zoomIn()), this, SLOT(slotZoomIn()));
......@@ -1973,8 +1981,8 @@ void MainWindow::slotActivateEffectStackView() {
effectStack->raiseWindow(effectStackDock);
}
void MainWindow::slotActivateTransitionView() {
transitionConfig->raiseWindow(transitionConfigDock);
void MainWindow::slotActivateTransitionView(Transition *t) {
if (t) transitionConfig->raiseWindow(transitionConfigDock);
}
void MainWindow::slotSnapRewind() {
......
......@@ -25,7 +25,7 @@
#include "kdenlivesettings.h"
#include "mainwindow.h"
TransitionSettings::TransitionSettings(QWidget* parent): QWidget(parent), m_tracksCount(0) {
TransitionSettings::TransitionSettings(QWidget* parent): QWidget(parent), m_tracksCount(0), m_usedTransition(NULL) {
ui.setupUi(this);
effectEdit = new EffectStackEdit(ui.frame);
connect(effectEdit, SIGNAL(seekTimeline(int)), this, SIGNAL(seekTimeline(int)));
......@@ -59,15 +59,18 @@ void TransitionSettings::updateProjectFormat(MltVideoProfile profile, Timecode t
}
void TransitionSettings::slotTransitionChanged(bool reinit) {
void TransitionSettings::slotTransitionChanged(bool reinit, bool updateCurrent) {
kDebug() << "// TRANSITION CHANGED, REINIT: " << reinit;
QDomElement e = m_usedTransition->toXML().cloneNode().toElement();
if (reinit) {
QDomElement newTransition = MainWindow::transitions.getEffectByName(ui.transitionList->currentText()).cloneNode().toElement();
slotUpdateEffectParams(e, newTransition);
emit transferParamDesc(newTransition, m_usedTransition->startPos().frames(KdenliveSettings::project_fps()), m_usedTransition->endPos().frames(KdenliveSettings::project_fps()));
} else {
} else if (!updateCurrent) {
//slotUpdateEffectParams(e, e);
effectEdit->transferParamDesc(e, m_usedTransition->startPos().frames(KdenliveSettings::project_fps()), m_usedTransition->endPos().frames(KdenliveSettings::project_fps()));
} else {
slotUpdateEffectParams(e, e);
}
}
......@@ -88,23 +91,23 @@ void TransitionSettings::slotTransitionItemSelected(Transition* t, bool update)
if (update || t->duration() != m_transitionDuration || t->startPos() != m_transitionStart) {
m_transitionDuration = t->duration();
m_transitionStart = t->startPos();
slotTransitionChanged(false);
slotTransitionChanged(false, true);
}
return;
} else if (update) return;
m_usedTransition = t;
if (m_usedTransition) {
if (t) {
m_transitionDuration = t->duration();
m_transitionStart = t->startPos();
ui.transitionTrack->blockSignals(true);
if (!t->forcedTrack()) ui.transitionTrack->setCurrentIndex(0);
else ui.transitionTrack->setCurrentIndex(m_tracksCount + 1 - t->transitionEndTrack());
ui.transitionTrack->blockSignals(false);
int ix = ui.transitionList->findText(m_usedTransition->transitionName(), Qt::MatchExactly);
int ix = ui.transitionList->findText(t->transitionName(), Qt::MatchExactly);
m_usedTransition = t;
if (ix != -1) {
ui.transitionList->blockSignals(true);
ui.transitionList->setCurrentIndex(ix);
slotTransitionChanged(false);
slotTransitionChanged(false, false);
ui.transitionList->blockSignals(false);
}
}
......@@ -113,7 +116,9 @@ void TransitionSettings::slotTransitionItemSelected(Transition* t, bool update)
void TransitionSettings::slotUpdateEffectParams(const QDomElement& oldparam, const QDomElement& param) {
if (m_usedTransition) {
bool forced = m_usedTransition->forcedTrack();
m_usedTransition->setTransitionParameters(param);
m_usedTransition->setForcedTrack(forced, m_usedTransition->transitionEndTrack());
m_usedTransition->update();
}
/*QString test;
......
......@@ -45,7 +45,7 @@ private:
public slots:
void slotTransitionItemSelected(Transition*, bool);
void slotTransitionChanged(bool reinit = true);
void slotTransitionChanged(bool reinit = true, bool updateCurrent = false);
void slotUpdateEffectParams(const QDomElement&, const QDomElement&);
private slots:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment