]> git.sesse.net Git - kdenlive/commitdiff
Add Opacity controls to new geometry widget
authorTill Theato <root@ttill.de>
Thu, 12 Aug 2010 22:56:01 +0000 (22:56 +0000)
committerTill Theato <root@ttill.de>
Thu, 12 Aug 2010 22:56:01 +0000 (22:56 +0000)
svn path=/trunk/kdenlive/; revision=4710

src/effectstackedit.h
src/effectstackview.h
src/geometrywidget.cpp
src/geometrywidget.h
src/transitionsettings.h
src/widgets/geometrywidget_ui.ui

index ce9eaa1bb97d3fa540a9bd4646f9058a6d3ba891..fa1f1f4459a528c3abcc46bb797c659cb298ff90 100644 (file)
@@ -79,6 +79,7 @@ public slots:
      *
      * Transfers all Dynamic gui parameter settings into m_params(??) */
     void collectAllParameters();
+    /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
     void slotSyncEffectsPos(int pos);
 
 signals:
index d012701412dfcd650f5270a6da0f63b3e9f25918..11b0c58cc236fe45b4407d7bce27e70d71c91897 100644 (file)
@@ -119,7 +119,7 @@ private slots:
     /** @brief Checks whether the monitor scene has to be displayed. */
     void slotCheckMonitorPosition(int renderPos);
 
-    /** @brief Pass position changes in project monitor/timline to the effects to keep their local timelines in sync. */
+    /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
     void slotRenderPos(int pos);
 
 signals:
index ad20fefc16ed71e8770f0c4375b3df1e8b3f772c..6adf1539088085fcf3b8e5e60ca878c20c345668 100644 (file)
@@ -98,6 +98,9 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos,
 
     connect(m_ui.spinSize,         SIGNAL(valueChanged(int)), this, SLOT(slotResize(int)));
 
+    connect(m_ui.spinOpacity,      SIGNAL(valueChanged(int)), this, SLOT(slotSetOpacity(int)));
+    connect(m_ui.sliderOpacity,    SIGNAL(valueChanged(int)), m_ui.spinOpacity, SLOT(setValue(int)));
+
     connect(m_ui.buttonMoveLeft,   SIGNAL(clicked()), this, SLOT(slotMoveLeft()));
     connect(m_ui.buttonCenterH,    SIGNAL(clicked()), this, SLOT(slotCenterH()));
     connect(m_ui.buttonMoveRight,  SIGNAL(clicked()), this, SLOT(slotMoveRight()));
@@ -153,6 +156,10 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra
         m_timePos->setRange(0, m_outPoint - m_inPoint - 1);
     }
 
+    // no opacity
+    if (elem.attribute("opacity") == "false")
+        m_ui.widgetOpacity->setHidden(true);
+
     Mlt::GeometryItem item;
 
     m_geometry->fetch(&item, 0);
@@ -211,6 +218,14 @@ void GeometryWidget::slotPositionChanged(int pos, bool seek)
 
     m_rect->setPos(item.x(), item.y());
     m_rect->setRect(0, 0, item.w(), item.h());
+
+    m_ui.spinOpacity->blockSignals(true);
+    m_ui.sliderOpacity->blockSignals(true);
+    m_ui.spinOpacity->setValue(item.mix());
+    m_ui.sliderOpacity->setValue(item.mix());
+    m_ui.spinOpacity->blockSignals(false);
+    m_ui.sliderOpacity->blockSignals(false);
+
     slotUpdateProperties();
 
     if (seek && KdenliveSettings::transitionfollowcursor())
@@ -235,6 +250,7 @@ void GeometryWidget::slotAddKeyframe(int pos)
     item.y(rectpos.y());
     item.w(r.width());
     item.h(r.height());
+    item.mix(m_ui.spinOpacity->value());
     m_geometry->insert(item);
 
     m_timeline->update();
@@ -390,6 +406,23 @@ void GeometryWidget::slotResize(int value)
 }
 
 
