resample
mono
-dynamictext
# Effects need extra GUI to create the resulting melt.xml with the corrected content
videostab
chroma.xml
crop.xml
dust.xml
+dynamictext.xml
freeze.xml
gamma.xml
grain.xml
- multiple choice
- represented by a drop-down menu
- additional parameter attribute:
- - "paramlist": list of possible values separated by comma (no whitespaces!)
+ - "paramlist": list of possible values separated by semicolon (no whitespaces!)
- addtional tag:
- - "paramlistdisplay": (optional) list of names to use for the values
+ - "paramlistdisplay": (optional) list of names to use for the values separated by comma
- "position":
- time stored as frame number
- represented by a slider
- "color":
- - color value, similar to representation HTML ("#rrggbb" or "0xrrggbb")
+ - color value, similar to representation HTML ("#rrggbb"/"#aarrggbb" or "0xrrggbbaa")
- represented by a button opening the KDE color dialog + a color picker button
+ - additional attributes:
+ - "alpha": (default = "0") use to enable alpha support
- "keyframe":
- keyframable number
- keyframes are opt-in (only one keyframe by default -> should be prefered over "constant" whenever possible)
- cubic Bézier spline editor for the frei0r color curves filter (new version, might be reused for other filters)
- "roto-spline":
- GUI for the rotoscoping filter (spline on the monitor)
+ - "keywords":
+ - Text entry with a selection of possible keywords to be inserted in the text.
+ - additional tags:
+ - "keywords": list of possible keyword values separated by semicolon
+ - "keywordsdisplay": list of names to use for the values separated by semicolon
+ - "fontfamily":
+ - Font typeface entry
==========
==========
--- /dev/null
+<!DOCTYPE kpartgui>
+<effect tag="dynamictext" id="dynamictext">
+ <name>Dynamic Text</name>
+ <description>Overlay text with keywords replaced</description>
+ <author>Brian Matherly</author>
+ <parameter type="geometry" name="geometry" default="0%/0%:100%x100%:100" fixed="0">
+ <name>Geometry</name>
+ </parameter>
+ <parameter type="fontfamily" name="family" default="Sans">
+ <name>Font Family</name>
+ </parameter>
+ <parameter type="constant" name="size" max="200" min="8" default="48">
+ <name>Font Size</name>
+ </parameter>
+ <parameter type="constant" name="weight" max="900" min="100" default="400">
+ <name>Font Weight</name>
+ </parameter>
+ <parameter type="color" name="fgcolour" default="0x000000ff" alpha="1">
+ <name>Foreground Color</name>
+ </parameter>
+ <parameter type="color" name="bgcolour" default="0x00000020" alpha="1">
+ <name>Background Color</name>
+ </parameter>
+ <parameter type="color" name="olcolour" default="0x00000000" alpha="1">
+ <name>Outline Color</name>
+ </parameter>
+ <parameter type="constant" name="outline" max="3" min="0" default="0">
+ <name>Outline Width</name>
+ </parameter>
+ <parameter type="constant" name="pad" max="500" min="0" default="0">
+ <name>Padding</name>
+ </parameter>
+ <parameter type="list" name="halign" default="left" paramlist="left;centre;right">
+ <paramlistdisplay>Left,Center,Right</paramlistdisplay>
+ <name>Horizontal Alignment</name>
+ </parameter>
+ <parameter type="list" name="valign" default="top" paramlist="top;middle;bottom">
+ <paramlistdisplay>Top,Middle,Bottom</paramlistdisplay>
+ <name>Vertical Alignment</name>
+ </parameter>
+ <parameter type="keywords" name="argument" default="#timecode#">
+ <name>Text</name>
+ <keywords>#timecode#;#frame#;#filedate#;#meta.media.0.stream.frame_rate#;#meta.media.0.codec.name#;#meta.media.0.codec.bit_rate#;#meta.media.width#;#meta.media.height#;#meta.attr.comment.markup#</keywords>
+ <keywordsdisplay>timecode;frame;file date;source frame rate;source codec;source bit rate;source width;source height;source comment</keywordsdisplay>
+ </parameter>
+</effect>
widgets/wizardextra_ui.ui
widgets/wizardmltcheck_ui.ui
widgets/wizardstandard_ui.ui
+ widgets/keywordval_ui.ui
+ widgets/fontval_ui.ui
)
if(OPENGL_FOUND)
#include <KColorButton>
#include <KLocalizedString>
+static QColor stringToColor(QString strColor)
+{
+ bool ok = false;
+ QColor color("black");
+ int intval = 0;
+
+ if (strColor.startsWith("0x")) {
+ // Format must be 0xRRGGBBAA
+ intval = strColor.toUInt(&ok, 16);
+ color.setRgb( ( intval >> 24 ) & 0xff, // r
+ ( intval >> 16 ) & 0xff, // g
+ ( intval >> 8 ) & 0xff, // b
+ ( intval ) & 0xff ); // a
+ } else if (strColor.startsWith("#") && strColor.length() == 9) {
+ // Format must be #AARRGGBB
+ strColor = strColor.replace('#', "0x");
+ intval = strColor.toUInt(&ok, 16);
+ color.setRgb( ( intval >> 16 ) & 0xff, // r
+ ( intval >> 8 ) & 0xff, // g
+ ( intval ) & 0xff, // b
+ ( intval >> 24 ) & 0xff ); // a
+ } else if (strColor.startsWith("#") && strColor.length() == 7) {
+ // Format must be #RRGGBB
+ strColor = strColor.replace('#', "0x");
+ intval = strColor.toUInt(&ok, 16);
+ color.setRgb( ( intval >> 16 ) & 0xff, // r
+ ( intval >> 8 ) & 0xff, // g
+ ( intval ) & 0xff, // b
+ 0xff ); // a
+ }
+
+ return color;
+}
+
+static QString colorToString(QColor color, bool alpha)
+{
+ QString colorStr;
+ QTextStream stream(&colorStr);
+ stream << "#";
+ stream.setIntegerBase(16);
+ stream.setFieldWidth(2);
+ stream.setFieldAlignment(QTextStream::AlignRight);
+ stream.setPadChar('0');
+ if(alpha)
+ {
+ stream << color.alpha();
+ }
+ stream << color.red() << color.green() << color.blue();
-ChooseColorWidget::ChooseColorWidget(QString text, QColor color, QWidget *parent) :
+ return colorStr;
+}
+
+ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *parent) :
QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->setSpacing(0);
QLabel *label = new QLabel(text, this);
- m_button = new KColorButton(color, this);
+ m_button = new KColorButton(stringToColor(color), this);
m_button->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
ColorPickerWidget *picker = new ColorPickerWidget(this);
connect(m_button, SIGNAL(changed(QColor)), this, SIGNAL(modified()));
}
-QColor ChooseColorWidget::getColor()
+QString ChooseColorWidget::getColor()
+{
+ return colorToString(m_button->color(), m_button->isAlphaChannelEnabled());
+}
+
+void ChooseColorWidget::setAlphaChannelEnabled(bool enabled)
{
- return m_button->color();
+ m_button->setAlphaChannelEnabled(enabled);
}
void ChooseColorWidget::setColor(QColor color)
/** @brief Sets up the widget.
* @param text (optional) What the color will be used for
* @param color (optional) initial color */
- ChooseColorWidget(QString text = QString(), QColor color = QColor(), QWidget* parent = 0);
+ ChooseColorWidget(QString text = QString(), QString color = "0xffffffff", QWidget* parent = 0);
/** @brief Gets the choosen color. */
- QColor getColor();
+ QString getColor();
+ /** @brief Enable the use of alpha channel.
+ * @param enabled (required) whether alpha is enabled or disabled */
+ void setAlphaChannelEnabled(bool enabled);
private:
KColorButton *m_button;
#include "ui_boolval_ui.h"
#include "ui_wipeval_ui.h"
#include "ui_urlval_ui.h"
+#include "ui_keywordval_ui.h"
+#include "ui_fontval_ui.h"
#include "complexparameter.h"
#include "geometryval.h"
#include "positionedit.h"
{
};
+class Keywordval: public QWidget, public Ui::Keywordval_UI
+{
+};
+
+class Fontval: public QWidget, public Ui::Fontval_UI
+{
+};
+
QMap<QString, QImage> EffectStackEdit::iconCache;
EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
m_keyframeEditor->addParameter(pa);
}
} else if (type == "color") {
- if (value.startsWith('#'))
- value = value.replace('#', "0x");
- bool ok;
- ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, QColor(value.toUInt(&ok, 16)), this);
+ ChooseColorWidget *choosecolor = new ChooseColorWidget(paramName, value, this);
+ choosecolor->setAlphaChannelEnabled(pa.attribute("alpha") == "1");
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
connect(cval->urlwidget, SIGNAL(returnPressed()) , this, SLOT(collectAllParameters()));
connect(cval->urlwidget, SIGNAL(urlSelected(const KUrl&)) , this, SLOT(collectAllParameters()));
m_uiItems.append(cval);
+ } else if (type == "keywords") {
+ Keywordval* kval = new Keywordval;
+ kval->setupUi(toFillin);
+ kval->label->setText(paramName);
+ kval->lineeditwidget->setText(value);
+ QDomElement klistelem = pa.firstChildElement("keywords");
+ QDomElement kdisplaylistelem = pa.firstChildElement("keywordsdisplay");
+ QStringList keywordlist;
+ QStringList keyworddisplaylist;
+ if (!klistelem.isNull()) {
+ keywordlist = klistelem.text().split(';');
+ keyworddisplaylist = i18n(kdisplaylistelem.text().toUtf8().data()).split(';');
+ }
+ if (keyworddisplaylist.count() != keywordlist.count()) {
+ keyworddisplaylist = keywordlist;
+ }
+ for (int i = 0; i < keywordlist.count(); i++) {
+ kval->comboboxwidget->addItem(keyworddisplaylist.at(i), keywordlist.at(i));
+ }
+ // Add disabled user prompt at index 0
+ kval->comboboxwidget->insertItem(0, i18n("<select a keyword>"), "");
+ kval->comboboxwidget->model()->setData( kval->comboboxwidget->model()->index(0,0), QVariant(Qt::NoItemFlags), Qt::UserRole -1);
+ kval->comboboxwidget->setCurrentIndex(0);
+ m_valueItems[paramName] = kval;
+ connect(kval->lineeditwidget, SIGNAL(editingFinished()) , this, SLOT(collectAllParameters()));
+ connect(kval->comboboxwidget, SIGNAL(activated (const QString&)), this, SLOT(collectAllParameters()));
+ m_uiItems.append(kval);
+ } else if (type == "fontfamily") {
+ Fontval* fval = new Fontval;
+ fval->setupUi(toFillin);
+ fval->name->setText(paramName);
+ fval->fontfamilywidget->setCurrentFont(QFont(value));
+ m_valueItems[paramName] = fval;
+ connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
+ m_uiItems.append(fval);
} else {
delete toFillin;
toFillin = NULL;
setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
- setValue = choosecolor->getColor().name();
+ setValue = choosecolor->getColor();
} else if (type == "complex") {
ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
namenode.item(i) = complex->getParamDesc();
} else if (type == "url") {
KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
setValue = req->url().path();
+ } else if (type == "keywords"){
+ QLineEdit *line = ((Keywordval*)m_valueItems.value(paramName))->lineeditwidget;
+ QComboBox *combo = ((Keywordval*)m_valueItems.value(paramName))->comboboxwidget;
+ if(combo->currentIndex())
+ {
+ QString comboval = combo->itemData(combo->currentIndex()).toString();
+ line->insert(comboval);
+ combo->setCurrentIndex(0);
+ }
+ setValue = line->text();
+ } else if (type == "fontfamily") {
+ QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
+ setValue = fontfamily->currentFont().family();
}
if (!setValue.isNull())
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Fontval_UI</class>
+ <widget class="QWidget" name="Fontval_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>200</width>
+ <height>60</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout">
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item row="0" column="0">
+ <widget class="QLabel" name="name">
+ <property name="text">
+ <string>TextLabel</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QFontComboBox" name="fontfamilywidget"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Keywordval_UI</class>
+ <widget class="QWidget" name="Keywordval_UI">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>194</width>
+ <height>42</height>
+ </rect>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <property name="verticalSpacing">
+ <number>0</number>
+ </property>
+ <property name="margin">
+ <number>0</number>
+ </property>
+ <item row="0" column="0" colspan="2">
+ <widget class="QLabel" name="label">
+ <property name="text">
+ <string>Param</string>
+ </property>
+ <property name="alignment">
+ <set>Qt::AlignCenter</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QLineEdit" name="lineeditwidget"/>
+ </item>
+ <item row="2" column="0">
+ <widget class="QComboBox" name="comboboxwidget"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>