--- /dev/null
+/***************************************************************************
+ 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 "effectstackedit.h"
+#include <QVBoxLayout>
+#include <QSlider>
+#include <QLabel>
+#include "ui_constval_ui.h"
+
+EffectStackEdit::EffectStackEdit(QGroupBox* gbox,QWidget *parent): QWidget(parent)
+{
+
+ vbox=new QVBoxLayout;
+ gbox->setSizePolicy(QSizePolicy(QSizePolicy::Maximum,QSizePolicy::Maximum));
+ QVBoxLayout *tmpvbox=new QVBoxLayout;
+ tmpvbox->addLayout(vbox);
+ tmpvbox->addItem(new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Expanding));
+ gbox->setLayout(tmpvbox);
+
+}
+void EffectStackEdit::transferParamDesc(const QDomElement& d,int ,int){
+ params=d;
+ QDomNodeList namenode = params.elementsByTagName("parameter");
+
+ clearAllItems();
+ QString outstr;
+ QTextStream str(&outstr);
+ d.save(str,2);
+ kDebug() << outstr;
+ for (int i=0;i< namenode.count() ;i++){
+ QDomNode pa=namenode.item(i);
+ QDomNode na=pa.firstChildElement("name");
+ QString type=pa.attributes().namedItem("type").nodeValue();
+ QWidget * toFillin=NULL,*labelToFillIn=NULL;
+ if (type=="double" || type=="constant"){
+ toFillin=new QWidget;
+ Ui::Constval_UI *ctval=new Ui::Constval_UI;
+ ctval->setupUi(toFillin);
+
+ ctval->horizontalSlider->setMinimum(pa.attributes().namedItem("min").nodeValue().toInt());
+ ctval->horizontalSlider->setMaximum(pa.attributes().namedItem("max").nodeValue().toInt());
+ ctval->spinBox->setMinimum(ctval->horizontalSlider->minimum());
+ ctval->spinBox->setMaximum(ctval->horizontalSlider->maximum());
+ ctval->horizontalSlider->setValue(pa.attributes().namedItem("default").nodeValue().toInt());
+ ctval->title->setText(na.toElement().text() );
+ valueItems[na.toElement().text()]=ctval;
+ connect (ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT (slotSliderMoved(int)));
+
+
+ }
+
+ if (toFillin){
+ items.append(toFillin);
+ vbox->addWidget(toFillin);
+ }
+ }
+}
+void EffectStackEdit::collectAllParameters(){
+ QDomNodeList namenode = params.elementsByTagName("parameter");
+
+ for (int i=0;i< namenode.count() ;i++){
+ QDomNode pa=namenode.item(i);
+ QDomNode na=pa.firstChildElement("name");
+ QString type=pa.attributes().namedItem("type").nodeValue();
+ if (type=="double" || type=="constant"){
+ QSlider* slider=((Ui::Constval_UI*)valueItems[na.toElement().text()])->horizontalSlider;
+ pa.attributes().namedItem("value").setNodeValue(QString::number(slider->value()));
+ }
+ }
+ emit parameterChanged(params);
+}
+void EffectStackEdit::slotSliderMoved(int){
+ collectAllParameters();
+}
+
+void EffectStackEdit::clearAllItems(){
+ foreach (QWidget* w,items){
+ kDebug() << "delete" << w;
+ vbox->removeWidget(w);
+ delete w;
+ }
+ items.clear();
+ valueItems.clear();
+}
--- /dev/null
+/***************************************************************************
+ effecstackedit.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 EFFECTSTACKEDIT_H
+#define EFFECTSTACKEDIT_H
+
+#include <QWidget>
+#include <QDomElement>
+#include <QVBoxLayout>
+#include <QList>
+#include <QGroupBox>
+#include <QMap>
+
+
+class EffectStackEdit : public QWidget
+{
+ Q_OBJECT
+public:
+ EffectStackEdit(QGroupBox* gbox,QWidget *parent );
+private:
+ void clearAllItems();
+ QVBoxLayout *vbox;
+ QList<QWidget*> items;
+ QDomElement params;
+ QMap<QString,void*> valueItems;
+ void collectAllParameters();
+public slots:
+ void transferParamDesc(const QDomElement&,int ,int);
+ void slotSliderMoved(int);
+signals:
+ void parameterChanged(const QDomElement& );
+};
+
+#endif
: QWidget(parent)
{
ui.setupUi(this);
+ effectedit=new EffectStackEdit(ui.groupBox,this);
//ui.effectlist->horizontalHeader()->setVisible(false);
//ui.effectlist->verticalHeader()->setVisible(false);
activeRow=-1;
ui.buttonDel->setIcon(KIcon("trash-empty"));
ui.buttonDel->setToolTip(i18n("Delete effect"));
- 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"));
+
ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop);//use internal if drop is recognised right
connect (ui.buttonUp, SIGNAL (clicked()), this, SLOT (slotItemUp()) );
connect (ui.buttonDown, SIGNAL (clicked()), this, SLOT (slotItemDown()) );
connect (ui.buttonDel, SIGNAL (clicked()), this, SLOT (slotItemDel()) );
- 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)));
+ connect( this,SIGNAL (transferParamDesc(const QDomElement&,int ,int) ), effectedit , SLOT(transferParamDesc(const QDomElement&,int ,int)));
+ connect(effectedit, SIGNAL (parameterChanged(const QDomElement& ) ), this , SLOT (slotUpdateEffectParams(const QDomElement&)));
effectLists["audio"]=audioEffectList;
effectLists["video"]=videoEffectList;
effectLists["custom"]=customEffectList;
ui.infoBox->hide();
- updateButtonStatus();
+
}
-void EffectStackView::slotUpdateEffectParams(QDomElement e){
+void EffectStackView::slotUpdateEffectParams(const QDomElement& e){
if (clipref)
emit updateClipEffect(clipref, e);
}
//effects=clipref->effectNames();
effects.clear();
for (int i=0;i<clipref->effectsCount();i++){
- /*QString outstr;
+ QString outstr;
QTextStream str(&outstr);
clipref->effectAt(i).save(str,2);
- kDebug() << outstr;*/
+ kDebug() << outstr;
effects.append(clipref->effectAt(i));
}
setupListView();
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;
}
-void EffectStackView::slotSetMoveX(){
- ui.kplotwidget->setMoveX(!ui.kplotwidget->isMoveX());
- updateButtonStatus();
-}
-
-void EffectStackView::slotSetMoveY(){
- ui.kplotwidget->setMoveY(!ui.kplotwidget->isMoveY());
- updateButtonStatus();
-}
-
-void EffectStackView::slotSetNew(){
- ui.kplotwidget->setNewPoints(!ui.kplotwidget->isNewPoints());
- updateButtonStatus();
-}
-
-void EffectStackView::slotSetHelp(){
- ui.infoBox->setVisible(!ui.infoBox->isVisible());
- ui.buttonHelp->setDown(ui.infoBox->isVisible());
-}
-void EffectStackView::slotShowInTimeline(){
-
- ui.kplotwidget->setMoveTimeLine(!ui.kplotwidget->isMoveTimeline());
- updateButtonStatus();
-
-}
-
-void EffectStackView::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 EffectStackView::slotParameterChanged(const QString& text){
-
- //ui.buttonNewPoints->setEnabled(text!="all");
- ui.kplotwidget->replot(text);
- updateButtonStatus();
-}
void EffectStackView::slotNewEffect(){
#define EFFECTSTACKVIEW_H
#include <KIcon>
-
-#include "ui_effectstack_ui.h"
#include "clipitem.h"
+#include "ui_effectstack_ui.h"
+#include "effectstackedit.h"
class EffectsList;
void setupListView();
void updateButtonStatus();
QMap<QString,EffectsList*> effectLists;
+ EffectStackEdit* effectedit;
public slots:
void slotClipItemSelected(ClipItem*);
void slotItemUp();
void slotItemDown();
void slotItemDel();
- void slotSetMoveX();
- void slotSetMoveY();
- void slotSetNew();
void slotNewEffect();
- void slotSetHelp();
- void slotShowInTimeline();
- void slotParameterChanged(const QString&);
void itemSelectionChanged();
- void slotUpdateEffectParams(QDomElement);
+ void slotUpdateEffectParams(const QDomElement&);
signals:
void transferParamDesc(const QDomElement&,int ,int);
void removeEffect(ClipItem*, QDomElement);
* (at your option) any later version. *
* *
***************************************************************************/
-
+#if 0
#include "parameterplotter.h"
#include <QVariant>
#include <KPlotObject>
#include <KDebug>
#include <KPlotPoint>
-ParameterPlotter::ParameterPlotter (QWidget *parent):KPlotWidget (parent){
+ParameterPlotter::ParameterPlotter (QWidget *parent):QWidget(parent){
+ setupUi(this);
setAntialiasing(true);
setLeftPadding(20);
setRightPadding(10);
m_moveTimeline=true;
m_newPoints=false;
activeIndexPlot=-1;
+ 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&) ) );
+updateButtonStatus();
}
/*
<name>Lines</name>
bool ParameterPlotter::isNewPoints(){
return m_newPoints;
}
+void EffectStackView::slotSetMoveX(){
+ ui.kplotwidget->setMoveX(!ui.kplotwidget->isMoveX());
+ updateButtonStatus();
+}
+
+void EffectStackView::slotSetMoveY(){
+ ui.kplotwidget->setMoveY(!ui.kplotwidget->isMoveY());
+ updateButtonStatus();
+}
+
+void EffectStackView::slotSetNew(){
+ ui.kplotwidget->setNewPoints(!ui.kplotwidget->isNewPoints());
+ updateButtonStatus();
+}
+
+void EffectStackView::slotSetHelp(){
+ ui.infoBox->setVisible(!ui.infoBox->isVisible());
+ ui.buttonHelp->setDown(ui.infoBox->isVisible());
+}
+
+void EffectStackView::slotShowInTimeline(){
+
+ ui.kplotwidget->setMoveTimeLine(!ui.kplotwidget->isMoveTimeline());
+ updateButtonStatus();
+
+}
+
+void EffectStackView::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 EffectStackView::slotParameterChanged(const QString& text){
+
+ //ui.buttonNewPoints->setEnabled(text!="all");
+ ui.kplotwidget->replot(text);
+ updateButtonStatus();
+/*
+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() );
+ }*/
+}
+#endif
* (at your option) any later version. *
* *
***************************************************************************/
-
+#if 0
#include <KPlotWidget>
#include <QDomElement>
+#include "ui_keyframewidget_ui.h"
-class ParameterPlotter : public KPlotWidget {
+class ParameterPlotter : public QWidget , private Ui::KeyframeWidget_UI {
Q_OBJECT
public:
ParameterPlotter (QWidget *parent=0);
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);
};
+
+#endif
--- /dev/null
+<ui version="4.0" >
+ <class>Constval_UI</class>
+ <widget class="QWidget" name="Constval_UI" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>410</width>
+ <height>259</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QLabel" name="title" >
+ <property name="text" >
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QSlider" name="horizontalSlider" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinBox" />
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>horizontalSlider</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>spinBox</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>161</x>
+ <y>138</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>261</x>
+ <y>136</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>spinBox</sender>
+ <signal>valueChanged(int)</signal>
+ <receiver>horizontalSlider</receiver>
+ <slot>setValue(int)</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>257</x>
+ <y>126</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>173</x>
+ <y>122</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
--- /dev/null
+<ui version="4.0" >
+ <class>KeyframeWidget_UI</class>
+ <widget class="QWidget" name="KeyframeWidget_UI" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>411</width>
+ <height>204</height>
+ </rect>
+ </property>
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QSplitter" name="splitter" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <widget class="QWidget" name="layoutWidget" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <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>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="buttonUpDown" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" >
+ <string>move on Y axis</string>
+ </property>
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="buttonShowInTimeline" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" >
+ <string>update values in timeline</string>
+ </property>
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="buttonNewPoints" >
+ <property name="enabled" >
+ <bool>false</bool>
+ </property>
+ <property name="toolTip" >
+ <string>create new points</string>
+ </property>
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </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>
+ <item>
+ <widget class="QToolButton" name="buttonHelp" >
+ <property name="enabled" >
+ <bool>true</bool>
+ </property>
+ <property name="toolTip" >
+ <string>parameter description</string>
+ </property>
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ <customwidget>
+ <class>ParameterPlotter</class>
+ <extends>KPlotWidget</extends>
+ <header>parameterplotter.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>