]> git.sesse.net Git - kdenlive/commitdiff
complexparameter can now read "complex"
authorMarco Gittler <marco@gitma.de>
Mon, 25 Feb 2008 12:46:23 +0000 (12:46 +0000)
committerMarco Gittler <marco@gitma.de>
Mon, 25 Feb 2008 12:46:23 +0000 (12:46 +0000)
svn path=/branches/KDE4/; revision=1932

src/complexparameter.cpp
src/complexparameter.h
src/effectstackedit.cpp
src/parameterplotter.cpp
src/parameterplotter.h

index e9742134f7c641d7a8dc24271a3ee29f7f3a0bd9..f9b39479d7a8d6fe31272f31eab3abca9c9bc05f 100644 (file)
@@ -54,6 +54,7 @@ ComplexParameter::ComplexParameter(QWidget *parent)
        //connect (ui.effectlist, SIGNAL (itemSelectionChanged() ) , this, SLOT ( itemSelectionChanged()));
        connect( this,SIGNAL (transferParamDesc(const QDomElement&,int ,int) ), ui.kplotwidget, SLOT(setPointLists(const QDomElement&,int ,int) ));
        connect(ui.kplotwidget, SIGNAL (parameterChanged(QDomElement ) ), this , SLOT (slotUpdateEffectParams(QDomElement)));
+       connect(ui.kplotwidget, SIGNAL (parameterList(QStringList)), this , SLOT (slotUpdateParameterList(QStringList)));
        /*ÜeffectLists["audio"]=audioEffectList;
        effectLists["video"]=videoEffectList;
        effectLists["custom"]=customEffectList;*/
@@ -111,10 +112,27 @@ void ComplexParameter::slotParameterChanged(const QString& text){
 }
 
 void ComplexParameter::setupParam(const QDomElement& d,int from,int to){
+       param=d;
        ui.kplotwidget->setPointLists(d,from,to);
 }
 
 void ComplexParameter::itemSelectionChanged (){
        //kDebug() << "drop";
 }
+
+void ComplexParameter::slotUpdateEffectParams(QDomElement e){
+       param=e;
+       emit parameterChanged();
+}
+
+QDomElement ComplexParameter::getParamDesc(){
+       return param;
+}
+
+void ComplexParameter::slotUpdateParameterList(QStringList l){
+       kDebug() << l ;
+       ui.parameterList->clear();
+       ui.parameterList->addItems(l);
+}
+
 #include "complexparameter.moc"
index c79d045cddeed28ed202168cc91f3642c34fac28..b0b24087e80bc6e02337377f3daa5d1edf5ce004 100644 (file)
@@ -31,7 +31,7 @@ class ComplexParameter : public QWidget
                
        public:
                ComplexParameter(QWidget *parent=0);
-       
+               QDomElement getParamDesc();
 private:
        int activeRow;
        QList<QDomElement> effects;
@@ -40,7 +40,8 @@ private:
        void setupListView();
        void updateButtonStatus();
        QMap<QString,EffectsList*> effectLists;
-
+       
+       QDomElement param;
 public slots:
        void slotSetMoveX();
        void slotSetMoveY();
@@ -50,10 +51,13 @@ public slots:
        void slotParameterChanged(const QString&);
        void itemSelectionChanged();
        void setupParam(const QDomElement&,int,int);
+       void slotUpdateEffectParams(QDomElement e);
+       void slotUpdateParameterList(QStringList);
 signals:
        void transferParamDesc(const QDomElement&,int ,int);
        void removeEffect(ClipItem*, QDomElement);
        void updateClipEffect(ClipItem*, QDomElement);
+       void parameterChanged();
 
 };
 
index 1d36e385e6874b4ee60cea9f3493afb0547d2c41..9c782a0c5c7c55f76b0713333d34c5d1dcec5bad 100644 (file)
@@ -126,8 +126,10 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d,int ,int){
                                };
                        }
                        ComplexParameter *pl=new ComplexParameter;
+                       connect (pl, SIGNAL ( parameterChanged()),this, SLOT( collectAllParameters ()) );
                        pl->setupParam(d,0,100);
                        vbox->addWidget(pl);
