From: Marco Gittler Date: Fri, 22 Feb 2008 15:27:03 +0000 (+0000) Subject: used old keyframewidget for setup /scrollarea for parameters X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=b3bee700d4fdfd373b3897e0b03db9a0466cc10c;p=kdenlive used old keyframewidget for setup /scrollarea for parameters svn path=/branches/KDE4/; revision=1904 --- diff --git a/src/complexparameter.cpp b/src/complexparameter.cpp new file mode 100644 index 00000000..a50d01bb --- /dev/null +++ b/src/complexparameter.cpp @@ -0,0 +1,117 @@ +/*************************************************************************** + complexparameter.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 "complexparameter.h" +#include "effectslist.h" +#include "clipitem.h" +#include +#include + +ComplexParameter::ComplexParameter(QWidget *parent) +: QWidget(parent) +{ + ui.setupUi(this); + //ui.effectlist->horizontalHeader()->setVisible(false); + //ui.effectlist->verticalHeader()->setVisible(false); + activeRow=-1; + clipref=NULL; + + + ui.buttonLeftRight->setIcon(KIcon("go-next"));//better icons needed + ui.buttonLeftRight->setToolTip(i18n("Allow horizontal moves")); + ui.buttonUpDown->setIcon(KIcon("go-up")); + ui.buttonUpDown->setToolTip(i18n("Allow vertical moves")); + ui.buttonShowInTimeline->setIcon(KIcon("kmplayer")); + ui.buttonShowInTimeline->setToolTip(i18n("Show keyframes in timeline")); + ui.buttonHelp->setIcon(KIcon("help-about")); + ui.buttonHelp->setToolTip(i18n("Parameter info")); + ui.buttonNewPoints->setIcon(KIcon("xedit")); + ui.buttonNewPoints->setToolTip(i18n("Add keyframe")); + + connect (ui.buttonLeftRight, SIGNAL (clicked()), this , SLOT ( slotSetMoveX() ) ); + connect (ui.buttonUpDown, SIGNAL (clicked()), this , SLOT ( slotSetMoveY() ) ); + connect (ui.buttonShowInTimeline, SIGNAL (clicked()), this , SLOT ( slotShowInTimeline() ) ); + 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( 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(); + +} + + + +void ComplexParameter::slotSetMoveX(){ + ui.kplotwidget->setMoveX(!ui.kplotwidget->isMoveX()); + updateButtonStatus(); +} + +void ComplexParameter::slotSetMoveY(){ + ui.kplotwidget->setMoveY(!ui.kplotwidget->isMoveY()); + updateButtonStatus(); +} + +void ComplexParameter::slotSetNew(){ + ui.kplotwidget->setNewPoints(!ui.kplotwidget->isNewPoints()); + updateButtonStatus(); +} + +void ComplexParameter::slotSetHelp(){ + ui.infoBox->setVisible(!ui.infoBox->isVisible()); + ui.buttonHelp->setDown(ui.infoBox->isVisible()); +} + +void ComplexParameter::slotShowInTimeline(){ + + ui.kplotwidget->setMoveTimeLine(!ui.kplotwidget->isMoveTimeline()); + updateButtonStatus(); + +} + +void ComplexParameter::updateButtonStatus(){ + ui.buttonLeftRight->setDown(ui.kplotwidget->isMoveX()); + ui.buttonUpDown->setDown(ui.kplotwidget->isMoveY()); + + ui.buttonShowInTimeline->setEnabled( ui.kplotwidget->isMoveX() || ui.kplotwidget->isMoveY () ); + ui.buttonShowInTimeline->setDown(ui.kplotwidget->isMoveTimeline()); + + ui.buttonNewPoints->setEnabled(ui.parameterList->currentText()!="all"); + ui.buttonNewPoints->setDown(ui.kplotwidget->isNewPoints()); +} + +void ComplexParameter::slotParameterChanged(const QString& text){ + + //ui.buttonNewPoints->setEnabled(text!="all"); + ui.kplotwidget->replot(text); + updateButtonStatus(); +} + + +void ComplexParameter::itemSelectionChanged (){ + //kDebug() << "drop"; +} +#include "complexparameter.moc" diff --git a/src/complexparameter.h b/src/complexparameter.h new file mode 100644 index 00000000..118c265b --- /dev/null +++ b/src/complexparameter.h @@ -0,0 +1,60 @@ +/*************************************************************************** + complexparameter.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 + +#include + +#include "ui_keyframewidget_ui.h" +#include "clipitem.h" +class EffectsList; + + +class ComplexParameter : public QWidget +{ + Q_OBJECT + + public: + ComplexParameter(QWidget *parent=0); + +private: + int activeRow; + QList effects; + Ui::KeyframeWidget_UI ui; + ClipItem* clipref; + void setupListView(); + void updateButtonStatus(); + QMap effectLists; + +public slots: + void slotSetMoveX(); + void slotSetMoveY(); + void slotSetNew(); + void slotSetHelp(); + void slotShowInTimeline(); + void slotParameterChanged(const QString&); + void itemSelectionChanged(); + +signals: + void transferParamDesc(const QDomElement&,int ,int); + void removeEffect(ClipItem*, QDomElement); + void updateClipEffect(ClipItem*, QDomElement); + +}; + +#endif diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index c43b7cc2..516b5bda 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -27,14 +27,22 @@ #include "ui_constval_ui.h" #include "ui_listval_ui.h" #include "ui_boolval_ui.h" -#include "parameterplotter.h" +#include "complexparameter.h" EffectStackEdit::EffectStackEdit(QFrame* frame,QWidget *parent): QObject(parent) { QScrollArea *area; - QVBoxLayout *vbox1=new QVBoxLayout; - frame->setLayout(vbox1); + QVBoxLayout *vbox1=new QVBoxLayout(frame); + QVBoxLayout *vbox2=new QVBoxLayout(frame); vbox=new QVBoxLayout(frame); + vbox1->setContentsMargins (0,0,0,0); + vbox1->setSpacing(0); + vbox2->setContentsMargins (0,0,0,0); + vbox2->setSpacing(0); + vbox->setContentsMargins (0,0,0,0); + vbox->setSpacing(0); + frame->setLayout(vbox1); + area=new QScrollArea(frame); QWidget *wid=new QWidget(area); @@ -44,7 +52,9 @@ EffectStackEdit::EffectStackEdit(QFrame* frame,QWidget *parent): QObject(parent) //area->setSizePolicy(QSizePolicy(QSizePolicy::Expanding,QSizePolicy::MinimumExpanding)); vbox1->addWidget(area); - wid->setLayout(vbox); + wid->setLayout(vbox2); + vbox2->addLayout(vbox); + vbox2->addItem(new QSpacerItem(0, 0, QSizePolicy::Minimum, QSizePolicy::MinimumExpanding)); area->setWidget(wid); area->setWidgetResizable(true); wid->show(); @@ -112,7 +122,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement& d,int ,int){ createSliderItem(names[i],val[i].toInt(),min[i].toInt(),max[i].toInt()); }; } - ParameterPlotter *pl=new ParameterPlotter; + ComplexParameter *pl=new ComplexParameter; vbox->addWidget(pl); items.append(pl); }else{ diff --git a/src/parameterplotter.cpp b/src/parameterplotter.cpp index 59800ffc..4208e140 100644 --- a/src/parameterplotter.cpp +++ b/src/parameterplotter.cpp @@ -22,18 +22,12 @@ #include #include -ParameterPlotter::ParameterPlotter (QWidget *parent):QWidget(parent){ - setupUi(this); - kplotwidget=new PlotWrapper(this); - QVBoxLayout *vbox=new QVBoxLayout (this); - vbox->addWidget(kplotwidget); - widget->setLayout(vbox); - - kplotwidget->setAntialiasing(true); - kplotwidget->setLeftPadding(20); - kplotwidget->setRightPadding(10); - kplotwidget->setTopPadding(10); - kplotwidget->setBottomPadding(20); +ParameterPlotter::ParameterPlotter (QWidget *parent):KPlotWidget (parent){ + setAntialiasing(true); + setLeftPadding(20); + setRightPadding(10); + setTopPadding(10); + setBottomPadding(20); movepoint=NULL; colors << Qt::white << Qt::red << Qt::green << Qt::blue << Qt::magenta << Qt::gray << Qt::cyan; maxy=0; @@ -42,24 +36,6 @@ ParameterPlotter::ParameterPlotter (QWidget *parent):QWidget(parent){ m_moveTimeline=true; m_newPoints=false; activeIndexPlot=-1; - buttonLeftRight->setIcon(KIcon("go-next"));//better icons needed - buttonLeftRight->setToolTip(i18n("Allow horizontal moves")); - buttonUpDown->setIcon(KIcon("go-up")); - buttonUpDown->setToolTip(i18n("Allow vertical moves")); - buttonShowInTimeline->setIcon(KIcon("kmplayer")); - buttonShowInTimeline->setToolTip(i18n("Show keyframes in timeline")); - buttonHelp->setIcon(KIcon("help-about")); - buttonHelp->setToolTip(i18n("Parameter info")); - buttonNewPoints->setIcon(KIcon("xedit")); - buttonNewPoints->setToolTip(i18n("Add keyframe")); - infoBox->hide(); - connect (buttonLeftRight, SIGNAL (clicked()), this , SLOT ( slotSetMoveX() ) ); - connect (buttonUpDown, SIGNAL (clicked()), this , SLOT ( slotSetMoveY() ) ); - connect (buttonShowInTimeline, SIGNAL (clicked()), this , SLOT ( slotShowInTimeline() ) ); - connect (buttonNewPoints, SIGNAL (clicked()), this , SLOT ( slotSetNew() ) ); - connect (buttonHelp, SIGNAL (clicked()), this , SLOT ( slotSetHelp() ) ); - connect (parameterList, SIGNAL (currentIndexChanged ( const QString & ) ), this, SLOT( slotParameterChanged(const QString&) ) ); - updateButtonStatus(); } /* Lines @@ -82,7 +58,7 @@ void ParameterPlotter::setPointLists(const QDomElement& d,int startframe,int end QDomNodeList namenode = d.elementsByTagName("parameter"); int max_y=0; - kplotwidget->removeAllPlotObjects (); + removeAllPlotObjects (); parameterNameList.clear(); plotobjects.clear(); @@ -111,14 +87,14 @@ void ParameterPlotter::setPointLists(const QDomElement& d,int startframe,int end } maxx=endframe; maxy=max_y; - kplotwidget->setLimits(0,endframe,0,maxy+10); - kplotwidget->addPlotObjects(plotobjects); + setLimits(0,endframe,0,maxy+10); + addPlotObjects(plotobjects); } void ParameterPlotter::createParametersNew(){ - QList plotobjs=kplotwidget->plotObjects(); + QList plotobjs=plotObjects(); if (plotobjs.size() != parameterNameList.size() ){ kDebug() << "ERROR size not equal"; } @@ -149,23 +125,23 @@ void ParameterPlotter::createParametersNew(){ void ParameterPlotter::mouseMoveEvent ( QMouseEvent * event ) { if (movepoint!=NULL){ - QList list= kplotwidget->pointsUnderPoint (event->pos()-QPoint(kplotwidget->leftPadding(), kplotwidget->topPadding() ) ) ; + QList list= pointsUnderPoint (event->pos()-QPoint(leftPadding(), topPadding() ) ) ; int i=0,j=-1; - foreach (KPlotObject *o, kplotwidget->plotObjects() ){ + foreach (KPlotObject *o, plotObjects() ){ QList points=o->points(); for(int p=0;ppos()-oldmousepoint; if (m_moveY) - movepoint->setY(movepoint->y()-delta.y()*kplotwidget->dataRect().height()/kplotwidget->pixRect().height() ); + movepoint->setY(movepoint->y()-delta.y()*dataRect().height()/pixRect().height() ); if (p>0 && px()+delta.x()*kplotwidget->dataRect().width()/kplotwidget->pixRect().width(); + double newx=movepoint->x()+delta.x()*dataRect().width()/pixRect().width(); if ( newx>points[p-1]->x() && newxx() && m_moveX) - movepoint->setX(movepoint->x()+delta.x()*kplotwidget->dataRect().width()/kplotwidget->pixRect().width() ); + movepoint->setX(movepoint->x()+delta.x()*dataRect().width()/pixRect().width() ); } if (m_moveTimeline && (m_moveX|| m_moveY) ) emit updateFrame(0); - kplotwidget->replacePlotObject(i,o); + replacePlotObject(i,o); oldmousepoint=event->pos(); } } @@ -180,19 +156,19 @@ void ParameterPlotter::replot(const QString & name){ int i=0; bool drawAll=name.isEmpty() || name=="all"; activeIndexPlot=-1; - foreach (KPlotObject* p,kplotwidget->plotObjects() ){ + foreach (KPlotObject* p,plotObjects() ){ p->setShowPoints(drawAll || parameterNameList[i]==name); p->setShowLines(drawAll || parameterNameList[i]==name); if ( parameterNameList[i]==name ) activeIndexPlot = i; - kplotwidget->replacePlotObject(i++,p); + replacePlotObject(i++,p); } } void ParameterPlotter::mousePressEvent ( QMouseEvent * event ) { //topPadding and other padding can be wrong and this (i hope) will be correctet in newer kde versions - QPoint inPlot=event->pos()-QPoint(kplotwidget->leftPadding(), kplotwidget->topPadding() ); - QList list= kplotwidget->pointsUnderPoint (inPlot ) ; + QPoint inPlot=event->pos()-QPoint(leftPadding(), topPadding() ); + QList list= pointsUnderPoint (inPlot ) ; if (event->button()==Qt::LeftButton){ if (list.size() > 0){ movepoint=list[0]; @@ -200,12 +176,12 @@ void ParameterPlotter::mousePressEvent ( QMouseEvent * event ) { }else{ if (m_newPoints && activeIndexPlot>=0){ //setup new points - KPlotObject* p=kplotwidget->plotObjects()[activeIndexPlot]; + KPlotObject* p=plotObjects()[activeIndexPlot]; QList points=p->points(); QList newpoints; - double newx=inPlot.x()*kplotwidget->dataRect().width()/kplotwidget->pixRect().width(); - double newy=(height()-inPlot.y()-kplotwidget->bottomPadding()-kplotwidget->topPadding() )*kplotwidget->dataRect().height()/kplotwidget->pixRect().height(); + 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){ @@ -218,7 +194,7 @@ void ParameterPlotter::mousePressEvent ( QMouseEvent * event ) { foreach (QPointF qf, newpoints ){ p->addPoint(qf); } - kplotwidget->replacePlotObject(activeIndexPlot,p); + replacePlotObject(activeIndexPlot,p); } movepoint=NULL; } @@ -227,57 +203,34 @@ void ParameterPlotter::mousePressEvent ( QMouseEvent * event ) { } } +void ParameterPlotter::setMoveX(bool b){ + m_moveX=b; +} -void ParameterPlotter::slotSetMoveX(){ - m_moveX=!m_moveX; - updateButtonStatus(); +void ParameterPlotter::setMoveY(bool b){ + m_moveY=b; } -void ParameterPlotter::slotSetMoveY(){ - m_moveY=!m_moveY; - updateButtonStatus(); +void ParameterPlotter::setMoveTimeLine(bool b){ + m_moveTimeline=b; } -void ParameterPlotter::slotSetNew(){ - m_newPoints=!m_newPoints; - updateButtonStatus(); +void ParameterPlotter::setNewPoints(bool b){ + m_newPoints=b; } -void ParameterPlotter::slotSetHelp(){ - infoBox->setVisible(!infoBox->isVisible()); - buttonHelp->setDown(infoBox->isVisible()); +bool ParameterPlotter::isMoveX(){ + return m_moveX; } -void ParameterPlotter::slotShowInTimeline(){ - - m_moveTimeline=!m_moveTimeline; - updateButtonStatus(); - +bool ParameterPlotter::isMoveY(){ + return m_moveY; } -void ParameterPlotter::updateButtonStatus(){ - buttonLeftRight->setDown(m_moveY); - buttonUpDown->setDown(m_moveX); - - buttonShowInTimeline->setEnabled( m_moveX || m_moveY); - buttonShowInTimeline->setDown(m_moveTimeline); - - ///TODO buttonNewPoints->setEnabled(currentText()!="all"); - buttonNewPoints->setDown(m_newPoints); +bool ParameterPlotter::isMoveTimeline(){ + return m_moveTimeline; } -void ParameterPlotter::slotParameterChanged(const QString& text){ - - //ui.buttonNewPoints->setEnabled(text!="all"); - replot(text); - updateButtonStatus(); -/* -ui.parameterList->clear(); - ui.parameterList->addItem("all"); - QDomNodeList namenode = effects.at(activeRow).elementsByTagName("parameter"); - for (int i=0;iaddItem(na.toElement().text() ); - }*/ +bool ParameterPlotter::isNewPoints(){ + return m_newPoints; } diff --git a/src/parameterplotter.h b/src/parameterplotter.h index b4a23900..058286f0 100644 --- a/src/parameterplotter.h +++ b/src/parameterplotter.h @@ -17,27 +17,23 @@ #include #include -#include "ui_keyframewidget_ui.h" -class PlotWrapper : public KPlotWidget { - Q_OBJECT - public: - PlotWrapper (QWidget *parent=0):KPlotWidget(parent){} - QList pointsUnderPoint(const QPoint& p){ - return KPlotWidget::pointsUnderPoint( p ); - } -}; - - -class ParameterPlotter : public QWidget , public Ui::KeyframeWidget_UI { +class ParameterPlotter : public KPlotWidget { Q_OBJECT public: ParameterPlotter (QWidget *parent=0); virtual ~ParameterPlotter(){} + void setMoveX(bool); + void setMoveY(bool); + void setMoveTimeLine(bool); + void setNewPoints(bool); + bool isMoveX(); + bool isMoveY(); + bool isMoveTimeline(); + bool isNewPoints(); void replot(const QString& name=""); private: KPlotPoint* movepoint; - PlotWrapper* kplotwidget; int activeIndexPlot; bool m_moveX,m_moveY,m_moveTimeline,m_newPoints; QPoint oldmousepoint; @@ -47,21 +43,13 @@ class ParameterPlotter : public QWidget , public Ui::KeyframeWidget_UI { QList plotobjects; QList colors; QDomElement itemParameter; - void updateButtonStatus(); protected: void mouseMoveEvent ( QMouseEvent * event ); void mousePressEvent ( QMouseEvent * event ); public slots: void setPointLists(const QDomElement&,int ,int); - void slotSetMoveX(); - void slotSetMoveY(); - void slotSetNew(); - void slotSetHelp(); - void slotShowInTimeline(); - void slotParameterChanged(const QString&); signals: void parameterChanged(QDomElement ); void updateFrame(int); }; - diff --git a/src/widgets/effectstack_ui.ui b/src/widgets/effectstack_ui.ui index 5737ac8e..bf34c822 100644 --- a/src/widgets/effectstack_ui.ui +++ b/src/widgets/effectstack_ui.ui @@ -104,19 +104,31 @@ - - - Qt::Vertical - - - - QFrame::WinPanel - - - QFrame::Sunken - - - + + + + + + Qt::Vertical + + + + + + + + + Qt::Horizontal + + + + 256 + 16 + + + + + diff --git a/src/widgets/keyframewidget_ui.ui b/src/widgets/keyframewidget_ui.ui index 34dfdfff..6a61a93f 100644 --- a/src/widgets/keyframewidget_ui.ui +++ b/src/widgets/keyframewidget_ui.ui @@ -20,11 +20,12 @@ - - - - - + + + Qt::Vertical + + + @@ -115,11 +116,9 @@ - - - - - + + + @@ -134,6 +133,11 @@ QTextEdit
ktextedit.h
+ + ParameterPlotter + KPlotWidget +
parameterplotter.h
+