From: Marco Gittler Date: Tue, 19 Feb 2008 18:28:01 +0000 (+0000) Subject: parameter adjustable X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=a3f0e8b6f7422fb2eb8917e6b7c947c1895b09b7;p=kdenlive parameter adjustable svn path=/branches/KDE4/; revision=1874 --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65316ae7..aca7020b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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 ) diff --git a/src/effectstackview.cpp b/src/effectstackview.cpp index ec3ff653..1f9c0f29 100644 --- a/src/effectstackview.cpp +++ b/src/effectstackview.cpp @@ -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 #include #include "effectstackview.h" #include "clipitem.h" #include + 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 > > points; + QMap data; + data[0]=0.1; + data[100]=50; + data[255]=100; + QPair > testpair("contrast",data); + points.append(testpair); + ui.kplotwidget->setPointLists(points,0,300); + } void EffectStackView::slotClipItemSelected(ClipItem* c) diff --git a/src/effectstackview.h b/src/effectstackview.h index d72403d3..06a9c8d4 100644 --- a/src/effectstackview.h +++ b/src/effectstackview.h @@ -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 index 00000000..ef2d6da7 --- /dev/null +++ b/src/parameterplotter.cpp @@ -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 +#include +#include +#include +#include + +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 > >& params,int startframe, int endframe){ + + QListIterator > > nameit(params); + int maxy=0; + while (nameit.hasNext() ){ + + QPair > item=nameit.next(); + QString name(item.first); + QMapIterator 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 > > ParameterPlotter::getPointLists(){ + return pointlists; +} + +void ParameterPlotter::mouseMoveEvent ( QMouseEvent * event ) { + + if (movepoint!=NULL){ + QList 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 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 index 00000000..b3a8b311 --- /dev/null +++ b/src/parameterplotter.h @@ -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 + +class ParameterPlotter : public KPlotWidget { + Q_OBJECT + public: + ParameterPlotter (QWidget *parent=0); + void setPointLists(const QList< QPair > >&,int,int); + QList< QPair > > getPointLists(); + private: + QList< QPair > > pointlists; + KPlotPoint* movepoint; + KPlotObject *plot; + QPoint oldmousepoint; + protected: + void mouseMoveEvent ( QMouseEvent * event ); + void mousePressEvent ( QMouseEvent * event ); + +}; diff --git a/src/widgets/effectstack_ui.ui b/src/widgets/effectstack_ui.ui index 48c5be45..2247f378 100644 --- a/src/widgets/effectstack_ui.ui +++ b/src/widgets/effectstack_ui.ui @@ -83,7 +83,7 @@ Qt::Vertical - + true @@ -113,16 +113,16 @@ QListWidget
klistwidget.h
- - KPlotWidget - QFrame -
kplotwidget.h
-
KSeparator QFrame
kseparator.h
+ + ParameterPlotter + KPlotWidget +
parameterplotter.h
+