+void GeometryWidget::slotSetOpacity(int value)
+{
+    m_ui.sliderOpacity->blockSignals(true);
+    m_ui.sliderOpacity->setValue(value);
+    m_ui.sliderOpacity->blockSignals(false);
+
+    int pos = m_timePos->getValue();
+    Mlt::GeometryItem item;
+    if (m_geometry->fetch(&item, pos) || item.key() == false)
+        return;
+    item.mix(value);
+    m_geometry->insert(item);
+
+    emit parameterChanged();
+}
+
+
 void GeometryWidget::slotMoveLeft()
 {
     m_rect->setPos(0, m_rect->pos().y());
index 18ff8622d2049766f5b39fe904be494952322a4f..b0470a8fc96c2d1cb591a4acb9be3dd254e9cec3 100644 (file)
@@ -119,6 +119,9 @@ private slots:
     /** @brief Resizes the rect by @param value (in perecent) compared to the frame size. */
     void slotResize(int value);
 
+    /** @brief Sets the opacity to @param value. */
+    void slotSetOpacity(int value);
+
     /** @brief Moves the rect to the left frame border (x position = 0). */
     void slotMoveLeft();
     /** @brief Centers the rect horizontally. */
index 81d652c110ce228dd401898f7bb275160f5f52e8..356a74deb42dc8057470f517627081c1487091c2 100644 (file)
@@ -55,7 +55,7 @@ public slots:
 private slots:
     /** @brief Sets the new B track for the transition (automatic or forced). */
     void slotTransitionTrackChanged();
-    /** @brief Pass position changes in project monitor/timline to the effects to keep their local timelines in sync. */
+    /** @brief Pass position changes of the timeline cursor to the effects to keep their local timelines in sync. */
     void slotRenderPos(int pos);
 
 signals:
index fac79bf979e861e932d1dac5051d5a1870853c76..f12af19201e243b51ba5f3e202ad30001840268d 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>285</width>
-    <height>187</height>
+    <width>373</width>
+    <height>191</height>
    </rect>
   </property>
   <property name="windowTitle">
    <item row="1" column="1">
     <widget class="QWidget" name="widgetGeometry" native="true">
      <layout class="QGridLayout" name="gridLayout_3">
+      <property name="leftMargin">
+       <number>0</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
       <item row="0" column="0">
        <widget class="QLabel" name="label">
         <property name="text">
@@ -24,8 +33,8 @@
         </property>
        </widget>
       </item>
-      <item row="2" column="1">
-       <widget class="QSpinBox" name="spinY">
+      <item row="0" column="1">
+       <widget class="QSpinBox" name="spinX">
         <property name="minimum">
          <number>-10000</number>
         </property>
         </property>
        </widget>
       </item>
-      <item row="0" column="1">
-       <widget class="QSpinBox" name="spinX">
+      <item row="0" column="3">
+       <widget class="QWidget" name="widget" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <item>
+          <widget class="QLabel" name="label_5">
+           <property name="text">
+            <string>Resize:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QSpinBox" name="spinSize">
+           <property name="suffix">
+            <string>%</string>
+           </property>
+           <property name="minimum">
+            <number>1</number>
+           </property>
+           <property name="maximum">
+            <number>500</number>
+           </property>
+           <property name="value">
+            <number>100</number>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item row="0" column="2" rowspan="5">
+       <widget class="Line" name="line">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="4" rowspan="5">
+       <widget class="QWidget" name="widgetOpacity" native="true">
+        <layout class="QGridLayout" name="gridLayout_5">
+         <property name="margin">
+          <number>0</number>
+         </property>
+         <item row="0" column="1">
+          <widget class="QLabel" name="label_6">
+           <property name="text">
+            <string>Opacity</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item row="2" column="1">
+          <widget class="QSpinBox" name="spinOpacity">
+           <property name="maximum">
+            <number>100</number>
+           </property>
+           <property name="value">
+            <number>100</number>
+           </property>
+          </widget>
+         </item>
+         <item row="0" column="0" rowspan="3">
+          <widget class="Line" name="line_2">
+           <property name="orientation">
+            <enum>Qt::Vertical</enum>
+           </property>
+          </widget>
+         </item>
+         <item row="1" column="1">
+          <widget class="QWidget" name="widget_2" native="true">
+           <property name="sizePolicy">
+            <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+             <horstretch>0</horstretch>
+             <verstretch>0</verstretch>
+            </sizepolicy>
+           </property>
+           <layout class="QHBoxLayout" name="horizontalLayout_2">
+            <property name="spacing">
+             <number>0</number>
+            </property>
+            <property name="margin">
+             <number>0</number>
+            </property>
+            <item>
+             <spacer name="horizontalSpacer_4">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+            <item>
+             <widget class="QSlider" name="sliderOpacity">
+              <property name="maximum">
+               <number>100</number>
+              </property>
+              <property name="value">
+               <number>100</number>
+              </property>
+              <property name="orientation">
+               <enum>Qt::Vertical</enum>
+              </property>
+             </widget>
+            </item>
+            <item>
+             <spacer name="horizontalSpacer_5">
+              <property name="orientation">
+               <enum>Qt::Horizontal</enum>
+              </property>
+              <property name="sizeHint" stdset="0">
+               <size>
+                <width>40</width>
+                <height>20</height>
+               </size>
+              </property>
+             </spacer>
+            </item>
+           </layout>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item row="1" column="1">
+       <widget class="QSpinBox" name="spinY">
         <property name="minimum">
          <number>-10000</number>
         </property>
         </property>
        </widget>
       </item>
-      <item row="2" column="0">
+      <item row="1" column="0">
        <widget class="QLabel" name="label_2">
         <property name="text">
          <string>Y</string>
         </property>
        </widget>
       </item>
-      <item row="3" column="0">
+      <item row="2" column="0">
        <widget class="QLabel" name="label_3">
         <property name="text">
          <string>Width</string>
         </property>
        </widget>
       </item>
-      <item row="3" column="1">
+      <item row="2" column="1">
        <widget class="QSpinBox" name="spinWidth">
         <property name="minimum">
          <number>1</number>
         </property>
        </widget>
       </item>
-      <item row="4" column="0">
+      <item row="3" column="0">
        <widget class="QLabel" name="label_4">
         <property name="text">
          <string>Height</string>
         </property>
        </widget>
       </item>
-      <item row="4" column="1">
+      <item row="3" column="1">
        <widget class="QSpinBox" name="spinHeight">
         <property name="minimum">
          <number>1</number>
         </property>
        </widget>
       </item>
-      <item row="0" column="3">
-       <widget class="QWidget" name="widget" native="true">
-        <layout class="QHBoxLayout" name="horizontalLayout">
-         <item>
-          <widget class="QLabel" name="label_5">
-           <property name="text">
-            <string>Resize:</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QSpinBox" name="spinSize">
-           <property name="suffix">
-            <string>%</string>
-           </property>
-           <property name="minimum">
-            <number>1</number>
-           </property>
-           <property name="maximum">
-            <number>500</number>
-           </property>
-           <property name="value">
-            <number>100</number>
-           </property>
-          </widget>
-         </item>
-        </layout>
-       </widget>
-      </item>
-      <item row="2" column="3" rowspan="3">
+      <item row="1" column="3" rowspan="3">
        <widget class="QFrame" name="frame">
         <property name="frameShape">
          <enum>QFrame::StyledPanel</enum>
          <enum>QFrame::Raised</enum>
         </property>
         <layout class="QGridLayout" name="gridLayout_2">
+         <property name="margin">
+          <number>0</number>
+         </property>
          <item row="0" column="0">
           <widget class="QToolButton" name="buttonMoveLeft">
            <property name="text">
         </layout>
        </widget>
       </item>
-      <item row="0" column="2" rowspan="5">
-       <widget class="Line" name="line">
-        <property name="orientation">
-         <enum>Qt::Vertical</enum>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>