+ QLayoutItem *child;
+ while ((child = m_slidersLayout->takeAt(0)) != 0) {
+ QWidget *wid = child->widget();
+ delete child;
+ if (wid)
+ delete wid;
+ }
+ //delete m_delegate;
+}
+
+void KeyframeEdit::addParameter(QDomElement e)
+{
+ keyframe_list->blockSignals(true);
+ m_params.append(e.cloneNode().toElement());
+ QDomNode na = e.firstChildElement("name");
+ QString paramName = i18n(na.toElement().text().toUtf8().data());
+ int columnId = keyframe_list->columnCount();
+ keyframe_list->insertColumn(columnId);
+ keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName));
+ m_slidersLayout->addWidget(new QLabel(paramName), columnId, 0);
+ QSlider *sl = new QSlider(Qt::Horizontal, this);
+ sl->setRange(m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt());
+ connect(sl, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
+ m_slidersLayout->addWidget(sl, columnId, 1);
+
+ QStringList frames = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
+ for (int i = 0; i < frames.count(); i++) {
+ int frame = frames.at(i).section(':', 0, 0).toInt();
+ bool found = false;
+ int j;
+ for (j = 0; j < keyframe_list->rowCount(); j++) {
+ int currentPos = getPos(j);
+ if (frame == currentPos) {
+ keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section(':', 1, 1)));
+ found = true;
+ break;
+ } else if (currentPos > frame) {
+ break;
+ }
+ }
+ if (!found) {
+ keyframe_list->insertRow(j);
+ keyframe_list->setVerticalHeaderItem(j, new QTableWidgetItem(getPosString(frame)));
+ keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section(':', 1, 1)));
+ keyframe_list->resizeRowToContents(j);
+ }
+ }
+ keyframe_list->resizeColumnsToContents();
+ keyframe_list->blockSignals(false);
+ slotAdjustKeyframeInfo(false);