]> git.sesse.net Git - kdenlive/commitdiff
Do not show the keyframe table if only one keyframe exists. Instead show a button...
authorTill Theato <root@ttill.de>
Sat, 23 Oct 2010 20:04:44 +0000 (20:04 +0000)
committerTill Theato <root@ttill.de>
Sat, 23 Oct 2010 20:04:44 +0000 (20:04 +0000)
svn path=/trunk/kdenlive/; revision=5038

src/keyframeedit.cpp
src/keyframeedit.h
src/widgets/keyframeeditor_ui.ui

index 69d93776c5b8cfa785fd7a9c844f9954dc6385cf..19dbcdd154fbd63cb460a30bee31a66d7db416bc 100644 (file)
@@ -41,14 +41,14 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, int minVal
         button_add->setEnabled(false);
         button_delete->setEnabled(false);
         keyframe_seek->setEnabled(false);
-        label->setHidden(true);
-        keyframe_pos->setHidden(true);
+        widgetTable->setHidden(true);
     }
     m_params.append(e.cloneNode().toElement());
     keyframe_list->setFont(KGlobalSettings::generalFont());
     keyframe_seek->setChecked(KdenliveSettings::keyframeseek());
     connect(keyframe_seek, SIGNAL(stateChanged(int)), this, SLOT(slotSetSeeking(int)));
 
+    buttonKeyframes->setIcon(KIcon("list-add"));
     button_add->setIcon(KIcon("list-add"));
     button_add->setToolTip(i18n("Add keyframe"));
     button_delete->setIcon(KIcon("list-remove"));
@@ -62,6 +62,7 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, int minVal
     //keyframe_list->horizontalHeader()->resizeSections(QHeaderView::ResizeToContents);
     connect(button_delete, SIGNAL(clicked()), this, SLOT(slotDeleteKeyframe()));
     connect(button_add, SIGNAL(clicked()), this, SLOT(slotAddKeyframe()));
+    connect(buttonKeyframes, SIGNAL(clicked()), this, SLOT(slotKeyframeMode()));
     //connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int)));
     connect(keyframe_pos, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframePos(int)));
     //connect(keyframe_val, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
@@ -74,6 +75,12 @@ KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, int minVal
     keyframe_list->setMinimumHeight(QFontInfo(keyframe_list->font()).pixelSize() * 9);
     /*m_delegate = new KeyItemDelegate(minVal, maxVal);
     keyframe_list->setItemDelegate(m_delegate);*/
+
+    // Do not show keyframe table if only one keyframe exists at the beginning
+    if (keyframe_list->rowCount() < 2 && getPos(0) == m_min && m_max != -1)
+        widgetTable->setHidden(true);
+    else
+        buttonKeyframes->setHidden(true);
 }
 
 KeyframeEdit::~KeyframeEdit()
@@ -418,6 +425,13 @@ void KeyframeEdit::updateTimecodeFormat()
     }
 }
 
+void KeyframeEdit::slotKeyframeMode()
+{
+    widgetTable->setHidden(false);
+    buttonKeyframes->setHidden(true);
+    slotAddKeyframe();
+}
+
 /*void KeyframeEdit::slotSaveCurrentParam(QTreeWidgetItem *item, int column)
 {
     if (item && column == 0) m_previousPos = m_timecode.getFrameCount(item->text(0));
index b79498daa4695d213d0a11a7eea2af3171cd9e0e..4d3e5747da17af75d83d0ee109a4783e2c0563f2 100644 (file)
@@ -117,6 +117,9 @@ private slots:
     /** @brief Turns the seek to keyframe position setting on/off.
     * @param state State of the associated checkbox */
     void slotSetSeeking(int state);
+
+    /** @brief Shows the keyframe table and adds a second keyframe. */
+    void slotKeyframeMode();
     //void slotSaveCurrentParam(QTreeWidgetItem *item, int column);
 
 signals:
index 7e09e749554149e1f486ede8667e4d01489ac75d..eeb4f323095dfef4118fc61edae02f147f5809a7 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>277</width>
-    <height>269</height>
+    <width>336</width>
+    <height>190</height>
    </rect>
   </property>
   <layout class="QGridLayout" name="gridLayout">
    <property name="rightMargin">
     <number>0</number>
    </property>
