]> git.sesse.net Git - kdenlive/commitdiff
parameter adjustable
authorMarco Gittler <marco@gitma.de>
Tue, 19 Feb 2008 18:28:01 +0000 (18:28 +0000)
committerMarco Gittler <marco@gitma.de>
Tue, 19 Feb 2008 18:28:01 +0000 (18:28 +0000)
svn path=/branches/KDE4/; revision=1874

src/CMakeLists.txt
src/effectstackview.cpp
src/effectstackview.h
src/parameterplotter.cpp [new file with mode: 0644]
src/parameterplotter.h [new file with mode: 0644]
src/widgets/effectstack_ui.ui

index 65316ae74a3511970335ecb1494c599b6b9f0949..aca7020b97eaa24ebf965544d6792e545d25df08 100644 (file)
@@ -65,6 +65,8 @@ set(kdenlive_SRCS
   effectslistview.cpp
   addeffectcommand.cpp
   effectstackview.cpp
+  parameterplotter.cpp
+
 )
 
 kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
index ec3ff653c5c055bc32c90984f9476dd87629cf0d..1f9c0f293da32faceb2223bf38aa9ab672cd6f1d 100644 (file)
@@ -1,9 +1,27 @@
+/***************************************************************************
+                          effecstackview.cpp  -  description
+                             -------------------
+    begin                : Feb 15 2008
+    copyright            : (C) 2008 by Marco Gittler
+    email                : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
 #include <KDebug>
 #include <KLocale>
 
 #include "effectstackview.h"
 #include "clipitem.h"
 #include <QHeaderView>
+
 EffectStackView::EffectStackView( QWidget *parent)
 : QWidget(parent)
 {
@@ -16,6 +34,18 @@ EffectStackView::EffectStackView( QWidget *parent)
        connect (ui.buttonUp, SIGNAL (clicked()), this, SLOT (slotItemUp()) );
        connect (ui.buttonDown, SIGNAL (clicked()), this, SLOT (slotItemDown()) );
        connect (ui.buttonDel, SIGNAL (clicked()), this, SLOT (slotItemDel()) );
+       
+
+       
+       QList< QPair<QString, QMap<int,QVariant> > > points;
+       QMap<int,QVariant> data;
+       data[0]=0.1;
+       data[100]=50;
+       data[255]=100;
+       QPair<QString,QMap<int,QVariant> > testpair("contrast",data);
+       points.append(testpair);
+       ui.kplotwidget->setPointLists(points,0,300);
+       
 }
 
 void EffectStackView::slotClipItemSelected(ClipItem* c)
index d72403d3acbb741aa97ec597f4b1c0d9d60e624c..06a9c8d4b3cdfa531338c4ea3df3aaf4d7146b8e 100644 (file)
@@ -1,3 +1,20 @@
+/***************************************************************************
+                          effecstackview.h  -  description
+                             -------------------
+    begin                : Feb 15 2008
+    copyright            : (C) 2008 by Marco Gittler
+    email                : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
 #ifndef EFFECTSTACKVIEW_H
 #define EFFECTSTACKVIEW_H
 
diff --git a/src/parameterplotter.cpp b/src/parameterplotter.cpp
new file mode 100644 (file)
index 0000000..ef2d6da
--- /dev/null
@@ -0,0 +1,90 @@
+/***************************************************************************
+                          parameterplotter.cpp  -  description
+                             -------------------
+    begin                : Feb 15 2008
+    copyright            : (C) 2008 by Marco Gittler
+    email                : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "parameterplotter.h"
+#include <QVariant>
+#include <KPlotObject>
+#include <QMouseEvent>
+#include <KDebug>
+#include <KPlotPoint>
+
+ParameterPlotter::ParameterPlotter (QWidget *parent):KPlotWidget (parent){
+       setAntialiasing(true);
+       setLeftPadding(20);
+       setRightPadding(10);
+       setTopPadding(10);
+       setBottomPadding(20);
+       movepoint=NULL;
+       plot=new KPlotObject();
+       plot->setShowLines(true);
+}
+
+void ParameterPlotter::setPointLists(const QList< QPair<QString, QMap< int , QVariant > > >& params,int startframe, int endframe){
+       
+       QListIterator <QPair <QString, QMap< int , QVariant > > > nameit(params);
+       int maxy=0;
+       while (nameit.hasNext() ){
+       
+               QPair<QString, QMap< int , QVariant > > item=nameit.next();
+               QString name(item.first);
+               QMapIterator <int,QVariant> pointit=item.second;
+               while (pointit.hasNext()){
+                       pointit.next();
+                       plot->addPoint(QPointF(pointit.key(),pointit.value().toDouble()),"",1);
+                       if (pointit.value().toInt() >maxy)
+                               maxy=pointit.value().toInt();
+               }
+               addPlotObject(plot);
+       }
+       
+       setLimits(0,endframe,0,maxy);
+       
+}
+
+QList< QPair<QString, QMap<int,QVariant> > > ParameterPlotter::getPointLists(){
+       return pointlists;
+}
+
+void ParameterPlotter::mouseMoveEvent ( QMouseEvent * event ) {
+       
+       if (movepoint!=NULL){
+               QList<KPlotPoint*> list=   pointsUnderPoint (event->pos()-QPoint(leftPadding(), topPadding() )  ) ;
+               int i=0,j=-1;
+               foreach (KPlotObject *o, plotObjects() ){
+                       foreach (KPlotPoint* p, o->points()){
+                               if (p==movepoint){
+                                       QPoint delta=event->pos()-oldmousepoint;
+                                       movepoint->setY(movepoint->y()-delta.y()*dataRect().height()/pixRect().height() );
+                                       
+                                       movepoint->setX(movepoint->x()+delta.x()*dataRect().width()/pixRect().width() );
+                                       replacePlotObject(i,o);
+                                       oldmousepoint=event->pos();
+                               }
+                       }
+                       i++;
+               }
+       }
+}
+
+void ParameterPlotter::mousePressEvent ( QMouseEvent * event ) {
+       QList<KPlotPoint*> list=   pointsUnderPoint (event->pos()-QPoint(leftPadding(), topPadding() )  ) ;
+       if (list.size() > 0){
+               movepoint=list[0];
+               oldmousepoint=event->pos();
+       }else
+               movepoint=NULL;
+}
diff --git a/src/parameterplotter.h b/src/parameterplotter.h
new file mode 100644 (file)
index 0000000..b3a8b31
--- /dev/null
@@ -0,0 +1,35 @@
+/***************************************************************************
+                          parameterplotter.h  -  description
+                             -------------------
+    begin                : Feb 15 2008
+    copyright            : (C) 2008 by Marco Gittler
+    email                : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include <KPlotWidget>
+
+class ParameterPlotter : public KPlotWidget {
+       Q_OBJECT
+       public:
+               ParameterPlotter (QWidget *parent=0);
+       void setPointLists(const QList< QPair<QString, QMap<int,QVariant> > >&,int,int);
+               QList< QPair<QString, QMap<int,QVariant> > > getPointLists();
+       private:
+               QList< QPair<QString, QMap<int,QVariant> > > pointlists;
+               KPlotPoint* movepoint;
+               KPlotObject *plot;
+               QPoint oldmousepoint;
+       protected:
+               void mouseMoveEvent ( QMouseEvent * event );
+               void mousePressEvent ( QMouseEvent * event );   
+       
+};
index 48c5be45c45c39c6f30337a8308964f0526f255f..2247f37879542a8027ba9cc5b97198f835253185 100644 (file)
@@ -83,7 +83,7 @@
       <property name="orientation" >
        <enum>Qt::Vertical</enum>
       </property>
-      <widget class="KPlotWidget" name="kplotwidget" >
+      <widget class="ParameterPlotter" name="kplotwidget" >
        <property name="grid" stdset="0" >
         <bool>true</bool>
        </property>
    <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>
+  <customwidget>
+   <class>ParameterPlotter</class>
+   <extends>KPlotWidget</extends>
+   <header>parameterplotter.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>