connect (ui.buttonNewPoints, SIGNAL (clicked()), this , SLOT ( slotSetNew() ) );
connect (ui.buttonHelp, SIGNAL (clicked()), this , SLOT ( slotSetHelp() ) );
connect (ui.parameterList, SIGNAL (currentIndexChanged ( const QString & ) ), this, SLOT( slotParameterChanged(const QString&) ) );
- connect (ui.effectlist, SIGNAL (itemSelectionChanged() ) , this, SLOT ( itemSelectionChanged()));
-
+ //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)));
effectLists["audio"]=audioEffectList;
effectLists["video"]=videoEffectList;
effectLists["custom"]=customEffectList;
ui.infoBox->hide();
updateButtonStatus();
-
- QList< QPair<QString, QMap<int,QVariant> > > points;
- QMap<int,QVariant> data;
- data[0]=0.1;
- data[100]=30;
- data[255]=50;
- data[300]=100;
- QPair<QString,QMap<int,QVariant> > testpair("gray",data);
- points.append(testpair);
-
- QMap<int,QVariant> data1;
- data1[0]=20;
- data1[10]=70;
- data1[155]=110;
- data1[300]=133;
- QPair<QString,QMap<int,QVariant> > testpair1("dx",data1);
- points.append(testpair1);
- ui.parameterList->addItem("all");
- ui.parameterList->addItem("gray");
- ui.parameterList->addItem("dx");
-
- ui.kplotwidget->setPointLists(points,0,305);
-
+}
+
+void EffectStackView::slotUpdateEffectParams(QDomElement e){
+ if (clipref)
+ emit updateClipEffect(clipref, e);
}
void EffectStackView::slotClipItemSelected(ClipItem* c)
return;
}
setEnabled(true);
- effects=clipref->effectNames();
- setupListView(effects);
+ //effects=clipref->effectNames();
+ effects.clear();
+ for (int i=0;i<clipref->effectsCount();i++){
+ /*QString outstr;
+ QTextStream str(&outstr);
+ clipref->effectAt(i).save(str,2);
+ kDebug() << outstr;*/
+ effects.append(clipref->effectAt(i));
+ }
+ setupListView();
}
-void EffectStackView::setupListView(const QStringList& effects_list){
+void EffectStackView::setupListView(){
ui.effectlist->clear();
- ui.effectlist->addItems(effects);
+ foreach (QDomElement d,effects){
+
+ QDomNode namenode = d.elementsByTagName("name").item(0);
+ if (!namenode.isNull())
+ ui.effectlist->addItem(namenode.toElement().text() );
+ }
+ //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);
if (ui.effectlist->currentItem() && ui.effectlist->currentItem()->isSelected() ){
activeRow=ui.effectlist->row( ui.effectlist->currentItem() );
+ ui.parameterList->clear();
+ ui.parameterList->addItem("all");
+ QDomNodeList namenode = effects.at(activeRow).elementsByTagName("parameter");
+ for (int i=0;i<namenode.count();i++){
+ QDomNode pa=namenode.item(i);
+ QDomNode na=pa.firstChildElement("name");
+ ui.parameterList->addItem(na.toElement().text() );
+ }
+
+ emit transferParamDesc(effects.at(activeRow) ,0,100);//minx max frame
}else{
activeRow=-1;
}
effects.swap(activeRow, activeRow-1);
}
activeRow--;
- setupListView(effects);
+ setupListView();
}
effects.swap(activeRow, activeRow+1);
}
activeRow++;
- setupListView(effects);
+ setupListView();
}
}
if (effects.size()>0 && activeRow>0)
activeRow--;
- setupListView(effects);
+ setupListView();
}
QAction *result=displayMenu->exec(mapToGlobal(ui.buttonNew->pos()+ui.buttonNew->rect().bottomRight()));
if (result){
- effects.append(result->data().toString());
- setupListView(effects);
- kDebug()<< result->data();
+ //TODO effects.append(result->data().toString());
+ foreach (EffectsList* e, effectLists.values()){
+ QDomElement dom=e->getEffectByName(result->data().toString());
+ clipref->addEffect(dom);
+ slotClipItemSelected(clipref);
+ }
+
+ setupListView();
+ //kDebug()<< result->data();
}
delete displayMenu;
private:
int activeRow;
- QStringList effects;
+ QList<QDomElement> effects;
Ui::EffectStack_UI ui;
ClipItem* clipref;
- void setupListView(const QStringList& );
+ void setupListView();
void updateButtonStatus();
QMap<QString,EffectsList*> effectLists;
void slotShowInTimeline();
void slotParameterChanged(const QString&);
void itemSelectionChanged();
-
+ void slotUpdateEffectParams(QDomElement);
signals:
+ void transferParamDesc(const QDomElement&,int ,int);
void removeEffect(ClipItem*, QDomElement);
void updateClipEffect(ClipItem*, QDomElement);
+
};
#endif
m_newPoints=false;
activeIndexPlot=-1;
}
-
-void ParameterPlotter::setPointLists(const QList< QPair<QString, QMap< int , QVariant > > >& params,int startframe, int endframe){
+/*
+ <name>Lines</name>
+ <description>Lines from top to bottom</description>
+ <author>Marco Gittler</author>
+ <properties tag="lines" id="lines" />
+ <parameter default="5" type="constant" value="5" min="0" name="num" max="255" >
+ <name>Num</name>
+ </parameter>
+ <parameter default="4" type="constant" value="4" min="0" name="width" max="255" >
+ <name>Width</name>
+ </parameter>
+ </effect>
+
+*/
+void ParameterPlotter::setPointLists(const QDomElement& d,int startframe,int endframe){
+
+ //QListIterator <QPair <QString, QMap< int , QVariant > > > nameit(params);
+ itemParameter=d;
+ QDomNodeList namenode = d.elementsByTagName("parameter");
- QListIterator <QPair <QString, QMap< int , QVariant > > > nameit(params);
int max_y=0;
+ removeAllPlotObjects ();
parameterNameList.clear();
+ plotobjects.clear();
-
- while (nameit.hasNext() ){
+
+ 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();
- parameterNameList << item.first;
-
- QMapIterator <int,QVariant> pointit=item.second;
+ //QPair<QString, QMap< int , QVariant > > item=nameit.next();
+ QDomNode pa=namenode.item(i);
+ QDomNode na=pa.firstChildElement("name");
+
+ parameterNameList << na.toElement().text();
+
+
+ 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();
plot->addPoint(QPointF(pointit.key(),pointit.value().toDouble()),item.first,1);
if (pointit.value().toInt() >maxy)
max_y=pointit.value().toInt();
- }
+ }*/
plotobjects.append(plot);
}
maxx=endframe;
}
void ParameterPlotter::createParametersNew(){
- QList< QPair<QString, QMap<int,QVariant> > > ret;
+
QList<KPlotObject*> plotobjs=plotObjects();
if (plotobjs.size() != parameterNameList.size() ){
kDebug() << "ERROR size not equal";
}
-
- for (int i=0;i<parameterNameList.size() ;i++){
+ QDomNodeList namenode = itemParameter.elementsByTagName("parameter");
+ for (int i=0;i<namenode.count() ;i++){
QList<KPlotPoint*> points=plotobjs[i]->points();
+ QDomNode pa=namenode.item(i);
+
+
+
+
+
+
QMap<int,QVariant> vals;
foreach (KPlotPoint *o,points){
- vals[o->x()]=o->y();
+ //vals[o->x()]=o->y();
+ pa.attributes().namedItem("value").setNodeValue(QString::number(o->y()));
}
QPair<QString,QMap<int,QVariant> > pair("contrast",vals);
- ret.append(pair);
+ //ret.append(pair);
}
- emit parameterChanged(ret);
+ emit parameterChanged(itemParameter);
}
//topPadding and other padding can be wrong and this (i hope) will be correctet in newer kde versions
QPoint inPlot=event->pos()-QPoint(leftPadding(), topPadding() );
QList<KPlotPoint*> list= pointsUnderPoint (inPlot ) ;
- if (list.size() > 0){
- movepoint=list[0];
- oldmousepoint=event->pos();
- }else{
- if (m_newPoints && activeIndexPlot>=0){
- //setup new points
- KPlotObject* p=plotObjects()[activeIndexPlot];
- QList<KPlotPoint*> points=p->points();
- QList<QPointF> newpoints;
-
- double newx=inPlot.x()*dataRect().width()/pixRect().width();
- double newy=(height()-inPlot.y()-bottomPadding()-topPadding() )*dataRect().height()/pixRect().height();
- bool inserted=false;
- foreach (KPlotPoint* pt,points){
- if (pt->x() >newx && !inserted){
- newpoints.append(QPointF(newx,newy));
- inserted=true;
+ if (event->button()==Qt::LeftButton){
+ if (list.size() > 0){
+ movepoint=list[0];
+ oldmousepoint=event->pos();
+ }else{
+ if (m_newPoints && activeIndexPlot>=0){
+ //setup new points
+ KPlotObject* p=plotObjects()[activeIndexPlot];
+ QList<KPlotPoint*> points=p->points();
+ QList<QPointF> newpoints;
+
+ double newx=inPlot.x()*dataRect().width()/pixRect().width();
+ double newy=(height()-inPlot.y()-bottomPadding()-topPadding() )*dataRect().height()/pixRect().height();
+ bool inserted=false;
+ foreach (KPlotPoint* pt,points){
+ if (pt->x() >newx && !inserted){
+ newpoints.append(QPointF(newx,newy));
+ inserted=true;
+ }
+ newpoints.append(QPointF(pt->x(),pt->y()));
}
- newpoints.append(QPointF(pt->x(),pt->y()));
- }
- p->clearPoints();
- foreach (QPointF qf, newpoints ){
- p->addPoint(qf);
+ p->clearPoints();
+ foreach (QPointF qf, newpoints ){
+ p->addPoint(qf);
+ }
+ replacePlotObject(activeIndexPlot,p);
}
- replacePlotObject(activeIndexPlot,p);
+ movepoint=NULL;
}
- movepoint=NULL;
+ }else if (event->button()==Qt::LeftButton){
+ //menu for deleting or exact setup of point
}
}
***************************************************************************/
#include <KPlotWidget>
+#include <QDomElement>
class ParameterPlotter : public KPlotWidget {
Q_OBJECT
void createParametersNew();
QList<KPlotObject*> plotobjects;
QList<QColor> colors;
-
+ QDomElement itemParameter;
protected:
void mouseMoveEvent ( QMouseEvent * event );
void mousePressEvent ( QMouseEvent * event );
public slots:
- void setPointLists(const QList< QPair<QString, QMap<int,QVariant> > >&,int,int);
+ void setPointLists(const QDomElement&,int ,int);
signals:
- void parameterChanged(QList< QPair<QString, QMap<int,QVariant> > > );
+ void parameterChanged(QDomElement );
void updateFrame(int);
};
<widget class="QWidget" name="layoutWidget" >
<layout class="QVBoxLayout" >
<item>
- <widget class="ParameterPlotter" name="kplotwidget" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="grid" stdset="0" >
- <bool>true</bool>
+ <widget class="QStackedWidget" name="stackedWidget" >
+ <property name="currentIndex" >
+ <number>0</number>
</property>
+ <widget class="QWidget" name="page" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="ParameterPlotter" name="kplotwidget" />
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <widget class="QWidget" name="page_2" />
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<widget class="QToolButton" name="buttonLeftRight" >
+ <property name="toolTip" >
+ <string>move on X axis</string>
+ </property>
<property name="text" >
<string>...</string>
</property>
<property name="enabled" >
<bool>true</bool>
</property>
+ <property name="toolTip" >
+ <string>move on Y axis</string>
+ </property>
<property name="text" >
<string>...</string>
</property>
<property name="enabled" >
<bool>false</bool>
</property>
+ <property name="toolTip" >
+ <string>update values in timeline</string>
+ </property>
<property name="text" >
<string>...</string>
</property>
<property name="enabled" >
<bool>false</bool>
</property>
+ <property name="toolTip" >
+ <string>create new points</string>
+ </property>
<property name="text" >
<string>...</string>
</property>
</property>
</spacer>
</item>
+ <item>
+ <widget class="QCheckBox" name="checkBox" >
+ <property name="text" >
+ <string>GraphView</string>
+ </property>
+ <property name="checked" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="KComboBox" name="parameterList" />
</item>
<property name="enabled" >
<bool>true</bool>
</property>
+ <property name="toolTip" >
+ <string>parameter description</string>
+ </property>
<property name="text" >
<string>...</string>
</property>