-   <item row="0" column="0" colspan="3">
-    <widget class="QTableWidget" name="keyframe_list">
-     <property name="alternatingRowColors">
-      <bool>true</bool>
-     </property>
-     <property name="cornerButtonEnabled">
-      <bool>false</bool>
-     </property>
-     <attribute name="horizontalHeaderHighlightSections">
-      <bool>false</bool>
-     </attribute>
-     <attribute name="horizontalHeaderStretchLastSection">
-      <bool>true</bool>
-     </attribute>
-     <attribute name="verticalHeaderVisible">
-      <bool>true</bool>
-     </attribute>
-     <attribute name="verticalHeaderHighlightSections">
-      <bool>false</bool>
-     </attribute>
-     <attribute name="verticalHeaderVisible">
-      <bool>true</bool>
-     </attribute>
-     <attribute name="horizontalHeaderStretchLastSection">
-      <bool>true</bool>
-     </attribute>
-     <attribute name="horizontalHeaderHighlightSections">
-      <bool>false</bool>
-     </attribute>
-     <attribute name="verticalHeaderHighlightSections">
-      <bool>false</bool>
-     </attribute>
-    </widget>
-   </item>
-   <item row="1" column="0">
-    <widget class="QToolButton" name="button_add">
-     <property name="text">
-      <string>A</string>
-     </property>
-     <property name="arrowType">
-      <enum>Qt::NoArrow</enum>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="1">
-    <widget class="QToolButton" name="button_delete">
-     <property name="text">
-      <string>D</string>
-     </property>
-     <property name="arrowType">
-      <enum>Qt::NoArrow</enum>
-     </property>
-    </widget>
-   </item>
-   <item row="1" column="2">
-    <widget class="QCheckBox" name="keyframe_seek">
-     <property name="text">
-      <string>Seek to active keyframe</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0" colspan="2">
-    <widget class="QLabel" name="label">
-     <property name="text">
-      <string>Position</string>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="2">
-    <widget class="QSlider" name="keyframe_pos">
-     <property name="orientation">
-      <enum>Qt::Horizontal</enum>
-     </property>
-    </widget>
-   </item>
    <item row="4" column="0" colspan="3">
     <widget class="Line" name="line">
      <property name="orientation">
      </property>
     </widget>
    </item>
+   <item row="2" column="0" colspan="3">
+    <widget class="QWidget" name="widgetTable" native="true">
+     <layout class="QGridLayout" name="gridLayout_2">
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <item row="3" column="0" colspan="3">
+       <widget class="QTableWidget" name="keyframe_list">
+        <property name="alternatingRowColors">
+         <bool>true</bool>
+        </property>
+        <property name="cornerButtonEnabled">
+         <bool>false</bool>
+        </property>
+        <attribute name="horizontalHeaderHighlightSections">
+         <bool>false</bool>
+        </attribute>
+        <attribute name="horizontalHeaderStretchLastSection">
+         <bool>true</bool>
+        </attribute>
+        <attribute name="verticalHeaderVisible">
+         <bool>true</bool>
+        </attribute>
+        <attribute name="verticalHeaderHighlightSections">
+         <bool>false</bool>
+        </attribute>
+       </widget>
+      </item>
+      <item row="4" column="0">
+       <widget class="QToolButton" name="button_add">
+        <property name="text">
+         <string>A</string>
+        </property>
+        <property name="arrowType">
+         <enum>Qt::NoArrow</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="2">
+       <widget class="QCheckBox" name="keyframe_seek">
+        <property name="text">
+         <string>Seek to active keyframe</string>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="0" colspan="2">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>Position</string>
+        </property>
+       </widget>
+      </item>
+      <item row="5" column="2">
+       <widget class="QSlider" name="keyframe_pos">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+       </widget>
+      </item>
+      <item row="4" column="1">
+       <widget class="QToolButton" name="button_delete">
+        <property name="text">
+         <string>D</string>
+        </property>
+        <property name="arrowType">
+         <enum>Qt::NoArrow</enum>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="1" column="0">
+    <widget class="QWidget" name="widget" native="true">
+     <layout class="QGridLayout" name="gridLayout_3">
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <item row="0" column="0">
+       <widget class="QToolButton" name="buttonKeyframes">
+        <property name="toolTip">
+         <string>Add keyframes</string>
+        </property>
+        <property name="text">
+         <string>Keyframes</string>
+        </property>
+        <property name="toolButtonStyle">
+         <enum>Qt::ToolButtonTextBesideIcon</enum>
+        </property>
+        <property name="autoRaise">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
   </layout>
  </widget>
  <resources/>