]> git.sesse.net Git - kdenlive/commitdiff
Fix automask effect crash
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 14 Oct 2008 08:48:40 +0000 (08:48 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 14 Oct 2008 08:48:40 +0000 (08:48 +0000)
svn path=/branches/KDE4/; revision=2468

effects/automask.xml
src/effectstackview.cpp
src/effectstackview.h
src/geometryval.cpp
src/geometryval.h
src/mainwindow.cpp
src/projectlistview.cpp

index b5bbf7066a7995871758a616d65dd436c488bf49..e963b41ca340c78512e418dc773240cbac2192b8 100644 (file)
@@ -1,9 +1,9 @@
 <!DOCTYPE kpartgui>
-<effect tag="motion_est" id="autotrack_rectangle">
+<effect tag="autotrack_rectangle" id="autotrack_rectangle">
        <name>Auto Mask</name>
        <description>Hide a selected zone and follow its movements</description>
        <author>Zachary Drew</author>
-       <parameter type="geometry" name="geometry" default="100,100:100x100">
+       <parameter type="geometry" name="geometry" default="50%,50%:50%x50%" fixed="1">
                <name>Geometry</name>
        </parameter>
        <parameter type="bool" name="debug" default="1">
index de232bd88463fb503126650d4cc19ef48040f6b7..b643085b87e4e87d97e37c3c528fb22087649b29 100644 (file)
@@ -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;
index 90e43a4607b6df4c3d9abf732390fc019e4c1eb3..477e66756daaa00f006414e91accc2ef49f76dc0 100644 (file)
 
 #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;
index 65ddfe564a51179d5fdf607c21f1671821dc125e..050d5cc119458f5a3742b9336a71522f7d855940 100644 (file)
@@ -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;
index 27b8c46dac6a9b674a032afc226acb756bcce307..4d8aae783fd9a8defaf52395a6484a0d398f4d2c 100644 (file)
@@ -54,7 +54,7 @@ private:
     QMenu *m_scaleMenu;
     QMenu *m_alignMenu;
     QAction *m_syncAction;
-
+    bool m_fixedMode;
     void updateTransitionPath();
 
 public slots:
index ebe907479bfd7c4ef43c837627d66998866c3d71..82bc42ef83cfb56390030abb7a4e72a51377e037 100644 (file)
@@ -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()));
index 01ea4a34b9aed8da3e1df700c9d0747636b71ba1..ad60323bf1a9b33befc48a3ef6904ec7bd016018 100644 (file)
@@ -215,16 +215,16 @@ void ProjectListView::mouseMoveEvent(QMouseEvent *event) {
             const QList <QTreeWidgetItem *> list = selectedItems();
             QStringList ids;
             foreach(const QTreeWidgetItem *item, list) {
-               const ProjectItem *clip = static_cast <const ProjectItem *> (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 <ProjectItem *>(item->child(i))->clipId());
-                   }
-               }
+                const ProjectItem *clip = static_cast <const ProjectItem *>(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 <ProjectItem *>(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);