effectslistview.cpp
addeffectcommand.cpp
effectstackview.cpp
+ parameterplotter.cpp
+
)
kde4_add_kcfg_files(kdenlive_SRCS GENERATE_MOC kdenlivesettings.kcfgc )
+/***************************************************************************
+ 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)
{
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)
+/***************************************************************************
+ 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
--- /dev/null
+/***************************************************************************
+ 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;
+}
--- /dev/null
+/***************************************************************************
+ 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 );
+
+};
<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/>