]> git.sesse.net Git - kdenlive/commitdiff
up/down/del in effectstack
authorMarco Gittler <marco@gitma.de>
Tue, 19 Feb 2008 14:16:29 +0000 (14:16 +0000)
committerMarco Gittler <marco@gitma.de>
Tue, 19 Feb 2008 14:16:29 +0000 (14:16 +0000)
svn path=/branches/KDE4/; revision=1872

src/effectstackview.cpp
src/widgets/effectstack_ui.ui

index 600433d53f6ba08bbac3df0a234182e16c0e4154..ec3ff653c5c055bc32c90984f9476dd87629cf0d 100644 (file)
@@ -3,12 +3,19 @@
 
 #include "effectstackview.h"
 #include "clipitem.h"
-
+#include <QHeaderView>
 EffectStackView::EffectStackView( QWidget *parent)
 : QWidget(parent)
 {
        ui.setupUi(this);
+       //ui.effectlist->horizontalHeader()->setVisible(false);
+       //ui.effectlist->verticalHeader()->setVisible(false);
+       activeRow=-1;
        clipref=NULL;
+       connect (ui.effectlist, SIGNAL ( itemSelectionChanged()), this , SLOT( slotItemSelectionChanged() ));
+       connect (ui.buttonUp, SIGNAL (clicked()), this, SLOT (slotItemUp()) );
+       connect (ui.buttonDown, SIGNAL (clicked()), this, SLOT (slotItemDown()) );
+       connect (ui.buttonDel, SIGNAL (clicked()), this, SLOT (slotItemDel()) );
 }
 
 void EffectStackView::slotClipItemSelected(ClipItem* c)
@@ -16,12 +23,63 @@ void EffectStackView::slotClipItemSelected(ClipItem* c)
        clipref=c;
        if (clipref==NULL)
                return;
+       effects=clipref->effectNames();
+       setupListView(effects);
        
+}
+
+void EffectStackView::setupListView(const QStringList& effects_list){
+
        ui.effectlist->clear();
+       ui.effectlist->addItems(effects);
+       for (int i=0;i< ui.effectlist->count();i++){
+               QListWidgetItem* item=ui.effectlist->item(i);
+               item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsDragEnabled|Qt::ItemIsUserCheckable|Qt::ItemIsEnabled);
+               item->setCheckState(Qt::Checked);
+               if (activeRow==i)
+                       item->setSelected(true);
+       }
+
+}
+
+void EffectStackView::slotItemSelectionChanged(){
+       
+       if (ui.effectlist->currentItem() && ui.effectlist->currentItem()->isSelected() ){
+               activeRow=ui.effectlist->row( ui.effectlist->currentItem() );
+       }else{
+               activeRow=-1;
+       }
+       ui.buttonDel->setEnabled( activeRow!=-1);
+       ui.buttonUp->setEnabled( activeRow >0 );
+       ui.buttonDown->setEnabled( (activeRow<ui.effectlist->count()-1) && activeRow>=0 );
+}
 
-       ui.effectlist->addItems(clipref->effectNames());
+void EffectStackView::slotItemUp(){
+       if (activeRow>0 && activeRow <effects.size() ){
+               effects.swap(activeRow, activeRow-1);
+       }
+       activeRow--;
+       setupListView(effects);
        
+}
+
+void EffectStackView::slotItemDown(){
+       if (activeRow<effects.size()-1  ){
+               effects.swap(activeRow, activeRow+1);
+       }
+       activeRow++;
+       setupListView(effects);
+       
+}
+
+void EffectStackView::slotItemDel(){
+       if (activeRow<effects.size() && activeRow>=0  ){
+               effects.removeAt(activeRow);
+       }
+       if (effects.size()>0 && activeRow>0)
+       activeRow--;
+       setupListView(effects);
        
 }
 
-#include "effectstackview.moc"
\ No newline at end of file
+#include "effectstackview.moc"
index 9d93287daa3295a3b2a39f64160ece5d56160b1c..48c5be45c45c39c6f30337a8308964f0526f255f 100644 (file)
@@ -5,8 +5,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>716</width>
-    <height>430</height>
+    <width>886</width>
+    <height>622</height>
    </rect>
   </property>
   <property name="windowTitle" >
   </property>
   <layout class="QGridLayout" >
    <item row="0" column="0" >
-    <layout class="QHBoxLayout" >
-     <item>
-      <widget class="KListWidget" name="effectlist" />
-     </item>
-     <item>
+    <widget class="QSplitter" name="splitter_2" >
+     <property name="orientation" >
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <widget class="QWidget" name="layoutWidget" >
       <layout class="QVBoxLayout" >
        <item>
-        <widget class="QGraphicsView" name="graphicsView" >
-         <property name="autoFillBackground" >
-          <bool>true</bool>
-         </property>
-        </widget>
+        <widget class="KListWidget" name="effectlist" />
        </item>
        <item>
-        <widget class="QGroupBox" name="groupBox" >
-         <property name="minimumSize" >
-          <size>
-           <width>0</width>
-           <height>74</height>
-          </size>
-         </property>
-         <property name="title" >
-          <string>Parameter-Setup</string>
-         </property>
-        </widget>
+        <layout class="QHBoxLayout" >
+         <item>
+          <widget class="QToolButton" name="buttonNew" >
+           <property name="text" >
+            <string>N</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="buttonUp" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>Up</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="buttonDown" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>Dw</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer>
+           <property name="orientation" >
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" >
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QToolButton" name="buttonDel" >
+           <property name="enabled" >
+            <bool>false</bool>
+           </property>
+           <property name="text" >
+            <string>D</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
        </item>
       </layout>
-     </item>
-    </layout>
+     </widget>
+     <widget class="QSplitter" name="splitter" >
+      <property name="orientation" >
+       <enum>Qt::Vertical</enum>
+      </property>
+      <widget class="KPlotWidget" name="kplotwidget" >
+       <property name="grid" stdset="0" >
+        <bool>true</bool>
+       </property>
+      </widget>
+      <widget class="QGroupBox" name="groupBox" >
+       <property name="minimumSize" >
+        <size>
+         <width>0</width>
+         <height>74</height>
+        </size>
+       </property>
+       <property name="title" >
+        <string>Parameter-Setup</string>
+       </property>
+      </widget>
+     </widget>
+    </widget>
+   </item>
+   <item row="1" column="1" >
+    <widget class="KSeparator" name="kseparator" />
    </item>
   </layout>
  </widget>
    <extends>QListWidget</extends>
    <header>klistwidget.h</header>
   </customwidget>
+  <customwidget>
+   <class>KPlotWidget</class>
+   <extends>QFrame</extends>
+   <header>kplotwidget.h</header>
+  </customwidget>
+  <customwidget>
+   <class>KSeparator</class>
+   <extends>QFrame</extends>
+   <header>kseparator.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>