choosecolorwidget.cpp
monitorscene.cpp
geometrywidget.cpp
+ doubleparameterwidget.cpp
)
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.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. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#include "doubleparameterwidget.h"
+
+#include <QHBoxLayout>
+#include <QLabel>
+#include <QSlider>
+#include <QSpinBox>
+
+
+DoubleParameterWidget::DoubleParameterWidget(const QString &name, int value, int min, int max, const QString suffix, QWidget *parent) :
+ QWidget(parent)
+{
+ QHBoxLayout *layout = new QHBoxLayout(this);
+
+ m_name = new QLabel(name, this);
+ layout->addWidget(m_name);
+
+ m_slider = new QSlider(Qt::Horizontal, this);
+ m_slider->setRange(min, max);
+ //m_slider->setPageStep((max - min) / 10);
+ layout->addWidget(m_slider);
+
+ m_spinBox = new QSpinBox(this);
+ m_spinBox->setRange(min, max);
+ if (!suffix.isEmpty())
+ m_spinBox->setSuffix(suffix);
+ layout->addWidget(m_spinBox);
+
+ connect(m_slider, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
+ connect(m_spinBox, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)));
+
+ m_spinBox->setValue(value);
+}
+
+void DoubleParameterWidget::setValue(int value)
+{
+ m_slider->blockSignals(true);
+ m_spinBox->blockSignals(true);
+
+ m_slider->setValue(value);
+ m_spinBox->setValue(value);
+
+ m_slider->blockSignals(false);
+ m_spinBox->blockSignals(false);
+
+ emit valueChanged(value);
+}
+
+int DoubleParameterWidget::getValue()
+{
+ return m_spinBox->value();
+}
+
+
+void DoubleParameterWidget::setName(const QString& name)
+{
+ m_name->setText(name);
+}
+
+#include "doubleparameterwidget.moc"
\ No newline at end of file
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2010 by Till Theato (root@ttill.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. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef DOUBLEPARAMETERWIDGET_H
+#define DOUBLEPARAMETERWIDGET_H
+
+#include <QWidget>
+
+class QLabel;
+class QSlider;
+class QSpinBox;
+
+/**
+ * @class DoubleParameterWidget
+ * @brief Widget to choose a double parameter (for a effect) with the help of a slider and a spinbox.
+ * @author Till Theato
+ *
+ * The widget does only handle integers, so the parameter has to be converted into the proper double range afterwards.
+ */
+
+class DoubleParameterWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ /** @brief Sets up the parameter's GUI.
+ * @param name Name of the parameter
+ * @param value Value of the parameter
+ * @param min Minimum value
+ * @param max maximum value
+ * @param suffix (optional) Suffix to display in spinbox
+ * @param parent (optional) Parent Widget */
+ DoubleParameterWidget(const QString &name, int value, int min, int max, const QString suffix = QString(), QWidget* parent = 0);
+ /** @brief Updates the label to display @param name. */
+ void setName(const QString &name);
+ /** @brief Gets the parameter's value. */
+ int getValue();
+
+public slots:
+ /** @brief Sets the value to @param value. */
+ void setValue(int value);
+
+private:
+ QLabel *m_name;
+ QSlider *m_slider;
+ QSpinBox *m_spinBox;
+
+signals:
+ void valueChanged(int);
+};
+
+#endif
***************************************************************************/
#include "effectstackedit.h"
-#include "ui_constval_ui.h"
#include "ui_listval_ui.h"
#include "ui_boolval_ui.h"
#include "ui_wipeval_ui.h"
#include "choosecolorwidget.h"
#include "geometrywidget.h"
#include "colortools.h"
+#include "doubleparameterwidget.h"
#include <KDebug>
#include <KLocale>
#include <KFileDialog>
#include <QVBoxLayout>
-#include <QSlider>
#include <QLabel>
#include <QPushButton>
#include <QCheckBox>
{
};
-class Constval: public QWidget, public Ui::Constval_UI
-{
-};
-
class Listval: public QWidget, public Ui::Listval_UI
{
};
{
if (m_keyframeEditor)
m_keyframeEditor->updateTimecodeFormat();
+
QDomNodeList namenode = m_params.elementsByTagName("parameter");
for (int i = 0; i < namenode.count() ; i++) {
QDomNode pa = namenode.item(i);
return;
}
- /*QDomDocument doc;
- doc.appendChild(doc.importNode(m_params, true));
- kDebug() << "IMPORTED TRANS: " << doc.toString();*/
-
QDomNodeList namenode = m_params.elementsByTagName("parameter");
QDomElement e = m_params.toElement();
const int minFrame = e.attribute("start").toInt();
max = (int) ProfilesDialog::getStringEval(m_profile, pa.attribute("max"));
else
max = pa.attribute("max").toInt();
- createSliderItem(paramName, (int)(value.toDouble() + 0.5) , min, max, pa.attribute("suffix", QString()));
- delete toFillin;
- toFillin = NULL;
+
+ DoubleParameterWidget *doubleparam = new DoubleParameterWidget(paramName, (int)(value.toDouble() + 0.5), min, max, pa.attribute("suffix", QString()), this);
+ m_vbox->addWidget(doubleparam);
+ m_valueItems[paramName] = doubleparam;
+ connect(doubleparam, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters()));
} else if (type == "list") {
Listval *lsval = new Listval;
lsval->setupUi(toFillin);
connect(bval->checkBox, SIGNAL(stateChanged(int)) , this, SLOT(collectAllParameters()));
m_uiItems.append(bval);
} else if (type == "complex") {
- /*QStringList names=nodeAtts.namedItem("name").nodeValue().split(';');
- QStringList max=nodeAtts.namedItem("max").nodeValue().split(';');
- QStringList min=nodeAtts.namedItem("min").nodeValue().split(';');
- QStringList val=value.split(';');
- kDebug() << "in complex"<<names.size() << " " << max.size() << " " << min.size() << " " << val.size() ;
- if ( (names.size() == max.size() ) &&
- (names.size()== min.size()) &&
- (names.size()== val.size()) )
- {
- for (int i=0;i< names.size();i++){
- createSliderItem(names[i],val[i].toInt(),min[i].toInt(),max[i].toInt());
- };
- }*/
ComplexParameter *pl = new ComplexParameter;
pl->setupParam(d, pa.attribute("name"), 0, 100);
m_vbox->addWidget(pl);
QString setValue;
if (type == "double" || type == "constant") {
- QSlider* slider = ((Constval*)m_valueItems.value(paramName))->horizontalSlider;
- setValue = QString::number(slider->value());
+ DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
+ setValue = QString::number(doubleparam->getValue());
} else if (type == "list") {
KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
setValue = box->itemData(box->currentIndex()).toString();
emit parameterChanged(oldparam, newparam);
}
-void EffectStackEdit::createSliderItem(const QString& name, int val , int min, int max, const QString suffix)
-{
- QWidget* toFillin = new QWidget(m_baseWidget);
- Constval *ctval = new Constval;
- ctval->setupUi(toFillin);
- ctval->horizontalSlider->setMinimum(min);
- ctval->horizontalSlider->setMaximum(max);
- if (!suffix.isEmpty()) ctval->spinBox->setSuffix(suffix);
- ctval->spinBox->setMinimum(min);
- ctval->spinBox->setMaximum(max);
- ctval->horizontalSlider->setPageStep((int)(max - min) / 10);
- ctval->horizontalSlider->setValue(val);
- ctval->label->setText(name);
- m_valueItems[name] = ctval;
- m_uiItems.append(ctval);
- connect(ctval->horizontalSlider, SIGNAL(valueChanged(int)) , this, SLOT(collectAllParameters()));
- m_vbox->addWidget(toFillin);
-}
-
-void EffectStackEdit::slotSliderMoved(int)
-{
- collectAllParameters();
-}
-
void EffectStackEdit::clearAllItems()
{
blockSignals(true);
~EffectStackEdit();
void updateProjectFormat(MltVideoProfile profile, Timecode t);
static QMap<QString, QImage> iconCache;
+ /** @brief Sets attribute @param name to @param value.
+ *
+ * Used to disable the effect, by setting disabled="1" */
void updateParameter(const QString &name, const QString &value);
void setFrameSize(QPoint p);
+ /** @brief Tells the parameters to update their timecode format according to KdenliveSettings. */
void updateTimecodeFormat();
private:
+ /** @brief Deletes all parameter widgets. */
void clearAllItems();
- void createSliderItem(const QString& name, int val , int min, int max, const QString);
wipeInfo getWipeInfo(QString value);
QString getWipeString(wipeInfo info);
/** @brief Updates parameter @param name according to new value of dependency.
Monitor *m_monitor;
public slots:
- /** \brief Called when an effect is selected, builds the UI for this effect */
+ /** @brief Called when an effect is selected, builds the UI for this effect. */
void transferParamDesc(const QDomElement d, int pos, int in, int out, bool isEffect = true);
- void slotSliderMoved(int);
- /** \brief Called whenever(?) some parameter is changed in the gui.
+ /** @brief Called whenever(?) some parameter is changed in the gui.
*
* Transfers all Dynamic gui parameter settings into m_params(??) */
void collectAllParameters();