#include <QVBoxLayout>
#include <QSlider>
#include <QLabel>
+#include <QCheckBox>
#include "ui_constval_ui.h"
+#include "ui_listval_ui.h"
+#include "ui_boolval_ui.h"
EffectStackEdit::EffectStackEdit(QGroupBox* gbox,QWidget *parent): QWidget(parent)
{
}
void EffectStackEdit::transferParamDesc(const QDomElement& d,int ,int){
+ kDebug() << "in";
params=d;
QDomNodeList namenode = params.elementsByTagName("parameter");
d.save(str,2);
kDebug() << outstr;
for (int i=0;i< namenode.count() ;i++){
+ kDebug() << "in form";
QDomNode pa=namenode.item(i);
QDomNode na=pa.firstChildElement("name");
- QString type=pa.attributes().namedItem("type").nodeValue();
+ QDomNamedNodeMap nodeAtts=pa.attributes();
+ QString type=nodeAtts.namedItem("type").nodeValue();
QWidget * toFillin=NULL,*labelToFillIn=NULL;
+ //TODO constant, list, bool, complex , color, geometry, position
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->horizontalSlider->setMinimum(nodeAtts.namedItem("min").nodeValue().toInt());
+ ctval->horizontalSlider->setMaximum(nodeAtts.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() );
+ if (nodeAtts.namedItem("value").isNull())
+ ctval->horizontalSlider->setValue(nodeAtts.namedItem("default").nodeValue().toInt());
+ else
+ ctval->horizontalSlider->setValue(nodeAtts.namedItem("value").nodeValue().toInt());
+ ctval->title->setTitle(na.toElement().text() );
valueItems[na.toElement().text()]=ctval;
connect (ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT (slotSliderMoved(int)));
+ }
+ if (type=="list"){
+ toFillin=new QWidget;
+ Ui::Listval_UI *lsval=new Ui::Listval_UI;
+ lsval->setupUi(toFillin);
+ nodeAtts.namedItem("paramlist");
+
+ lsval->list->addItems(nodeAtts.namedItem("paramlist").nodeValue().split(","));
+ /*if (nodeAtts.namedItem("value").isNull())
+ lsval->list->setCurrentText(nodeAtts.namedItem("default").nodeValue());
+ else
+ lsval->list->setCurrentText(nodeAtts.namedItem("value").nodeValue());
+ */
+ connect (lsval->list, SIGNAL(currentIndexChanged(int)) , this, SLOT (slotSliderMoved(int)));
+ lsval->title->setTitle(na.toElement().text() );
+ valueItems[na.toElement().text()]=lsval;
+ }
+ if (type=="bool"){
+ toFillin=new QWidget;
+ Ui::Boolval_UI *bval=new Ui::Boolval_UI;
+ bval->setupUi(toFillin);
+ if (nodeAtts.namedItem("value").isNull())
+ bval->checkBox->setCheckState(nodeAtts.namedItem("default").nodeValue()=="0" ? Qt::Unchecked : Qt::Checked);
+ else
+ bval->checkBox->setCheckState(nodeAtts.namedItem("value").nodeValue()=="0" ? Qt::Unchecked : Qt::Checked);
-
+ connect (bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT (slotSliderMoved(int)));
+ bval->title->setTitle(na.toElement().text() );
+ valueItems[na.toElement().text()]=bval;
}
if (toFillin){
QSlider* slider=((Ui::Constval_UI*)valueItems[na.toElement().text()])->horizontalSlider;
pa.attributes().namedItem("value").setNodeValue(QString::number(slider->value()));
}
+ if (type=="list"){
+ KComboBox *box=((Ui::Listval_UI*)valueItems[na.toElement().text()])->list;
+ pa.attributes().namedItem("value").setNodeValue(box->currentText());
+ }
+ if (type=="bool"){
+ QCheckBox *box=((Ui::Boolval_UI*)valueItems[na.toElement().text()])->checkBox;
+ pa.attributes().namedItem("value").setNodeValue(box->checkState() == Qt::Checked ? "1" :"0" );
+ }
}
emit parameterChanged(params);
}
ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop);//use internal if drop is recognised right
- connect (ui.effectlist, SIGNAL ( itemSelectionChanged()), this , SLOT( slotItemSelectionChanged() ));
+ connect (ui.effectlist, SIGNAL ( itemPressed(QListWidgetItem *)), this , SLOT( slotItemSelectionChanged() ));
connect (ui.buttonNew, SIGNAL (clicked()), this, SLOT (slotNewEffect()) );
connect (ui.buttonUp, SIGNAL (clicked()), this, SLOT (slotItemUp()) );
connect (ui.buttonDown, SIGNAL (clicked()), this, SLOT (slotItemDown()) );
--- /dev/null
+<ui version="4.0" >
+ <class>Boolval_UI</class>
+ <widget class="QWidget" name="Boolval_UI" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>509</width>
+ <height>259</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>0</number>
+ </property>
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QGroupBox" name="title" >
+ <property name="font" >
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property name="title" >
+ <string>GroupBox</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading</set>
+ </property>
+ <property name="flat" >
+ <bool>false</bool>
+ </property>
+ <property name="checkable" >
+ <bool>false</bool>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QCheckBox" name="checkBox" >
+ <property name="text" >
+ <string>CheckBox</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+<ui version="4.0" >
+ <class>Listval_UI</class>
+ <widget class="QWidget" name="Listval_UI" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>428</width>
+ <height>128</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>0</number>
+ </property>
+ <item row="0" column="0" >
+ <widget class="QGroupBox" name="title" >
+ <property name="font" >
+ <font>
+ <pointsize>8</pointsize>
+ </font>
+ </property>
+ <property name="title" >
+ <string>GroupBox</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="leftMargin" >
+ <number>0</number>
+ </property>
+ <property name="topMargin" >
+ <number>0</number>
+ </property>
+ <property name="rightMargin" >
+ <number>0</number>
+ </property>
+ <property name="bottomMargin" >
+ <number>0</number>
+ </property>
+ <property name="horizontalSpacing" >
+ <number>0</number>
+ </property>
+ <property name="verticalSpacing" >
+ <number>0</number>
+ </property>
+ <item row="0" column="0" >
+ <widget class="KComboBox" name="list" />
+ </item>
+ </layout>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <customwidgets>
+ <customwidget>
+ <class>KComboBox</class>
+ <extends>QComboBox</extends>
+ <header>kcombobox.h</header>
+ </customwidget>
+ </customwidgets>
+ <resources/>
+ <connections/>
+</ui>