+                       valueItems[paramName+"complex"]=pl;
                        items.append(pl);
                }else if (type=="color"){
                        Ui::Colorval_UI *cval=new Ui::Colorval_UI;
@@ -152,7 +154,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d,int ,int){
        }
 }
 void EffectStackEdit::collectAllParameters(){
-       kDebug() << "cklicked";
+       
        QDomNodeList namenode = params.elementsByTagName("parameter");
 
        for (int i=0;i< namenode.count() ;i++){
@@ -175,7 +177,11 @@ void EffectStackEdit::collectAllParameters(){
                if (type=="color"){
                        KColorButton *color=((Ui::Colorval_UI*)valueItems[na.toElement().text()])->kcolorbutton;
                        setValue.sprintf("0x%08x",color->color().rgba());
-               }
+               }else
+                       if (type=="complex"){
+                               ComplexParameter *complex=((ComplexParameter*)valueItems[na.toElement().text()+"complex"]);
+                               namenode.item(i)=complex->getParamDesc();
+                       }
                if (!setValue.isEmpty()){
                        pa.attributes().namedItem("value").setNodeValue(setValue);
                }
index 4208e1407411642d8a0cf5ef6ec75206559c55ec..c984c9492d57535b055cd8c1942860dc761e4dcd 100644 (file)
@@ -57,25 +57,46 @@ void ParameterPlotter::setPointLists(const QDomElement& d,int startframe,int end
        itemParameter=d;
        QDomNodeList namenode = d.elementsByTagName("parameter");
        
-       int max_y=0;
+       int max_y=0,min_y=0;
        removeAllPlotObjects ();
        parameterNameList.clear();
        plotobjects.clear();
        
+       QString dat;
+       QTextStream stre(&dat);
+       d.save(stre,2);
+       kDebug() << dat;
 
-       for (int i=0;i< namenode.count() ;i++){
-               KPlotObject *plot=new KPlotObject(colors[plotobjects.size()%colors.size()]);
-               plot->setShowLines(true);
-               //QPair<QString, QMap< int , QVariant > > item=nameit.next();
-               QDomNode pa=namenode.item(i);
+       if ( namenode.count() ){
+               
+               
+               QDomNode pa=namenode.item(0);
                QDomNode na=pa.firstChildElement("name");
                
-               parameterNameList << na.toElement().text();
+               parameterNameList << pa.attributes().namedItem("name").nodeValue().split(";");
+               emit parameterList(parameterNameList);
+               
+               //max_y=pa.attributes().namedItem("max").nodeValue().toInt();
+               //int val=pa.attributes().namedItem("value").nodeValue().toInt();
+               QStringList defauls=pa.attributes().namedItem("default").nodeValue().split(";");
+               QStringList maxv=pa.attributes().namedItem("max").nodeValue().split(";");
+               QStringList minv=pa.attributes().namedItem("max").nodeValue().split(";");
+               for (int i=0;i<maxv.size();i++){
+                       if (max_y< maxv[i].toInt()) max_y=maxv[i].toInt();
+                       if (min_y< minv[i].toInt()) min_y=minv[i].toInt();
+               }
+               
+               for (int i=0;i<parameterNameList.count();i++){
+                       KPlotObject *plot=new KPlotObject(colors[plotobjects.size()%colors.size()]);
+                       plot->setShowLines(true);
+                       
+                       plot->addPoint(startframe,defauls[i].toInt());
+                       //add keyframes here
+                       plot->addPoint(endframe,defauls[i].toInt());
                
+                       plotobjects.append(plot);
+               }
                
-               max_y=pa.attributes().namedItem("max").nodeValue().toInt();
-               int val=pa.attributes().namedItem("value").nodeValue().toInt();
-               plot->addPoint((i+1)*20,val);
                /*TODO keyframes
                while (pointit.hasNext()){
                        pointit.next();
@@ -83,11 +104,11 @@ void ParameterPlotter::setPointLists(const QDomElement& d,int startframe,int end
                        if (pointit.value().toInt() >maxy)
                                max_y=pointit.value().toInt();
                }*/
-               plotobjects.append(plot);
+               
        }
        maxx=endframe;
        maxy=max_y;
-       setLimits(0,endframe,0,maxy+10);
+       setLimits(-1,endframe+1,-1,maxy+10);
        addPlotObjects(plotobjects);
 
 }
index 058286f0fa076cfad4434d6f2a6697b0490d8768..3f8052467e9eb1e57e1213c8cf9cea8ce9ce9e99 100644 (file)
@@ -51,5 +51,6 @@ class ParameterPlotter : public KPlotWidget {
        signals:
                void parameterChanged(QDomElement );
                void updateFrame(int);
+               void parameterList(QStringList);
        
 };