| Anonymous | Login | Signup for a new account | 2013-05-19 22:51 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | ||||||||
| 0002324 | Kdenlive | Effects | public | 2011-09-21 14:52 | 2011-11-30 06:09 | ||||||||
| Reporter | pez4brian | ||||||||||||
| Assigned To | ttill | ||||||||||||
| Priority | normal | Severity | minor | Reproducibility | N/A | ||||||||
| Status | assigned | Resolution | open | ||||||||||
| Platform | OS | OS Version | |||||||||||
| Product Version | Recent git | ||||||||||||
| Target Version | Fixed in Version | ||||||||||||
| Summary | 0002324: PATCH: Support for new MLT filter "Dynamic Text" | ||||||||||||
| Description | A new filter was recently added to MLT to support the overlay of dynamic text: http://mltframework.org/gitweb/mlt.git?p=mltframework.org/mlt.git;a=commit;h=7f5034480306a8d55e164127f903a27640048373 [^] This filter detects keywords in the provided text and replaces the keywords with information from the stream. The filter supports the following keywords: * #timecode# - timecode of the frame (based on framerate and position) * #frame# - frame number of the frame * #filedate# - modification date of the file Keywords may also be any frame property (e.g. #meta.media.0.codec.frame_rate#) The attached patch adds support in Kdenlive for the textbox, font and color parameters required by the new filter to appear properly in the effect stack. | ||||||||||||
| Additional Information | The filter does not yet support date/timecode on a frame-by-frame basis if that is in the source (eg. DV) because libav will need to provide frame specific context first. However, when that becomes available, it can easily be supported by this new effect. What you can do with this effect (with respect to date) is you can use the #filedate# keyword to overlay the file creation/modification date on the video. This will work well with most file based camcorders that record on SD cards because each file will have a modification date that corresponds to the date it was recorded. | ||||||||||||
| Tags | No tags attached. | ||||||||||||
| Build/Install Method | Manual build from SVN | ||||||||||||
| Attached Files | Index: src/widgets/textval_ui.ui
===================================================================
--- src/widgets/textval_ui.ui (revision 0)
+++ src/widgets/textval_ui.ui (revision 0)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Textval_UI</class>
+ <widget class="QWidget" name="Textval_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>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt (revision 5917)
+++ src/CMakeLists.txt (working copy)
@@ -127,6 +127,10 @@
widgets/archivewidget_ui.ui
widgets/manageencodingprofile_ui.ui
widgets/backupdialog_ui.ui
+ widgets/urlval_ui.ui
+ widgets/textval_ui.ui
+ widgets/fontval_ui.ui
+ widgets/colorval_ui.ui
)
set(kdenlive_SRCS
Index: src/effectstackedit.cpp
===================================================================
--- src/effectstackedit.cpp (revision 5917)
+++ src/effectstackedit.cpp (working copy)
@@ -20,6 +20,9 @@
#include "ui_boolval_ui.h"
#include "ui_wipeval_ui.h"
#include "ui_urlval_ui.h"
+#include "ui_textval_ui.h"
+#include "ui_fontval_ui.h"
+#include "ui_colorval_ui.h"
#include "complexparameter.h"
#include "geometryval.h"
#include "positionedit.h"
@@ -70,6 +73,18 @@
{
};
+class Textval: public QWidget, public Ui::Textval_UI
+{
+};
+
+class Fontval: public QWidget, public Ui::Fontval_UI
+{
+};
+
+class Colorval: public QWidget, public Ui::Colorval_UI
+{
+};
+
QMap<QString, QImage> EffectStackEdit::iconCache;
EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
@@ -534,6 +549,48 @@
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 == "string") {
+ QString widget = pa.attribute("widget");
+ if (widget == "font") {
+ Fontval* fval = new Fontval;
+ // Split the value between font family and size
+ QString family = value;
+ family.replace(QRegExp(" [0-9]*$"), "");
+ QString size = value;
+ size.replace(family, "");
+ QFont f(family, size.toInt());
+ fval->setupUi(toFillin);
+ fval->label->setText(paramName);
+ fval->fontfamilywidget->setCurrentFont(f);
+ fval->fontsizewidget->setValue(f.pointSize());
+ m_valueItems[paramName] = fval;
+ connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
+ connect(fval->fontsizewidget, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters())) ;
+ m_uiItems.append(fval);
+ } else if (widget == "color") {
+ Colorval* cval = new Colorval;
+ cval->setupUi(toFillin);
+ cval->label->setText(paramName);
+ cval->colorwidget->setAlphaChannelEnabled(true);
+ bool ok;
+ int intval = value.toUInt(&ok, 16);
+ QColor color( ( intval >> 24 ) & 0xff, // r
+ ( intval >> 16 ) & 0xff, // g
+ ( intval >> 8 ) & 0xff, // b
+ ( intval ) & 0xff ); // a
+ cval->colorwidget->setColor(color);
+ m_valueItems[paramName] = cval;
+ connect(cval->colorwidget, SIGNAL(changed (const QColor &)), this, SLOT(collectAllParameters()));
+ m_uiItems.append(cval);
+ } else { // (widget == "text") or widget == something else
+ Textval* tval = new Textval;
+ tval->setupUi(toFillin);
+ tval->label->setText(paramName);
+ tval->lineeditwidget->setText(value);
+ m_valueItems[paramName] = tval;
+ connect(tval->lineeditwidget, SIGNAL(editingFinished()) , this, SLOT(collectAllParameters()));
+ m_uiItems.append(tval);
+ }
} else {
delete toFillin;
toFillin = NULL;
@@ -801,6 +858,28 @@
} else if (type == "url") {
KUrlRequester *req = ((Urlval*)m_valueItems.value(paramName))->urlwidget;
setValue = req->url().path();
+ } else if (type == "string") {
+ QDomElement elem = pa.toElement();
+ QString widget = elem.attribute("widget");
+ if (widget == "font") {
+ QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
+ QSpinBox* fontsize = ((Fontval*)m_valueItems.value(paramName))->fontsizewidget;
+ // Combine the font family and size
+ QTextStream(&setValue) << fontfamily->currentFont().family()
+ << " " << fontsize->value();
+ } else if (widget == "color") {
+ KColorButton* colorbutton = ((Colorval*)m_valueItems.value(paramName))->colorwidget;
+ QColor color = colorbutton->color();
+ QTextStream stream(&setValue);
+ stream.setIntegerBase(16);
+ stream.setFieldWidth(2);
+ stream.setFieldAlignment(QTextStream::AlignRight);
+ stream.setPadChar('0');
+ stream << "0x" << color.red() << color.green() << color.blue() << color.alpha();
+ } else { // (widget == "text") or widget == something else
+ QLineEdit *line = ((Textval*)m_valueItems.value(paramName))->lineeditwidget;
+ setValue = line->text();
+ }
}
if (!setValue.isNull())
Index: src/widgets/colorval_ui.ui
===================================================================
--- src/widgets/colorval_ui.ui (revision 0)
+++ src/widgets/colorval_ui.ui (revision 0)
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>Colorval_UI</class>
+ <widget class="QWidget" name="Colorval_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">
+ <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="KColorButton" name="colorwidget">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Minimum" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: src/initeffects.cpp
===================================================================
--- src/initeffects.cpp (revision 5917)
+++ src/initeffects.cpp (working copy)
@@ -455,6 +455,7 @@
if (paramdesc.get("maximum")) params.setAttribute("max", paramdesc.get("maximum"));
if (paramdesc.get("minimum")) params.setAttribute("min", paramdesc.get("minimum"));
+ if (paramdesc.get("widget")) params.setAttribute("widget", paramdesc.get("widget"));
QString paramType = paramdesc.get("type");
Index: src/widgets/fontval_ui.ui
===================================================================
--- src/widgets/fontval_ui.ui (revision 0)
+++ src/widgets/fontval_ui.ui (revision 0)
@@ -0,0 +1,50 @@
+<?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>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="QFontComboBox" name="fontfamilywidget"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="fontsizewidget">
+ <property name="minimum">
+ <number>8</number>
+ </property>
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ <property name="value">
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: effects/dynamictext.xml
===================================================================
--- effects/dynamictext.xml (revision 0)
+++ effects/dynamictext.xml (revision 0)
@@ -0,0 +1,26 @@
+<!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="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>
+ <parameter type="font" name="font" default="Sans 48">
+ <name>Font</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>
+</effect>
Index: effects/CMakeLists.txt
===================================================================
--- effects/CMakeLists.txt (revision 5945)
+++ effects/CMakeLists.txt (working copy)
@@ -10,6 +10,7 @@
chroma.xml
crop.xml
dust.xml
+dynamictext.xml
freeze.xml
gamma.xml
grain.xml
Index: effects/README
===================================================================
--- effects/README (revision 5945)
+++ effects/README (working copy)
@@ -71,15 +71,17 @@
- 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)
@@ -112,6 +114,13 @@
- 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
+ - "font":
+ - Typeface and size entry
==========
==========
Index: src/widgets/fontval_ui.ui
===================================================================
--- src/widgets/fontval_ui.ui (revision 0)
+++ src/widgets/fontval_ui.ui (revision 0)
@@ -0,0 +1,50 @@
+<?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>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="QFontComboBox" name="fontfamilywidget"/>
+ </item>
+ <item row="1" column="1">
+ <widget class="QSpinBox" name="fontsizewidget">
+ <property name="minimum">
+ <number>8</number>
+ </property>
+ <property name="maximum">
+ <number>1000</number>
+ </property>
+ <property name="value">
+ <number>20</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: src/widgets/keywordval_ui.ui
===================================================================
--- src/widgets/keywordval_ui.ui (revision 0)
+++ src/widgets/keywordval_ui.ui (revision 0)
@@ -0,0 +1,40 @@
+<?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>
Index: src/effectstackedit.cpp
===================================================================
--- src/effectstackedit.cpp (revision 5945)
+++ src/effectstackedit.cpp (working copy)
@@ -20,6 +20,8 @@
#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"
@@ -70,8 +72,51 @@
{
};
+class Keywordval: public QWidget, public Ui::Keywordval_UI
+{
+};
+
+class Fontval: public QWidget, public Ui::Fontval_UI
+{
+};
+
+
QMap<QString, QImage> EffectStackEdit::iconCache;
+static QColor ParseColor(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;
+}
+
EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
QScrollArea(parent),
m_in(0),
@@ -391,10 +436,11 @@
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, ParseColor(value), this);
+ if( pa.attribute("alpha") == "1" )
+ {
+ choosecolor->setAlphaChannelEnabled(true);
+ }
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
@@ -534,6 +580,50 @@
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(';');
+ }
+ if (!klistelem.isNull()) {
+ 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, "<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 == "font") {
+ Fontval* fval = new Fontval;
+ // Split the value between font family and size
+ QString family = value;
+ family.replace(QRegExp(" [0-9]*$"), "");
+ QString size = value;
+ size.replace(family, "");
+ QFont f(family, size.toInt());
+ fval->setupUi(toFillin);
+ fval->label->setText(paramName);
+ fval->fontfamilywidget->setCurrentFont(f);
+ fval->fontsizewidget->setValue(f.pointSize());
+ m_valueItems[paramName] = fval;
+ connect(fval->fontfamilywidget, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(collectAllParameters())) ;
+ connect(fval->fontsizewidget, SIGNAL(valueChanged(int)), this, SLOT(collectAllParameters())) ;
+ m_uiItems.append(fval);
} else {
delete toFillin;
toFillin = NULL;
@@ -685,7 +775,18 @@
setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
- setValue = choosecolor->getColor().name();
+ QColor color = choosecolor->getColor();
+ QTextStream stream(&setValue);
+ stream << "#";
+ stream.setIntegerBase(16);
+ stream.setFieldWidth(2);
+ stream.setFieldAlignment(QTextStream::AlignRight);
+ stream.setPadChar('0');
+ if( choosecolor->isAlphaChannelEnabled() )
+ {
+ stream << color.alpha();
+ }
+ stream << color.red() << color.green() << color.blue();
} else if (type == "complex") {
ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
namenode.item(i) = complex->getParamDesc();
@@ -801,6 +902,22 @@
} 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 == "font") {
+ QFontComboBox* fontfamily = ((Fontval*)m_valueItems.value(paramName))->fontfamilywidget;
+ QSpinBox* fontsize = ((Fontval*)m_valueItems.value(paramName))->fontsizewidget;
+ // Combine the font family and size
+ QTextStream(&setValue) << fontfamily->currentFont().family()
+ << " " << fontsize->value();
}
if (!setValue.isNull())
Index: src/choosecolorwidget.h
===================================================================
--- src/choosecolorwidget.h (revision 5945)
+++ src/choosecolorwidget.h (working copy)
@@ -43,6 +43,8 @@
/** @brief Gets the choosen color. */
QColor getColor();
+ void setAlphaChannelEnabled(bool enabled);
+ bool isAlphaChannelEnabled();
private:
KColorButton *m_button;
Index: src/choosecolorwidget.cpp
===================================================================
--- src/choosecolorwidget.cpp (revision 5945)
+++ src/choosecolorwidget.cpp (working copy)
@@ -53,6 +53,17 @@
return m_button->color();
}
+void ChooseColorWidget::setAlphaChannelEnabled(bool enabled)
+{
+ m_button->setAlphaChannelEnabled(enabled);
+}
+
+bool ChooseColorWidget::isAlphaChannelEnabled()
+{
+ return m_button->isAlphaChannelEnabled();
+}
+
+
void ChooseColorWidget::setColor(QColor color)
{
m_button->setColor(color);
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt (revision 5945)
+++ src/CMakeLists.txt (working copy)
@@ -127,6 +127,8 @@
widgets/archivewidget_ui.ui
widgets/manageencodingprofile_ui.ui
widgets/backupdialog_ui.ui
+ widgets/keywordval_ui.ui
+ widgets/fontval_ui.ui
)
set(kdenlive_SRCS
Index: data/blacklisted_effects.txt
===================================================================
--- data/blacklisted_effects.txt (revision 5945)
+++ data/blacklisted_effects.txt (working copy)
@@ -97,7 +97,6 @@
resample
mono
-dynamictext
# Effects need extra GUI to create the resulting melt.xml with the result
videostab
### Eclipse Workspace Patch 1.0
#P kdenlive
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt (revision 5975)
+++ src/CMakeLists.txt (working copy)
@@ -127,6 +127,8 @@
widgets/archivewidget_ui.ui
widgets/manageencodingprofile_ui.ui
widgets/backupdialog_ui.ui
+ widgets/keywordval_ui.ui
+ widgets/fontval_ui.ui
)
set(kdenlive_SRCS
Index: src/choosecolorwidget.h
===================================================================
--- src/choosecolorwidget.h (revision 5975)
+++ src/choosecolorwidget.h (working copy)
@@ -43,6 +43,8 @@
/** @brief Gets the choosen color. */
QColor getColor();
+ void setAlphaChannelEnabled(bool enabled);
+ bool isAlphaChannelEnabled();
private:
KColorButton *m_button;
Index: src/effectstackedit.cpp
===================================================================
--- src/effectstackedit.cpp (revision 5975)
+++ src/effectstackedit.cpp (working copy)
@@ -20,6 +20,8 @@
#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"
@@ -70,8 +72,51 @@
{
};
+class Keywordval: public QWidget, public Ui::Keywordval_UI
+{
+};
+
+class Fontval: public QWidget, public Ui::Fontval_UI
+{
+};
+
+
QMap<QString, QImage> EffectStackEdit::iconCache;
+static QColor ParseColor(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;
+}
+
EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
QScrollArea(parent),
m_in(0),
@@ -391,10 +436,11 @@
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, ParseColor(value), this);
+ if( pa.attribute("alpha") == "1" )
+ {
+ choosecolor->setAlphaChannelEnabled(true);
+ }
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
@@ -534,6 +580,42 @@
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(';');
+ }
+ if (!klistelem.isNull()) {
+ 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, "<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->label->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;
@@ -685,7 +767,18 @@
setValue = box->checkState() == Qt::Checked ? "1" : "0" ;
} else if (type == "color") {
ChooseColorWidget *choosecolor = ((ChooseColorWidget*)m_valueItems.value(paramName));
- setValue = choosecolor->getColor().name();
+ QColor color = choosecolor->getColor();
+ QTextStream stream(&setValue);
+ stream << "#";
+ stream.setIntegerBase(16);
+ stream.setFieldWidth(2);
+ stream.setFieldAlignment(QTextStream::AlignRight);
+ stream.setPadChar('0');
+ if( choosecolor->isAlphaChannelEnabled() )
+ {
+ stream << color.alpha();
+ }
+ stream << color.red() << color.green() << color.blue();
} else if (type == "complex") {
ComplexParameter *complex = ((ComplexParameter*)m_valueItems.value(paramName));
namenode.item(i) = complex->getParamDesc();
@@ -801,6 +894,19 @@
} 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())
Index: effects/README
===================================================================
--- effects/README (revision 5975)
+++ effects/README (working copy)
@@ -71,15 +71,17 @@
- 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)
@@ -112,6 +114,13 @@
- 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
==========
==========
Index: src/widgets/keywordval_ui.ui
===================================================================
--- src/widgets/keywordval_ui.ui (revision 0)
+++ src/widgets/keywordval_ui.ui (revision 0)
@@ -0,0 +1,40 @@
+<?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>
Index: src/choosecolorwidget.cpp
===================================================================
--- src/choosecolorwidget.cpp (revision 5975)
+++ src/choosecolorwidget.cpp (working copy)
@@ -54,6 +54,17 @@
return m_button->color();
}
+void ChooseColorWidget::setAlphaChannelEnabled(bool enabled)
+{
+ m_button->setAlphaChannelEnabled(enabled);
+}
+
+bool ChooseColorWidget::isAlphaChannelEnabled()
+{
+ return m_button->isAlphaChannelEnabled();
+}
+
+
void ChooseColorWidget::setColor(QColor color)
{
m_button->setColor(color);
Index: src/widgets/fontval_ui.ui
===================================================================
--- src/widgets/fontval_ui.ui (revision 0)
+++ src/widgets/fontval_ui.ui (revision 0)
@@ -0,0 +1,37 @@
+<?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>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="1">
+ <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="QFontComboBox" name="fontfamilywidget"/>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Index: effects/dynamictext.xml
===================================================================
--- effects/dynamictext.xml (revision 0)
+++ effects/dynamictext.xml (revision 0)
@@ -0,0 +1,46 @@
+<!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="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>
+ <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>
+</effect>
Index: data/blacklisted_effects.txt
===================================================================
--- data/blacklisted_effects.txt (revision 5975)
+++ data/blacklisted_effects.txt (working copy)
@@ -97,7 +97,6 @@
resample
mono
-dynamictext
# Effects need extra GUI to create the resulting melt.xml with the result
videostab
Index: effects/CMakeLists.txt
===================================================================
--- effects/CMakeLists.txt (revision 5975)
+++ effects/CMakeLists.txt (working copy)
@@ -10,6 +10,7 @@
chroma.xml
crop.xml
dust.xml
+dynamictext.xml
freeze.xml
gamma.xml
grain.xml
### Eclipse Workspace Patch 1.0
#P kdenlive
Index: src/CMakeLists.txt
===================================================================
--- src/CMakeLists.txt (revision 6010)
+++ src/CMakeLists.txt (working copy)
@@ -127,6 +127,8 @@
widgets/archivewidget_ui.ui
widgets/manageencodingprofile_ui.ui
widgets/backupdialog_ui.ui
+ widgets/keywordval_ui.ui
+ widgets/fontval_ui.ui
)
set(kdenlive_SRCS
Index: src/choosecolorwidget.h
===================================================================
--- src/choosecolorwidget.h (revision 6010)
+++ src/choosecolorwidget.h (working copy)
@@ -39,10 +39,13 @@
/** @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;
Index: src/effectstackedit.cpp
===================================================================
--- src/effectstackedit.cpp (revision 6010)
+++ src/effectstackedit.cpp (working copy)
@@ -20,6 +20,8 @@
#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"
@@ -70,6 +72,14 @@
{
};
+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) :
@@ -391,10 +401,11 @@
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);
+ if( pa.attribute("alpha") == "1" )
+ {
+ choosecolor->setAlphaChannelEnabled(true);
+ }
m_vbox->addWidget(choosecolor);
m_valueItems[paramName] = choosecolor;
connect(choosecolor, SIGNAL(displayMessage(const QString&, int)), this, SIGNAL(displayMessage(const QString&, int)));
@@ -534,6 +545,42 @@
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(';');
+ }
+ if (!klistelem.isNull()) {
+ 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, "<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;
@@ -685,7 +732,7 @@
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();
@@ -801,6 +848,19 @@
} 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())
Index: effects/README
===================================================================
--- effects/README (revision 6010)
+++ effects/README (working copy)
@@ -71,15 +71,17 @@
- 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)
@@ -112,6 +114,13 @@
- 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
==========
==========
Index: src/widgets/keywordval_ui.ui
===================================================================
--- src/widgets/keywordval_ui.ui (revision 0)
+++ src/widgets/keywordval_ui.ui (revision 0)
@@ -0,0 +1,40 @@
+<?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>
Index: src/choosecolorwidget.cpp
===================================================================
--- src/choosecolorwidget.cpp (revision 6010)
+++ src/choosecolorwidget.cpp (working copy)
@@ -27,8 +27,59 @@
#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;
+}
-ChooseColorWidget::ChooseColorWidget(QString text, QColor color, QWidget *parent) :
+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();
+
+ return colorStr;
+}
+
+ChooseColorWidget::ChooseColorWidget(QString text, QString color, QWidget *parent) :
QWidget(parent)
{
QHBoxLayout *layout = new QHBoxLayout(this);
@@ -36,7 +87,7 @@
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);
@@ -49,11 +100,16 @@
connect(m_button, SIGNAL(changed(QColor)), this, SIGNAL(modified()));
}
-QColor ChooseColorWidget::getColor()
+QString ChooseColorWidget::getColor()
{
- return m_button->color();
+ return colorToString(m_button->color(), m_button->isAlphaChannelEnabled());
}
+void ChooseColorWidget::setAlphaChannelEnabled(bool enabled)
+{
+ m_button->setAlphaChannelEnabled(enabled);
+}
+
void ChooseColorWidget::setColor(QColor color)
{
m_button->setColor(color);
Index: src/widgets/fontval_ui.ui
===================================================================
--- src/widgets/fontval_ui.ui (revision 0)
+++ src/widgets/fontval_ui.ui (revision 0)
@@ -0,0 +1,34 @@
+<?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>
Index: effects/dynamictext.xml
===================================================================
--- effects/dynamictext.xml (revision 0)
+++ effects/dynamictext.xml (revision 0)
@@ -0,0 +1,46 @@
+<!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="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>
+ <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>
+</effect>
Index: data/blacklisted_effects.txt
===================================================================
--- data/blacklisted_effects.txt (revision 6010)
+++ data/blacklisted_effects.txt (working copy)
@@ -97,7 +97,6 @@
resample
mono
-dynamictext
# Effects need extra GUI to create the resulting melt.xml with the result
videostab
Index: effects/CMakeLists.txt
===================================================================
--- effects/CMakeLists.txt (revision 6010)
+++ effects/CMakeLists.txt (working copy)
@@ -10,6 +10,7 @@
chroma.xml
crop.xml
dust.xml
+dynamictext.xml
freeze.xml
gamma.xml
grain.xml
| ||||||||||||
Notes |
|
|
(0007347) pez4brian (developer) 2011-09-22 05:12 |
The attached screenshot shows the effect in action. Each of the 4 text blocks is created with a separate instance of the dynamic text effect. The affect is applied to the track, so if there were multiple clips in the track, the text would be automatically updated to match the properties of the clip. This issue can be related to: 0001597, 0000643 and 0001588 |
|
(0007411) pez4brian (developer) 2011-10-06 05:20 |
I have attached a new patch and screen shot dated 20111005. The new patch supersedes the previous patche. The new patch resolves the following comments: * Please add an XML effect description (see the xml files in effects/ and effects/README). This will make the parameter names translatable. Done in new patch * It would also be possible then to add a comment about the meaning of the keywords (see SOP/Sat effect for an example). Added a combobox from which keywords can be chosen. The keywords are chosen based on a friendly, translatable string which is in the XML effect description. * Additionally for the geometry parameter the keyframe functionality can be hidden. I have left the keyframe functionality enabled so that the text can be animated (at least alpha and position). This allows the user to configure the text in such a way that it moves across the screen, or fades out. * Please also use the already existing color widget (type "color"). Done. I had to add alpha capability to the existing widget. The patch is against SVN r5945. Please let me know if you have any further comments. |
|
(0007456) pez4brian (developer) 2011-10-22 04:46 |
I have attached a new patch dated 20111021. The new patch supersedes the previous patch. The new patch includes the following modifications: * Support the changed properties for mlt's pango_producer in git HEAD. The functionality is exactly the same. * Add support for text outline. The patch is against SVN r5975. Please let me know if you have any comments. |
|
(0007474) ttill (developer) 2011-10-30 00:44 |
Thanks for keeping the patch up to date! For the font parameter GUI one line should be sufficient, I guess. It would then tie in better with the other parameters' GUIs. Additionally the color string to QColor (and vice versa) conversation code should become a private member of ChooseColorWidget (I don't see it being used anywhere else). Let me know what you think about these ideas. |
|
(0007478) pez4brian (developer) 2011-10-31 02:26 |
Great ideas. They both sound good to me. Please see the latest patch and screenshot files dated 20111030. Let me know what you think. |
|
(0007600) pez4brian (developer) 2011-11-20 23:18 |
Till, Have you had any further thoughts on this? Please let me know if you require any other changes for this to be accepted into Kdenlive. Thanks, ~Brian |
|
(0007604) ttill (developer) 2011-11-21 16:32 |
Sorry, I'm currently really busy. I will try to push it tomorrow. |
|
(0007624) ttill (developer) 2011-11-24 14:55 edited on: 2011-11-24 14:55 |
I committed a slightly modified version of your patch on Tuesday: http://quickgit.kde.org/?p=kdenlive.git&a=commit&h=0d8de4d8262a6f5d0bfb716c7e408ba26e200cb7 [^] Thanks a lot for all your work! Could it be possible to get a timecode/framecount relative to the clip the filter is used on? What's the advantage of being able to set the size of the surrounding rect and then align the text inside? |
|
(0007640) pez4brian (developer) 2011-11-30 06:09 |
Till, Thanks for applying the patch. RE: "Could it be possible to get a timecode/framecount relative to the clip the filter is used on?" I can interpret that question two ways: 1) If you mean "show '1' to indicate the first frame of a clip (even if the clip is in the middle of the timeline"... that would require some changes to the dynamic text filter and probably to the MLT framework. Currently, the frame only provides its position among all frames in the timeline. I'm sure it could be added. If this is something you are interested in, let me know and I will look into it. 2) If you mean "display the date and time code embedded in the original clip - such as that provided in DV"... my goal is to eventually get there. My understanding is that currently libav does not provide per-frame metadata. I hope to look into that in the future. RE: "What's the advantage of being able to set the size of the surrounding rect and then align the text inside?" I use it to align the text in the frame. Keep in mind that since the text is dynamic, its length and even the number of characters could change from one frame to the next. So, to ensure that the text is always centered, I make the rectangle exactly the size of the frame. Then, I set the alignment to center the text horizontally. That way, no matter how long the text is, it will always be centered in the frame. The same logic can apply for vertical alignment. Thanks again, ~Brian |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2011-09-21 14:52 | pez4brian | New Issue | |
| 2011-09-21 14:52 | pez4brian | File Added: dynamictext_effect_1.patch.txt | |
| 2011-09-22 05:08 | pez4brian | File Added: dynamic_text_screenshot.png | |
| 2011-09-22 05:12 | pez4brian | Note Added: 0007347 | |
| 2011-09-22 13:25 | ttill | Assigned To | => ttill |
| 2011-09-22 13:25 | ttill | Status | new => assigned |
| 2011-10-06 05:14 | pez4brian | File Added: dynamictext_patch_20111005.txt | |
| 2011-10-06 05:14 | pez4brian | File Added: dynamictext_screenshot_20111005.png | |
| 2011-10-06 05:20 | pez4brian | Note Added: 0007411 | |
| 2011-10-22 04:41 | pez4brian | File Added: dyanmictext_patch_20111021.txt | |
| 2011-10-22 04:46 | pez4brian | Note Added: 0007456 | |
| 2011-10-30 00:44 | ttill | Note Added: 0007474 | |
| 2011-10-31 02:24 | pez4brian | File Added: dyanmictext_patch_20111030.txt | |
| 2011-10-31 02:24 | pez4brian | File Added: dynamictext_screenshot_20111030.png | |
| 2011-10-31 02:26 | pez4brian | Note Added: 0007478 | |
| 2011-11-20 23:18 | pez4brian | Note Added: 0007600 | |
| 2011-11-21 16:32 | ttill | Note Added: 0007604 | |
| 2011-11-24 14:55 | ttill | Note Added: 0007624 | |
| 2011-11-24 14:55 | ttill | Note Edited: 0007624 | View Revisions |
| 2011-11-30 06:09 | pez4brian | Note Added: 0007640 | |
| Copyright © 2000 - 2013 MantisBT Team |



