#include <KGlobalSettings>
#include <QHeaderView>
-#include <QButtonGroup>
-#include <QRadioButton>
KeyframeEdit::KeyframeEdit(QDomElement e, int minFrame, int maxFrame, Timecode tc, int activeKeyframe, QWidget* parent) :
QWidget(parent),
m_position = new PositionEdit(i18n("Position"), 0, 0, 1, tc, widgetTable);
((QGridLayout*)widgetTable->layout())->addWidget(m_position, 3, 0, 1, -1);
- m_showButtons = new QButtonGroup(this);
m_slidersLayout = new QGridLayout(param_sliders);
+ //m_slidersLayout->setSpacing(0);
+
+ m_slidersLayout->setContentsMargins(0, 0, 0, 0);
+ m_slidersLayout->setVerticalSpacing(2);
keyframe_list->setSelectionBehavior(QAbstractItemView::SelectRows);
keyframe_list->setSelectionMode(QAbstractItemView::SingleSelection);
addParameter(e, activeKeyframe);
connect(buttonKeyframes, SIGNAL(clicked()), this, SLOT(slotKeyframeMode()));
connect(buttonResetKeyframe, SIGNAL(clicked()), this, SLOT(slotResetKeyframe()));
connect(m_position, SIGNAL(parameterChanged(int)), this, SLOT(slotAdjustKeyframePos(int)));
- connect(m_showButtons, SIGNAL(buttonClicked(int)), this, SLOT(slotUpdateVisibleParameter(int)));
//connect(keyframe_list, SIGNAL(itemDoubleClicked(QTreeWidgetItem *, int)), this, SLOT(slotSaveCurrentParam(QTreeWidgetItem *, int)));
QString comment;
if (!commentElem.isNull())
comment = i18n(commentElem.text().toUtf8().data());
-
+
int columnId = keyframe_list->columnCount();
keyframe_list->insertColumn(columnId);
keyframe_list->setHorizontalHeaderItem(columnId, new QTableWidgetItem(paramName));
DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, 0,
- m_params.at(columnId).attribute("min").toInt(), m_params.at(columnId).attribute("max").toInt(),
- m_params.at(columnId).attribute("default").toInt(), comment, m_params.at(columnId).attribute("suffix"), this);
- connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(slotAdjustKeyframeValue(int)));
+ m_params.at(columnId).attribute("min").toDouble(), m_params.at(columnId).attribute("max").toDouble(),
+ m_params.at(columnId).attribute("default").toDouble(), comment, columnId, m_params.at(columnId).attribute("suffix"), m_params.at(columnId).attribute("decimals").toInt(), this);
+ connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotAdjustKeyframeValue(double)));
connect(this, SIGNAL(showComments(bool)), doubleparam, SLOT(slotShowComment(bool)));
+ connect(doubleparam, SIGNAL(setInTimeline(int)), this, SLOT(slotUpdateVisibleParameter(int)));
m_slidersLayout->addWidget(doubleparam, columnId, 0);
-
- QRadioButton *radio = new QRadioButton(this);
- radio->setToolTip(i18n("Show %1 in timeline").arg(paramName));
- m_showButtons->addButton(radio, columnId);
- if (e.attribute("intimeline") == "1")
- radio->setChecked(true);
-
- QVBoxLayout *radioLayout = new QVBoxLayout;
- radioLayout->addWidget(radio, 0, Qt::AlignTop);
- m_slidersLayout->addLayout(radioLayout, columnId, 1);
+ if (e.attribute("intimeline") == "1") {
+ doubleparam->setInTimelineProperty(true);
+ }
QStringList frames = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
for (int i = 0; i < frames.count(); i++) {
newrow++;
} else if (row == 0) {
if (pos1 == m_min) {
- result = m_max - 1;
+ result = m_max;
newrow++;
} else {
result = m_min;
}
} else {
- if (pos1 < m_max - 1) {
+ if (pos1 < m_max) {
// last keyframe selected and it is not at end of clip -> add keyframe at the end
- result = m_max - 1;
+ result = m_max;
newrow++;
} else {
int pos2 = getPos(row - 1);
continue;
doubleparam->blockSignals(true);
if (keyframe_list->item(item->row(), col)) {
- doubleparam->setValue(keyframe_list->item(item->row(), col)->text().toInt());
+ doubleparam->setValue(keyframe_list->item(item->row(), col)->text().toDouble());
} else {
kDebug() << "Null pointer exception caught: http://www.kdenlive.org/mantis/view.php?id=1771";
}
emit seekToPos(value - m_min);
}
-void KeyframeEdit::slotAdjustKeyframeValue(int value)
+void KeyframeEdit::slotAdjustKeyframeValue(double value)
{
- Q_UNUSED(value);
+ Q_UNUSED(value)
QTableWidgetItem *item = keyframe_list->currentItem();
for (int col = 0; col < keyframe_list->columnCount(); col++) {
DoubleParameterWidget *doubleparam = static_cast <DoubleParameterWidget*>(m_slidersLayout->itemAtPosition(col, 0)->widget());
if (!doubleparam)
continue;
- int val = doubleparam->getValue();
+ double val = doubleparam->getValue();
QTableWidgetItem *nitem = keyframe_list->item(item->row(), col);
- if (nitem && nitem->text().toInt() != val)
+ if (nitem && nitem->text().toDouble() != val)
nitem->setText(QString::number(val));
}
//keyframe_list->item(item->row() - 1, item->column());
void KeyframeEdit::slotUpdateVisibleParameter(int id, bool update)
{
- for (int i = 0; i < m_params.count(); ++i)
- m_params[i].setAttribute("intimeline", (i == id ? "1" : "0"));
+ for (int i = 0; i < m_params.count(); ++i) {
+ m_params[i].setAttribute("intimeline", (i == id ? "1" : "0"));
+ }
+ for (int col = 0; col < keyframe_list->columnCount(); col++) {
+ DoubleParameterWidget *doubleparam = static_cast <DoubleParameterWidget*>(m_slidersLayout->itemAtPosition(col, 0)->widget());
+ if (!doubleparam)
+ continue;
+ doubleparam->setInTimelineProperty(col == id);
+ //kDebug()<<"// PARAM: "<<col<<" Set TO: "<<(bool) (col == id);
+
+ }
if (update) emit parameterChanged();
}
{
if (m_params.count() == 0)
return;
-
+
foreach(QDomElement elem, m_params) {
if (elem.attribute("intimeline") == "1")
return;
}
- slotUpdateVisibleParameter(0, false);
- QRadioButton *radio = static_cast<QRadioButton*>(m_slidersLayout->itemAtPosition(0, 1)->widget());
- if (radio)
- radio->setChecked(true);
+ slotUpdateVisibleParameter(0);
}
#include "keyframeedit.moc"