From 6cd6bead270b9e0a3afd771beefa4460349f1546 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Tue, 14 Oct 2008 08:48:40 +0000 Subject: [PATCH] Fix automask effect crash svn path=/branches/KDE4/; revision=2468 --- effects/automask.xml | 4 ++-- src/effectstackview.cpp | 4 ++++ src/effectstackview.h | 3 +++ src/geometryval.cpp | 42 ++++++++++++++++++++++++++--------------- src/geometryval.h | 2 +- src/mainwindow.cpp | 1 + src/projectlistview.cpp | 18 +++++++++--------- 7 files changed, 47 insertions(+), 27 deletions(-) diff --git a/effects/automask.xml b/effects/automask.xml index b5bbf706..e963b41c 100644 --- a/effects/automask.xml +++ b/effects/automask.xml @@ -1,9 +1,9 @@ - + Auto Mask Hide a selected zone and follow its movements Zachary Drew - + Geometry diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index de232bd8..b643085b 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -77,6 +77,10 @@ void EffectStackView::setMenu(QMenu *menu) { ui.buttonNew->setMenu(menu); } +void EffectStackView::updateProjectFormat(MltVideoProfile profile) { + effectedit->updateProjectFormat(profile); +} + void EffectStackView::slotSaveEffect() { QString name = QInputDialog::getText(this, i18n("Save Effect"), i18n("Name for saved effect: ")); if (name.isEmpty()) return; diff --git a/src/effectstackview.h b/src/effectstackview.h index 90e43a46..477e6675 100644 --- a/src/effectstackview.h +++ b/src/effectstackview.h @@ -20,8 +20,10 @@ #include "ui_effectstack_ui.h" #include "effectstackedit.h" + class EffectsList; class ClipItem; +class MltVideoProfile; class EffectStackView : public QWidget { Q_OBJECT @@ -31,6 +33,7 @@ public: void raiseWindow(QWidget*); void clear(); void setMenu(QMenu *menu); + void updateProjectFormat(MltVideoProfile profile); private: Ui::EffectStack_UI ui; diff --git a/src/geometryval.cpp b/src/geometryval.cpp index 65ddfe56..050d5cc1 100644 --- a/src/geometryval.cpp +++ b/src/geometryval.cpp @@ -30,7 +30,7 @@ #include "geometryval.h" #include "kdenlivesettings.h" -Geometryval::Geometryval(const MltVideoProfile profile, QWidget* parent): QWidget(parent), m_profile(profile), m_geom(NULL), m_path(NULL), paramRect(NULL) { +Geometryval::Geometryval(const MltVideoProfile profile, QWidget* parent): QWidget(parent), m_profile(profile), m_geom(NULL), m_path(NULL), paramRect(NULL), m_fixedMode(false) { ui.setupUi(this); QVBoxLayout* vbox = new QVBoxLayout(ui.widget); QGraphicsView *view = new QGraphicsView(this); @@ -330,25 +330,34 @@ QDomElement Geometryval::getParamDesc() { void Geometryval::setupParam(const QDomElement& par, int minFrame, int maxFrame) { param = par; QString val = par.attribute("value"); + if (par.attribute("fixed") == "1") { + m_fixedMode = true; + } char *tmp = (char *) qstrdup(val.toUtf8().data()); if (m_geom) m_geom->parse(tmp, maxFrame - minFrame, m_profile.width, m_profile.height); else m_geom = new Mlt::Geometry(tmp, maxFrame - minFrame, m_profile.width, m_profile.height); delete[] tmp; + //kDebug() << " / / UPDATING TRANSITION VALUE: " << m_geom->serialise(); //read param her and set rect - m_helper->setKeyGeometry(m_geom, maxFrame - minFrame - 1); - m_helper->update(); - /*QDomDocument doc; - doc.appendChild(doc.importNode(par, true)); - kDebug() << "IMPORTED TRANS: " << doc.toString();*/ - ui.spinPos->setMaximum(maxFrame - minFrame - 1); - Mlt::GeometryItem item; - if (m_path == NULL) { - m_path = new QGraphicsPathItem(); - m_path->setPen(QPen(Qt::red)); - scene->addItem(m_path); + if (m_fixedMode) { + m_helper->setHidden(true); + ui.spinPos->setHidden(true); + } else { + m_helper->setKeyGeometry(m_geom, maxFrame - minFrame - 1); + m_helper->update(); + /*QDomDocument doc; + doc.appendChild(doc.importNode(par, true)); + kDebug() << "IMPORTED TRANS: " << doc.toString();*/ + ui.spinPos->setMaximum(maxFrame - minFrame - 1); + if (m_path == NULL) { + m_path = new QGraphicsPathItem(); + m_path->setPen(QPen(Qt::red)); + scene->addItem(m_path); + } + updateTransitionPath(); } - updateTransitionPath(); + Mlt::GeometryItem item; m_geom->fetch(&item, 0); if (paramRect) delete paramRect; @@ -359,11 +368,14 @@ void Geometryval::setupParam(const QDomElement& par, int minFrame, int maxFrame) paramRect->setPen(QPen(QBrush(QColor(255, 0, 0, 255)), 1.0)); scene->addItem(paramRect); slotPositionChanged(0, false); - connect(ui.spinPos, SIGNAL(valueChanged(int)), this , SLOT(slotPositionChanged(int))); - connect(ui.spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int))); + if (!m_fixedMode) { + connect(ui.spinPos, SIGNAL(valueChanged(int)), this , SLOT(slotPositionChanged(int))); + connect(ui.spinTransp, SIGNAL(valueChanged(int)), this , SLOT(slotTransparencyChanged(int))); + } } void Geometryval::updateTransitionPath() { + if (m_fixedMode) return; Mlt::GeometryItem item; int pos = 0; int counter = 0; diff --git a/src/geometryval.h b/src/geometryval.h index 27b8c46d..4d8aae78 100644 --- a/src/geometryval.h +++ b/src/geometryval.h @@ -54,7 +54,7 @@ private: QMenu *m_scaleMenu; QMenu *m_alignMenu; QAction *m_syncAction; - + bool m_fixedMode; void updateTransitionPath(); public slots: diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index ebe90747..82bc42ef 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1199,6 +1199,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) { //cha m_monitorManager->resetProfiles(doc->timecode()); m_projectList->setDocument(doc); transitionConfig->updateProjectFormat(doc->mltProfile()); + effectStack->updateProjectFormat(doc->mltProfile()); connect(m_projectList, SIGNAL(clipSelected(DocClipBase *)), m_clipMonitor, SLOT(slotSetXml(DocClipBase *))); connect(m_projectList, SIGNAL(projectModified()), doc, SLOT(setModified())); connect(trackView, SIGNAL(cursorMoved()), m_projectMonitor, SLOT(activateMonitor())); diff --git a/src/projectlistview.cpp b/src/projectlistview.cpp index 01ea4a34..ad60323b 100644 --- a/src/projectlistview.cpp +++ b/src/projectlistview.cpp @@ -215,16 +215,16 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) { const QList list = selectedItems(); QStringList ids; foreach(const QTreeWidgetItem *item, list) { - const ProjectItem *clip = static_cast (item); - if (!clip->isGroup()) ids.append(clip->clipId()); - else { - const int children = item->childCount(); - for (int i = 0; i < children; i++) { - ids.append(static_cast (item->child(i))->clipId()); - } - } + const ProjectItem *clip = static_cast (item); + if (!clip->isGroup()) ids.append(clip->clipId()); + else { + const int children = item->childCount(); + for (int i = 0; i < children; i++) { + ids.append(static_cast (item->child(i))->clipId()); + } + } } - if (ids.isEmpty()) return; + if (ids.isEmpty()) return; QByteArray data; data.append(ids.join(";").toUtf8()); //doc.toString().toUtf8()); mimeData->setData("kdenlive/producerslist", data); -- 2.39.2