include(FindGettext)
include(MacroOptionalAddSubdirectory)
set(catalogname kdenlive)
-find_package(Qt COMPONENTS QtOpenGL)
+
+find_package(Qt4 COMPONENTS QtCore QtGui QtOpenGL QtScript REQUIRED)
if ( NOT QT_QTOPENGL_FOUND )
message(FATAL_ERROR "QtOpenGL (most likely called libqt4-opengl-dev) not found.")
else ( NOT QT_QTOPENGL_FOUND )
message(-- " Found QtOpenGL.")
endif ( NOT QT_QTOPENGL_FOUND )
-find_library(Qt COMPONENTS QtOpenGL REQUIRED)
-
-find_library(Qt COMPONENTS QtScript REQUIRED)
+find_library(Qt COMPONENTS QtOpenGL QtScript REQUIRED)
add_definitions(${QT_DEFINITIONS})
<text>Colour</text>
</group>
<group list="frei0r.letterb0xed,pan_zoom,frei0r.scale0tilt,crop,affine,affinerotate">
- <text>Crop & transform</text>
+ <text>Crop and transform</text>
</group>
<group list="volume,normalise,gain,ladspa.1049,ladspa.1048,ladspa.1413,mute">
<text>Audio correction</text>
<group list="burningtv,charcoal,dust,grain,lines,lightgraffiti,oldfilm,vignette">
<text>Fun</text>
</group>
- <group list="boxblur,obscure,autotrack_rectangle,frei0r.squareblur,frei0r.glow">
- <text>Blur & hide</text>
+ <group list="boxblur,obscure,autotrack_rectangle,frei0r.squareblur,frei0r.glow,frei0r.IIRblur">
+ <text>Blur and hide</text>
</group>
<group list="speed,freeze">
<text>Motion</text>
<name>Pan</name>
<description>Adjust the left/right spread of a channel</description>
<author>Dan Dennedy</author>
- <parameter type="list" name="channel" default="0" paramlist="0,1">
+ <parameter type="list" name="channel" default="0" paramlist="0;1">
<paramlistdisplay>Left,Right</paramlistdisplay>
<name>Channel</name>
</parameter>
<name>Mono to stereo</name>
<description>Copy one channel to another</description>
<author>Dan Dennedy</author>
- <parameter type="list" name="from" default="0" paramlist="0,1">
+ <parameter type="list" name="from" default="0" paramlist="0;1">
<paramlistdisplay>Left,Right</paramlistdisplay>
<name>From</name>
</parameter>
- <parameter type="list" name="to" default="1" paramlist="0,1">
+ <parameter type="list" name="to" default="1" paramlist="0;1">
<paramlistdisplay>Left,Right</paramlistdisplay>
<name>To</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.alpha0ps" id="frei0r.alpha0ps">
+<effect LC_NUMERIC="C" tag="frei0r.alpha0ps" id="frei0r.alpha0ps">
<name>Alpha operations</name>
<description>Display and manipulation of the alpha channel</description>
<author>Marko Cebokli</author>
- <parameter type="list" name="Display" default="0.0" paramlist="0.0,0.21,0.36,0.50,0.64,0.79,1.0">
+ <parameter type="list" name="Display" default="0.0" paramlist="0.0;0.21;0.36;0.50;0.64;0.79;1.0">
<paramlistdisplay>Image,Alpha as gray,Gray + red,Selection on black,Selection on gray,Selection on white,Selection on checkers</paramlistdisplay>
<name>Display</name>
</parameter>
<name>Display input alpha</name>
</parameter>
- <parameter type="list" name="Operation" default="0.0" paramlist="0.0,0.21,0.36,0.50,0.64,0.79,1.0">
+ <parameter type="list" name="Operation" default="0.0" paramlist="0.0;0.21;0.36;0.50;0.64;0.79;1.0">
<paramlistdisplay>NO OP,Shave,Shrink hard,Shrink soft,Grow hard,Grow soft,Threshold</paramlistdisplay>
<name>Operation</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.alphagrad" id="frei0r.alphagrad">
+<effect LC_NUMERIC="C" tag="frei0r.alphagrad" id="frei0r.alphagrad">
<name>Alpha gradient</name>
<description>Fill the alpha channel with a specified gradient</description>
<author>Marko Cebokli</author>
<name>Max</name>
</parameter>
- <parameter type="list" name="Operation" default="0.0" paramlist="0.0,0.3,0.5,0.7,1.0">
+ <parameter type="list" name="Operation" default="0.0" paramlist="0.0;0.3;0.5;0.7;1.0">
<paramlistdisplay>Write on clear,Max,Min,Add,Subtract</paramlistdisplay>
<name>Operation</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.alphaspot" id="frei0r.alphaspot">
+<effect LC_NUMERIC="C" tag="frei0r.alphaspot" id="frei0r.alphaspot">
<name>Alpha shapes</name>
<description>Draws simple shapes into the alpha channel</description>
<author>Marko Cebokli</author>
- <parameter type="list" name="Shape" default="0.0" paramlist="0.0,0.38,0.62,1.0">
+ <parameter type="list" name="Shape" default="0.0" paramlist="0.0;0.38;0.62;1.0">
<paramlistdisplay>Rectangle,Ellipse,Triangle,Diamond</paramlistdisplay>
<name>Shape</name>
</parameter>
<name>Max</name>
</parameter>
- <parameter type="list" name="Operation" default="0.0" paramlist="0.0,0.3,0.5,0.7,1.0">
+ <parameter type="list" name="Operation" default="0.0" paramlist="0.0;0.3;0.5;0.7;1.0">
<paramlistdisplay>Write on clear,Max,Min,Add,Subtract</paramlistdisplay>
<name>Operation</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.curves" id="frei0r.bezier_curves" version="0.2">
+<effect LC_NUMERIC="C" tag="frei0r.curves" id="frei0r.bezier_curves" version="0.2">
<name>Bézier Curves</name>
<description>Color curves adjustment</description>
<author>Till Theato, Maksim Golovkin</author>
- <parameter type="list" name="Channel" default="0.5" paramlist="0.5,0,0.1,0.2,0.3,0.4,0.6,0.71">
+ <parameter type="list" name="Channel" default="0.5" paramlist="0.5;0;0.1;0.2;0.3;0.4;0.6;0.71">
<paramlistdisplay>RGB,Red,Green,Blue,Alpha,Luma,Hue,Saturation</paramlistdisplay>
<name>Channel</name>
</parameter>
- <parameter type="list" name="Luma formula" default="1" paramlist="0,1">
+ <parameter type="list" name="Luma formula" default="1" paramlist="0;1">
<paramlistdisplay>Rec. 601,Rec. 709</paramlistdisplay>
<name>Luma formula</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.c0rners" id="frei0r.c0rners">
+<effect LC_NUMERIC="C" tag="frei0r.c0rners" id="frei0r.c0rners">
<name>Corners</name>
<description>Four corners geometry engine</description>
<author>Marko Cebokli</author>
<name>Enable Stretch</name>
</parameter>
- <parameter type="list" name="Interpolator" default="0.166" paramlist="0,0.166,0.333,0.5,0.666,0.833,1.0">
+ <parameter type="list" name="Interpolator" default="0.166" paramlist="0;0.166;0.333;0.5;0.666;0.833;1.0">
<paramlistdisplay>Nearest neighbor,Bilinear,Bicubic smooth,Bicubic sharp,Spline 4x4,Spline 6x6,Lanczos</paramlistdisplay>
<name>Interpolator</name>
</parameter>
<name>Transparent Background</name>
</parameter>
- <parameter type="list" name="Alpha operation" default="0.0" paramlist="0.0,0.3,0.5,0.7,1.0">
+ <parameter type="list" name="Alpha operation" default="0.0" paramlist="0.0;0.3;0.5;0.7;1.0">
<paramlistdisplay>Write on clear,Maximum,Minimum,Add,Subtract</paramlistdisplay>
<name>Alpha operation</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.coloradj_RGB" id="frei0r.coloradj_RGB">
+<effect LC_NUMERIC="C" tag="frei0r.coloradj_RGB" id="frei0r.coloradj_RGB">
<name>RGB adjustment</name>
<description>Simple color adjustment</description>
<author>Marko Cebokli</author>
<name>B</name>
</parameter>
- <parameter type="list" name="Action" default="0.5" paramlist="0.0,0.5,1.0">
+ <parameter type="list" name="Action" default="0.5" paramlist="0.0;0.5;1.0">
<paramlistdisplay>Add constant,Change gamma,Multiply</paramlistdisplay>
<name>Action</name>
</parameter>
<name>Alpha controlled</name>
</parameter>
- <parameter type="list" name="Luma formula" default="1.0" paramlist="0.0,1.0">
+ <parameter type="list" name="Luma formula" default="1.0" paramlist="0.0;1.0">
<paramlistdisplay>Rec. 601,Rec. 709</paramlistdisplay>
<name>Luma formula</name>
</parameter>
<name>Curves</name>
<description>Color curves adjustment</description>
<author>Maksim Golovkin</author>
- <parameter type="list" name="Channel" default="0" paramlist="0,1,2,3">
+ <parameter type="list" name="Channel" default="0" paramlist="0;1;2;3">
<paramlistdisplay>Red,Green,Blue,Luma</paramlistdisplay>
<name>Channel</name>
</parameter>
<parameter type="bool" name="Show curves" default="0">
<name>Show graph in picture</name>
</parameter>
- <parameter type="list" name="Graph position" default="3" paramlist="0,1,2,3">
+ <parameter type="list" name="Graph position" default="3" paramlist="0;1;2;3">
<paramlistdisplay>Top Left,Top Right,Bottom Left,Bottom Right</paramlistdisplay>
<name>Graph position</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.defish0r" id="frei0r.defish0r">
+<effect LC_NUMERIC="C" tag="frei0r.defish0r" id="frei0r.defish0r">
<name>Defish</name>
<description>Non rectilinear lens mappings</description>
<author>Marko Cebokli</author>
<parameter type="bool" name="DeFish" default="1">
<name>DeFish</name>
</parameter>
- <parameter type="list" name="Type" default="0.666" paramlist="0,0.333,0.666,1.0">
+ <parameter type="list" name="Type" default="0.666" paramlist="0;0.333;0.666;1.0">
<paramlistdisplay>Equidistant,Orthographic,Equiarea,Stereographic</paramlistdisplay>
<name>Type</name>
</parameter>
- <parameter type="list" name="Scaling" default="0" paramlist="0,0.333,0.666,1.0">
+ <parameter type="list" name="Scaling" default="0" paramlist="0;0.333;0.666;1.0">
<paramlistdisplay>Fill,Center,Fit,Manual</paramlistdisplay>
<name>Scaling</name>
</parameter>
<parameter type="constant" name="Manual Scale" default="500" min="0" max="1000" factor="1000">
<name>Manual Scale</name>
</parameter>
- <parameter type="list" name="Interpolator" default="0.166" paramlist="0,0.166,0.333,0.5,0.666,0.833,1.0">
+ <parameter type="list" name="Interpolator" default="0.166" paramlist="0;0.166;0.333;0.5;0.666;0.833;1.0">
<paramlistdisplay>Nearest neighbor,Bilinear,Bicubic smooth,Bicubic sharp,Spline 4x4,Spline 6x6,Lanczos</paramlistdisplay>
<name>Interpolator</name>
</parameter>
- <parameter type="list" name="Aspect type" default="0" paramlist="0,0.25,0.5,0.75,1.0">
+ <parameter type="list" name="Aspect type" default="0" paramlist="0;0.25;0.5;0.75;1.0">
<paramlistdisplay>Square,PAL DV,NTSC DV,HDV,Manual</paramlistdisplay>
<name>Aspect type</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.facedetect" id="frei0r.facedetect">
+<effect LC_NUMERIC="C" tag="frei0r.facedetect" id="frei0r.facedetect">
<name>Face detect</name>
<description>Detect faces and draw shapes on them using OpenCV</description>
<author>binarymillenium, Dan Dennedy</author>
<comment>How often to detect a face. In between checks, it does object motion tracking.</comment>
</parameter>
- <parameter type="list" name="Shape" default="0.0" paramlist="0.0,0.1,0.2,1.0">
+ <parameter type="list" name="Shape" default="0.0" paramlist="0.0;0.1;0.2;1.0">
<paramlistdisplay>circle,ellipse,rectangle,random</paramlistdisplay>
<name>Shape</name>
</parameter>
<name>Levels</name>
<description>Adjust levels</description>
<author>Maksim Golovkin</author>
- <parameter type="list" name="Channel" default="3" paramlist="0,1,2,3">
+ <parameter type="list" name="Channel" default="3" paramlist="0;1;2;3">
<paramlistdisplay>Red,Green,Blue,Luma</paramlistdisplay>
<name>Channel</name>
</parameter>
<parameter type="bool" name="Show histogram" default="0">
<name>Show histogram</name>
</parameter>
- <parameter type="list" name="Histogram position" default="3" paramlist="0,1,2,3">
+ <parameter type="list" name="Histogram position" default="3" paramlist="0;1;2;3">
<paramlistdisplay>Top Left,Top Right,Bottom Left,Bottom Right</paramlistdisplay>
<name>Histogram position</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.pr0be" id="frei0r.pr0be">
+<effect LC_NUMERIC="C" tag="frei0r.pr0be" id="frei0r.pr0be">
<name>pr0be</name>
<description>Measure video values</description>
<author>Marko Cebokli</author>
- <parameter type="list" name="Measurement" default="0.0" paramlist="0.0,0.3,0.5,0.7,1.0">
+ <parameter type="list" name="Measurement" default="0.0" paramlist="0.0;0.3;0.5;0.7;1.0">
<paramlistdisplay>RGB,Y'PbPr - rec. 601,Y'PbPr - rec. 709,HSV,HSL</paramlistdisplay>
<name>Measurement</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.pr0file" id="frei0r.pr0file">
+<effect LC_NUMERIC="C" tag="frei0r.pr0file" id="frei0r.pr0file">
<name>pr0file</name>
<description>2D video oscilloscope</description>
<author>Marko Cebokli</author>
<name>Length</name>
</parameter>
- <parameter type="list" name="Channel" default="0.5" paramlist="0.0,0.2,0.4,0.5,0.6,0.8,1.0">
+ <parameter type="list" name="Channel" default="0.5" paramlist="0.0;0.2;0.4;0.5;0.6;0.8;1.0">
<paramlistdisplay>R,G,B,Y',Pr,Pb,Alpha</paramlistdisplay>
<name>Channel</name>
</parameter>
<name>256 scale</name>
</parameter>
- <parameter type="list" name="Color" default="0.0" paramlist="0.0,1.0">
+ <parameter type="list" name="Color" default="0.0" paramlist="0.0;1.0">
<paramlistdisplay>CCIR rec. 601,CCIR rec. 709</paramlistdisplay>
<name>Color</name>
</parameter>
<!DOCTYPE kpartgui>
-<effect tag="frei0r.select0r" id="frei0r.select0r">
+<effect LC_NUMERIC="C" tag="frei0r.select0r" id="frei0r.select0r">
<name>Color Selection</name>
<description>Color based alpha selection</description>
<author>Marko Cebokli</author>
<name>Delta B / I / I</name>
</parameter>
- <parameter type="list" name="Selection subspace" default="0.0" paramlist="0.0,0.5,1.0">
+ <parameter type="list" name="Selection subspace" default="0.0" paramlist="0.0;0.5;1.0">
<paramlistdisplay>RGB,ABI,HCI</paramlistdisplay>
<name>Selection subspace</name>
</parameter>
- <parameter type="list" name="Subspace shape" default="0.0" paramlist="0.0,0.5,1.0">
+ <parameter type="list" name="Subspace shape" default="0.0" paramlist="0.0;0.5;1.0">
<paramlistdisplay>Box,Ellipsoid,Diamond</paramlistdisplay>
<name>Subspace shape</name>
</parameter>
- <parameter type="list" name="Edge mode" default="0.0" paramlist="0.0,0.35,0.60,1.0">
+ <parameter type="list" name="Edge mode" default="0.0" paramlist="0.0;0.35;0.60;1.0">
<paramlistdisplay>Hard,Fat,Normal,Skinny</paramlistdisplay>
<name>Edge mode</name>
</parameter>
- <parameter type="list" name="Operation" default="0.0" paramlist="0.0,0.3,0.5,0.7,1.0">
+ <parameter type="list" name="Operation" default="0.0" paramlist="0.0;0.3;0.5;0.7;1.0">
<paramlistdisplay>Write on clear,Max,Min,Add,Subtract</paramlistdisplay>
<name>Operation</name>
</parameter>
<name>Mirror</name>
<description>Flip your image in any direction</description>
<author>Charles Yates</author>
- <parameter type="list" name="mirror" default="horizontal" paramlist="horizontal,vertical,diagonal,xdiagonal,flip,flop">
+ <parameter type="list" name="mirror" default="horizontal" paramlist="horizontal;vertical;diagonal;xdiagonal;flip;flop">
<name>Mirroring direction</name>
</parameter>
<parameter type="bool" name="reverse" default="0">
<name>Obscure</name>
<description>Hide a region of the clip</description>
<author>Charles Yates</author>
- <parameter type="geometry" name="start" default="40%,40%:20%x20%" fixed="1">
+ <parameter type="geometry" name="start" default="40%,40%:20%x20%">
<name>Region</name>
</parameter>
</effect>
<description>Keyframable vector based rotoscoping</description>
<author>Till Theato</author>
- <parameter type="list" name="mode" default="alpha" paramlist="alpha,luma,rgb">
+ <parameter type="list" name="mode" default="alpha" paramlist="alpha;luma;rgb">
<paramlistdisplay>Alpha,Luma,RGB</paramlistdisplay>
<name>Mode</name>
</parameter>
- <parameter type="list" name="alpha_operation" default="clear" paramlist="clear,max,min,add,sub">
+ <parameter type="list" name="alpha_operation" default="clear" paramlist="clear;max;min;add;sub">
<paramlistdisplay>Write on clear,Maximum,Minimum,Add,Subtract</paramlistdisplay>
<name>Alpha Operation</name>
</parameter>
<parameter type="constant" name="speed" max="100" min="0" default="5" factor="10" suffix="Hz">
<name>Speed</name>
</parameter>
- <parameter type="list" name="shape" default="sine" paramlist="sine,triangle">
+ <parameter type="list" name="shape" default="sine" paramlist="sine;triangle">
<name>Shape</name>
</parameter>
<parameter type="constant" name="phase" max="100" min="0" default="25" suffix="%">
<name>Phase</name>
</parameter>
- <parameter type="list" name="interp" default="linear" paramlist="linear,quadratic">
+ <parameter type="list" name="interp" default="linear" paramlist="linear;quadratic">
<name>Interpolation</name>
</parameter>
</effect>
***************************************************************************/
#include "cubicbezierspline.h"
-
+#include <KDebug>
/** @brief For sorting a Bezier spline. Whether a is before b. */
static bool pointLessThan(const BPoint &a, const BPoint &b)
QString CubicBezierSpline::toString() const
{
QStringList spline;
+ QLocale locale;
foreach(const BPoint &p, m_points) {
- spline << QString("%1;%2#%3;%4#%5;%6").arg(p.h1.x()).arg(p.h1.y())
- .arg(p.p.x()).arg(p.p.y())
- .arg(p.h2.x()).arg(p.h2.y());
+ spline << QString("%1;%2#%3;%4#%5;%6").arg(locale.toString(p.h1.x())).arg(locale.toString(p.h1.y()))
+ .arg(locale.toString(p.p.x())).arg(locale.toString(p.p.y()))
+ .arg(locale.toString(p.h2.x())).arg(locale.toString(p.h2.y()));
}
return spline.join("|");
}
bool ClipItem::checkKeyFrames()
{
bool clipEffectsModified = false;
+ QLocale locale;
// go through all effects this clip has
for (int ix = 0; ix < m_effectList.count(); ++ix) {
QStringList keyframeParams = keyframes(ix);
// go through all keyframes for one param
foreach(const QString &str, keyframes) {
int pos = str.section(':', 0, 0).toInt();
- double val = str.section(':', 1, 1).toDouble();
+ double val = locale.toDouble(str.section(':', 1, 1));
if (pos - start < 0) {
// a keyframe is defined before the start of the clip
cutKeyFrame = true;
int diff = pos - lastPos;
double ratio = (double)(start - lastPos) / diff;
double newValue = lastValue + (val - lastValue) * ratio;
- newKeyFrames.append(QString::number(start) + ':' + QString::number(newValue));
+ newKeyFrames.append(QString::number(start) + ':' + locale.toString(newValue));
modified = true;
}
cutKeyFrame = false;
if (diff != 0) {
double ratio = (double)(end - lastPos) / diff;
double newValue = lastValue + (val - lastValue) * ratio;
- newKeyFrames.append(QString::number(end) + ':' + QString::number(newValue));
+ newKeyFrames.append(QString::number(end) + ':' + locale.toString(newValue));
modified = true;
}
break;
} else {
- newKeyFrames.append(QString::number(pos) + ':' + QString::number(val));
+ newKeyFrames.append(QString::number(pos) + ':' + locale.toString(val));
}
}
lastPos = pos;
{
QDomElement effect = getEffectAt(ix);
if (effect.attribute("disable") == "1") return;
+ QLocale locale;
QDomNodeList params = effect.elementsByTagName("parameter");
int keyframeParams = 0;
for (int i = 0; i < params.count(); i++) {
if (ix == m_selectedEffect && keyframeParams == 0) {
m_keyframes.clear();
m_visibleParam = i;
- double max = e.attribute("max").toDouble();
- double min = e.attribute("min").toDouble();
+ double max = locale.toDouble(e.attribute("max"));
+ double min = locale.toDouble(e.attribute("min"));
m_keyframeFactor = 100.0 / (max - min);
m_keyframeOffset = min;
- m_keyframeDefault = e.attribute("default").toDouble();
+ m_keyframeDefault = locale.toDouble(e.attribute("default"));
m_selectedKeyframe = 0;
// parse keyframes
const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
foreach(const QString &str, keyframes) {
int pos = str.section(':', 0, 0).toInt();
- double val = str.section(':', 1, 1).toDouble();
+ double val = locale.toDouble(str.section(':', 1, 1));
m_keyframes[pos] = val;
}
if (m_keyframes.find(m_editedKeyframe) == m_keyframes.end()) m_editedKeyframe = -1;
void ClipItem::setSelectedEffect(const int ix)
{
m_selectedEffect = ix;
+ QLocale locale;
QDomElement effect = effectAt(m_selectedEffect);
if (!effect.isNull() && effect.attribute("disable") != "1") {
QDomNodeList params = effect.elementsByTagName("parameter");
m_keyframes.clear();
m_limitedKeyFrames = e.attribute("type") == "keyframe";
m_visibleParam = i;
- double max = e.attribute("max").toDouble();
- double min = e.attribute("min").toDouble();
+ double max = locale.toDouble(e.attribute("max"));
+ double min = locale.toDouble(e.attribute("min"));
m_keyframeFactor = 100.0 / (max - min);
m_keyframeOffset = min;
- m_keyframeDefault = e.attribute("default").toDouble();
+ m_keyframeDefault = locale.toDouble(e.attribute("default"));
m_selectedKeyframe = 0;
// parse keyframes
const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
foreach(const QString &str, keyframes) {
int pos = str.section(':', 0, 0).toInt();
- double val = str.section(':', 1, 1).toDouble();
+ double val = locale.toDouble(str.section(':', 1, 1));
m_keyframes[pos] = val;
}
if (m_keyframes.find(m_editedKeyframe) == m_keyframes.end())
EffectsParameterList ClipItem::addEffect(const QDomElement effect, bool /*animate*/)
{
bool needRepaint = false;
+ QLocale locale;
int ix;
if (!effect.hasAttribute("kdenlive_ix")) {
ix = effectsCounter();
}
if (e.attribute("type") == "simplekeyframe") {
QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts);
- double factor = e.attribute("factor", "1").toDouble();
+ double factor = locale.toDouble(e.attribute("factor", "1"));
if (factor != 1) {
for (int j = 0; j < values.count(); j++) {
QString pos = values.at(j).section(':', 0, 0);
- double val = values.at(j).section(':', 1, 1).toDouble() / factor;
- values[j] = pos + "=" + QString::number(val);
+ double val = locale.toDouble(values.at(j).section(':', 1, 1)) / factor;
+ values[j] = pos + "=" + locale.toString(val);
}
}
parameters.addParam(e.attribute("name"), values.join(";"));
double fact;
if (e.attribute("factor").contains('%')) {
fact = ProfilesDialog::getStringEval(projectScene()->profile(), e.attribute("factor"));
- } else fact = e.attribute("factor", "1").toDouble();
- parameters.addParam(e.attribute("name"), QString::number(e.attribute("value").toDouble() / fact));
+ } else fact = locale.toDouble(e.attribute("factor", "1"));
+ parameters.addParam(e.attribute("name"), locale.toString(locale.toDouble(e.attribute("value")) / fact));
}
}
}
void ClipItem::insertKeyframe(QDomElement effect, int pos, int val)
{
if (effect.attribute("disable") == "1") return;
+ QLocale locale;
effect.setAttribute("active_keyframe", pos);
m_editedKeyframe = pos;
QDomNodeList params = effect.elementsByTagName("parameter");
bool added = false;
foreach(const QString &str, keyframes) {
int kpos = str.section(':', 0, 0).toInt();
- double newval = str.section(':', 1, 1).toDouble();
+ double newval = locale.toDouble(str.section(':', 1, 1));
if (kpos < pos) {
newkfr.append(str);
} else if (!added) {
if (i == m_visibleParam)
newkfr.append(QString::number(pos) + ":" + QString::number(val));
else
- newkfr.append(QString::number(pos) + ":" + QString::number(newval));
+ newkfr.append(QString::number(pos) + ":" + locale.toString(newval));
if (kpos > pos) newkfr.append(str);
added = true;
} else newkfr.append(str);
void ClipItem::movedKeyframe(QDomElement effect, int oldpos, int newpos, double value)
{
if (effect.attribute("disable") == "1") return;
+ QLocale locale;
effect.setAttribute("active_keyframe", newpos);
QDomNodeList params = effect.elementsByTagName("parameter");
int start = cropStart().frames(m_fps);
newpos = qMax(newpos, start);
newpos = qMin(newpos, end);
if (i == m_visibleParam)
- newkfr.append(QString::number(newpos) + ":" + QString::number(value));
+ newkfr.append(QString::number(newpos) + ":" + locale.toString(value));
else
newkfr.append(QString::number(newpos) + ":" + str.section(':', 1, 1));
}
void ClipItem::updateKeyframes(QDomElement effect)
{
m_keyframes.clear();
+ QLocale locale;
// parse keyframes
QDomNodeList params = effect.elementsByTagName("parameter");
QDomElement e = params.item(m_visibleParam).toElement();
const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
foreach(const QString &str, keyframes) {
int pos = str.section(':', 0, 0).toInt();
- double val = str.section(':', 1, 1).toDouble();
+ double val = locale.toDouble(str.section(':', 1, 1));
m_keyframes[pos] = val;
}
if (!m_keyframes.contains(m_selectedKeyframe)) m_selectedKeyframe = -1;
{
int in = cropStart().frames(m_fps);
int out = (cropStart() + cropDuration()).frames(m_fps) - 1;
+ QLocale locale;
const QStringList data = parameter.attribute("keyframes").split(';', QString::SkipEmptyParts);
QMap <int, double> keyframes;
foreach (QString keyframe, data)
- keyframes[keyframe.section(':', 0, 0).toInt()] = keyframe.section(':', 1, 1).toDouble();
+ keyframes[keyframe.section(':', 0, 0).toInt()] = locale.toDouble(keyframe.section(':', 1, 1));
QMap<int, double>::iterator i = keyframes.end();
}
#include "clipitem.moc"
+
QMap <QString, QString> ClipProperties::properties()
{
QMap <QString, QString> props;
+ QLocale locale;
CLIPTYPE t = UNKNOWN;
if (m_clip != NULL) {
t = m_clip->clipType();
double fps = m_view.clip_framerate->value();
if (m_view.clip_force_framerate->isChecked()) {
if (fps != m_old_props.value("force_fps").toDouble()) {
- props["force_fps"] = QString::number(fps);
+ props["force_fps"] = locale.toString(fps);
m_clipNeedsRefresh = true;
}
} else if (m_old_props.contains("force_fps") && !m_old_props.value("force_fps").isEmpty()) {
{
QImage hud;
-
+ QLocale locale;
if (m_mouseWithinWidget) {
// Mouse moved: Draw a circle over the scope
}
davinci.drawEllipse(m_centerPoint, (int)r, (int)r);
davinci.setPen(penThin);
- davinci.drawText(QPoint(m_scopeRect.width()-40, m_scopeRect.height()), i18n("%1 \%", QString::number(percent, 'f', 0)));
+ davinci.drawText(QPoint(m_scopeRect.width()-40, m_scopeRect.height()), i18n("%1 \%", locale.toString(percent, 'f', 0)));
float angle = copysign(acos(dx/r)*180/M_PI, dy);
- davinci.drawText(QPoint(10, m_scopeRect.height()), i18n("%1°", QString::number(angle, 'f', 1)));
+ davinci.drawText(QPoint(10, m_scopeRect.height()), i18n("%1°", locale.toString(angle, 'f', 1)));
// m_circleEnabled = false;
} else {
void Vectorscope::slotGainChanged(int newval)
{
+ QLocale locale;
m_gain = 1 + (float)newval/10;
- ui->lblGain->setText(QString::number(m_gain, 'f', 1) + "x");
+ ui->lblGain->setText(locale.toString(m_gain, 'f', 1) + "x");
forceUpdateScope();
}
m_commandStack = doc->commandStack();
else
m_commandStack = NULL;
-
+ m_ct = 0;
setMouseTracking(true);
setAcceptDrops(true);
setFrameShape(QFrame::NoFrame);
void CustomTrackView::deleteClip(ItemInfo info, bool refresh)
{
ClipItem *item = getClipItemAt((int) info.startPos.frames(m_document->fps()), info.track);
-
+ m_ct++;
+ if (!item) kDebug()<<"// PROBLEM FINDING CLIP ITEM TO REMOVVE!!!!!!!!!";
+ else kDebug()<<"// deleting CLIP: "<<info.startPos.frames(m_document->fps())<<", "<<item->baseClip()->fileURL();
+ //m_document->renderer()->saveSceneList(QString("/tmp/error%1.mlt").arg(m_ct), QDomElement());
if (!item || m_document->renderer()->mltRemoveClip(m_document->tracksCount() - info.track, info.startPos) == false) {
emit displayMessage(i18n("Error removing clip at %1 on track %2", m_document->timecode().getTimecodeFromFrames(info.startPos.frames(m_document->fps())), info.track), ErrorMessage);
+ kDebug()<<"CANNOT REMOVE: "<<info.startPos.frames(m_document->fps())<<", TK: "<<info.track;
+ //m_document->renderer()->saveSceneList(QString("/tmp/error%1.mlt").arg(m_ct), QDomElement());
+ exit(1);
return;
}
m_waitingThumbs.removeAll(item);
// parse parameters to check if we need to adjust to the new crop start
int diff = (newstart - oldstart).frames(m_document->fps());
int max = (newstart + duration).frames(m_document->fps());
+ QLocale locale;
QDomNodeList params = xml.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
double val = str.section(':', 1, 1).toDouble();
pos += diff;
if (pos > max) {
- newKeyFrames.append(QString::number(max) + ':' + QString::number(val));
+ newKeyFrames.append(QString::number(max) + ':' + locale.toString(val));
break;
- } else newKeyFrames.append(QString::number(pos) + ':' + QString::number(val));
+ } else newKeyFrames.append(QString::number(pos) + ':' + locale.toString(val));
}
//kDebug()<<"ORIGIN: "<<keys<<", FIXED: "<<newKeyFrames;
e.setAttribute("keyframes", newKeyFrames.join(";"));
} else {
QString startThumb = thumbBase + item->baseClip()->getClipHash() + '_';
QString endThumb = startThumb;
- startThumb.append(QString::number(item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
- endThumb.append(QString::number((item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
+ startThumb.append(QString::number((int) item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
+ endThumb.append(QString::number((int) (item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
if (QFile::exists(startThumb)) {
QPixmap pix(startThumb);
if (pix.isNull()) KIO::NetAccess::del(KUrl(startThumb), this);
} else {
QString startThumb = thumbBase + item->baseClip()->getClipHash() + '_';
QString endThumb = startThumb;
- startThumb.append(QString::number(item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
- endThumb.append(QString::number((item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
+ startThumb.append(QString::number((int) item->speedIndependantCropStart().frames(m_document->fps())) + ".png");
+ endThumb.append(QString::number((int) (item->speedIndependantCropStart() + item->speedIndependantCropDuration()).frames(m_document->fps()) - 1) + ".png");
if (!QFile::exists(startThumb)) {
QPixmap pix(item->startThumb());
pix.save(startThumb);
QStringList CustomTrackView::getLadspaParams(QDomElement effect) const
{
QStringList result;
+ QLocale locale;
QDomNodeList params = effect.elementsByTagName("parameter");
for (int i = 0; i < params.count(); i++) {
QDomElement e = params.item(i).toElement();
double factor = e.attribute("factor").toDouble();
double value = e.attribute("value").toDouble();
value = value / factor;
- result.append(QString::number(value));
+ result.append(locale.toString(value));
} else result.append(e.attribute("value"));
}
}
EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement effect)
{
EffectsParameterList parameters;
+ QLocale locale;
parameters.addParam("tag", effect.attribute("tag"));
if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region"));
parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix"));
for (int j = 0; j < values.count(); j++) {
QString pos = values.at(j).section(':', 0, 0);
double val = values.at(j).section(':', 1, 1).toDouble() / factor;
- values[j] = pos + "=" + QString::number(val);
+ values[j] = pos + "=" + locale.toString(val);
}
// kDebug() << "/ / / /SENDING KEYFR:" << values;
parameters.addParam(e.attribute("name"), values.join(";"));
if (e.attribute("factor").contains('%')) {
fact = ProfilesDialog::getStringEval(m_document->mltProfile(), e.attribute("factor"));
} else fact = e.attribute("factor", "1").toDouble();
- parameters.addParam(e.attribute("name"), QString::number(e.attribute("value").toDouble() / fact));
+ parameters.addParam(e.attribute("name"), locale.toString(e.attribute("value").toDouble() / fact));
} else {
parameters.addParam(e.attribute("name"), e.attribute("value"));
}
virtual Qt::DropActions supportedDropActions() const;
private:
+ int m_ct;
int m_tracksHeight;
int m_projectDuration;
int m_cursorPos;
// Check if we're validating a Kdenlive project
if (kdenliveDoc.isNull())
return false;
+
+ QLocale documentLocale;
+
+ if (mlt.hasAttribute("LC_NUMERIC")) {
+ // Set locale for the document
+ documentLocale = QLocale(mlt.attribute("LC_NUMERIC"));
+ if (documentLocale.decimalPoint() != QLocale().decimalPoint()) {
+ QDomElement docProperties = kdenliveDoc.firstChildElement("documentproperties");
+ if (docProperties.isNull()) {
+ docProperties = m_doc.createElement("documentproperties");
+ kdenliveDoc.appendChild(docProperties);
+ }
+ docProperties.setAttribute("readonly", 1);
+ KMessageBox::sorry(kapp->activeWindow(), i18n("The document you are opening uses a different locale (%1) than your system. You can only open and render it, no editing is supported unless you change your system's locale.", mlt.attribute("LC_NUMERIC")), i18n("Read only project"));
+ }
+ }
+
// Upgrade the document to the latest version
- if (!upgrade(kdenliveDoc.attribute("version").toDouble(), currentVersion))
+ if (!upgrade(documentLocale.toDouble(kdenliveDoc.attribute("version")), currentVersion))
return false;
/*
// We need to make sure that the y coordinate is a multiple of 2, otherwise button may not be displayed
buttonsTarget.append(it.key());
but.setAttribute("x0", QString::number(r.x()));
- but.setAttribute("y0", QString::number(2 * (r.y() / 2)));
+ but.setAttribute("y0", QString::number((int) 2 * (r.y() / 2)));
but.setAttribute("x1", QString::number(r.right()));
- but.setAttribute("y1", QString::number(2 * (r.bottom() / 2)));
+ but.setAttribute("y1", QString::number((int) 2 * (r.bottom() / 2)));
spu.appendChild(but);
i++;
}
} else if (type == "list") {
Listval *lsval = new Listval;
lsval->setupUi(toFillin);
- QStringList listitems = pa.attribute("paramlist").split(',');
+ QStringList listitems = pa.attribute("paramlist").split(';');
QDomElement list = pa.firstChildElement("paramlistdisplay");
QStringList listitemsdisplay;
if (!list.isNull()) listitemsdisplay = i18n(list.text().toUtf8().data()).split(',');
wipeInfo EffectStackEdit::getWipeInfo(QString value)
{
wipeInfo info;
+ // Convert old geometry values that used a comma as separator
+ if (value.contains(',')) value.replace(',','/');
QString start = value.section(';', 0, 0);
QString end = value.section(';', 1, 1).section('=', 1, 1);
-
- if (start.startsWith("-100%,0"))
+ if (start.startsWith("-100%/0"))
info.start = LEFT;
- else if (start.startsWith("100%,0"))
+ else if (start.startsWith("100%/0"))
info.start = RIGHT;
- else if (start.startsWith("0%,100%"))
+ else if (start.startsWith("0%/100%"))
info.start = DOWN;
- else if (start.startsWith("0%,-100%"))
+ else if (start.startsWith("0%/-100%"))
info.start = UP;
else
info.start = CENTER;
else
info.startTransparency = 100;
- if (end.startsWith("-100%,0"))
+ if (end.startsWith("-100%/0"))
info.end = LEFT;
- else if (end.startsWith("100%,0"))
+ else if (end.startsWith("100%/0"))
info.end = RIGHT;
- else if (end.startsWith("0%,100%"))
+ else if (end.startsWith("0%/100%"))
info.end = DOWN;
- else if (end.startsWith("0%,-100%"))
+ else if (end.startsWith("0%/-100%"))
info.end = UP;
else
info.end = CENTER;
QString end;
switch (info.start) {
case LEFT:
- start = "-100%,0%:100%x100%";
+ start = "-100%/0%:100%x100%";
break;
case RIGHT:
- start = "100%,0%:100%x100%";
+ start = "100%/0%:100%x100%";
break;
case DOWN:
- start = "0%,100%:100%x100%";
+ start = "0%/100%:100%x100%";
break;
case UP:
- start = "0%,-100%:100%x100%";
+ start = "0%/-100%:100%x100%";
break;
default:
- start = "0%,0%:100%x100%";
+ start = "0%/0%:100%x100%";
break;
}
start.append(':' + QString::number(info.startTransparency));
switch (info.end) {
case LEFT:
- end = "-100%,0%:100%x100%";
+ end = "-100%/0%:100%x100%";
break;
case RIGHT:
- end = "100%,0%:100%x100%";
+ end = "100%/0%:100%x100%";
break;
case DOWN:
- end = "0%,100%:100%x100%";
+ end = "0%/100%:100%x100%";
break;
case UP:
- end = "0%,-100%:100%x100%";
+ end = "0%/-100%:100%x100%";
break;
default:
- end = "0%,0%:100%x100%";
+ end = "0%/0%:100%x100%";
break;
}
end.append(':' + QString::number(info.endTransparency));
void EffectStackEdit::collectAllParameters()
{
if (m_valueItems.isEmpty() || m_params.isNull()) return;
+ QLocale locale;
const QDomElement oldparam = m_params.cloneNode().toElement();
QDomElement newparam = oldparam.cloneNode().toElement();
QDomNodeList namenode = newparam.elementsByTagName("parameter");
QString setValue;
if (type == "double" || type == "constant") {
DoubleParameterWidget *doubleparam = (DoubleParameterWidget*)m_valueItems.value(paramName);
- setValue = QString::number(doubleparam->getValue());
+ setValue = locale.toString(doubleparam->getValue());
} else if (type == "list") {
KComboBox *box = ((Listval*)m_valueItems.value(paramName))->list;
setValue = box->itemData(box->currentIndex()).toString();
in.replace("%i", QString::number(j + off));
QString out = outName;
out.replace("%i", QString::number(j + off));
- EffectsList::setParameter(newparam, in, QString::number(points.at(j).x()));
- EffectsList::setParameter(newparam, out, QString::number(points.at(j).y()));
+ EffectsList::setParameter(newparam, in, locale.toString(points.at(j).x()));
+ EffectsList::setParameter(newparam, out, locale.toString(points.at(j).y()));
}
QString depends = pa.attributes().namedItem("depends").nodeValue();
if (!depends.isEmpty())
QDomElement e = params.item(i).toElement();
if (e.attribute("tag") == "resource") {
e.setAttribute("paramlistdisplay", imagenamelist.join(","));
- e.setAttribute("paramlist", imagefiles.join(","));
+ e.setAttribute("paramlist", imagefiles.join(";"));
break;
}
}
QDomElement e = params.item(i).toElement();
if (e.attribute("tag") == "luma") {
e.setAttribute("paramlistdisplay", imagenamelist.join(","));
- e.setAttribute("paramlist", imagefiles.join(","));
+ e.setAttribute("paramlist", imagefiles.join(";"));
break;
}
}
kDebug() << "Effect broken: " << name;
return;
}
-
+ QLocale locale;
+ bool needsLocaleConversion = false;
for (int i = 0; !effects.item(i).isNull(); ++i) {
documentElement = effects.item(i).toElement();
QString tag = documentElement.attribute("tag", QString());
-
+ if (documentElement.hasAttribute("LC_NUMERIC")) {
+ // set a locale for that file
+ locale = QLocale(documentElement.attribute("LC_NUMERIC"));
+ if (locale.decimalPoint() != QLocale().decimalPoint()) {
+ needsLocaleConversion = true;
+ }
+ }
if (documentElement.hasAttribute("version")) {
// a specific version of the filter is required
Mlt::Properties *metadata = repository->metadata(filter_type, tag.toUtf8().data());
if (metadata && metadata->is_valid()) {
double version = metadata->get_double("version");
- if (documentElement.attribute("version").toDouble() > version) {
+ if (locale.toDouble(documentElement.attribute("version")) > version) {
delete metadata;
return;
}
delete metadata;
}
+ if (needsLocaleConversion) {
+ // we need to convert all numbers to the system's locale (for example 0.5 -> 0,5)
+ QChar separator = QLocale().decimalPoint();
+ QChar oldSeparator = locale.decimalPoint();
+ QDomNodeList params = documentElement.elementsByTagName("parameter");
+ for (int j = 0; j < params.count(); j++) {
+ QDomNamedNodeMap attrs = params.at(j).attributes();
+ for (int k = 0; k < attrs.count(); k++) {
+ QString name = attrs.item(k).nodeName();
+ if (name != "type" && name != "name") {
+ QString val = attrs.item(k).nodeValue();
+ if (val.contains(oldSeparator)) {
+ QString newVal = val.replace(oldSeparator, separator);
+ attrs.item(k).setNodeValue(newVal);
+ }
+ }
+ }
+ }
+ }
+
// Parse effect information.
if ((filtersList.contains(tag) || producersList.contains(tag))) {
QString type = documentElement.attribute("type", QString());
paramList.append(quickParameterFill(ret, i18n("Softness"), "softness", "double", "0", "0", "100", "", "", "100"));
paramList.append(quickParameterFill(ret, i18nc("@property: means that the image is inverted", "Invert"), "invert", "bool", "0", "0", "1"));
- paramList.append(quickParameterFill(ret, i18n("Image File"), "resource", "list", "", "", "", imagefiles.join(","), imagenamelist.join(",")));
+ paramList.append(quickParameterFill(ret, i18n("Image File"), "resource", "list", "", "", "", imagefiles.join(";"), imagenamelist.join(",")));
paramList.append(quickParameterFill(ret, i18n("Reverse Transition"), "reverse", "bool", "0", "0", "1"));
//thumbnailer.prepareThumbnailsCall(imagelist);
} else if (name == "composite") {
paramList.append(quickParameterFill(ret, i18n("Align"), "aligned", "bool", "1", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Fill"), "fill", "bool", "1", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Distort"), "distort", "bool", "0", "0", "1"));
- paramList.append(quickParameterFill(ret, i18n("Wipe File"), "luma", "list", "", "", "", imagefiles.join(","), imagenamelist.join(",")));
+ paramList.append(quickParameterFill(ret, i18n("Wipe File"), "luma", "list", "", "", "", imagefiles.join(";"), imagenamelist.join(",")));
paramList.append(quickParameterFill(ret, i18n("Wipe Softness"), "softness", "double", "0", "0", "100", "", "", "100"));
paramList.append(quickParameterFill(ret, i18n("Wipe Invert"), "luma_invert", "bool", "0", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Force Progressive Rendering"), "progressive", "bool", "1", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Align"), "composite.aligned", "bool", "1", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Fill"), "composite.fill", "bool", "1", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Distort"), "composite.distort", "bool", "0", "0", "1"));
- paramList.append(quickParameterFill(ret, i18n("Wipe File"), "composite.luma", "list", "", "", "", imagefiles.join(","), imagenamelist.join(",")));
+ paramList.append(quickParameterFill(ret, i18n("Wipe File"), "composite.luma", "list", "", "", "", imagefiles.join(";"), imagenamelist.join(",")));
paramList.append(quickParameterFill(ret, i18n("Wipe Softness"), "composite.softness", "double", "0", "0", "100", "", "", "100"));
paramList.append(quickParameterFill(ret, i18n("Wipe Invert"), "composite.luma_invert", "bool", "0", "0", "1"));
paramList.append(quickParameterFill(ret, i18n("Force Progressive Rendering"), "composite.progressive", "bool", "1", "0", "1"));
property = doc.createElement("property");
property.setAttribute("name", "aspect_ratio");
- value = doc.createTextNode(QString::number(0.0));
+ value = doc.createTextNode(QString::number(0));
property.appendChild(value);
blk.appendChild(property);
void KdenliveDoc::setModified(bool mod)
{
+ if (isReadOnly()) return;
if (!m_url.isEmpty() && mod && KdenliveSettings::crashrecovery()) {
m_autoSaveTimer->start(3000);
}
}
}
+bool KdenliveDoc::isReadOnly() const
+{
+ return m_documentProperties.contains("readonly");
+}
+
void KdenliveDoc::cleanupBackupFiles()
{
KUrl backupFile = m_projectFolder;
static double getDisplayRatio(const QString &path);
/** @brief Backup the project file */
void backupLastSavedVersion(const QString &path);
+ /** @brief True if the document was opened in read only mode. */
+ bool isReadOnly() const;
private:
KUrl m_url;
#include <QList>
#include <QSharedData>
#include <QStringList>
+#include <QLocale>
template <typename T>
class KisTridiagonalSystem
QString KisCubicCurve::toString() const
{
QString sCurve;
+ QLocale locale;
foreach(const QPointF & pair, d->data->points) {
- sCurve += QString::number(pair.x());
- sCurve += ',';
+ sCurve += locale.toString(pair.x());
+ sCurve += '/';
sCurve += QString::number(pair.y());
sCurve += ';';
}
QList<QPointF> points;
foreach(const QString & pair, data) {
- if (pair.indexOf(',') > -1) {
+ if (pair.indexOf('/') > -1) {
QPointF p;
- p.rx() = pair.section(',', 0, 0).toDouble();
- p.ry() = pair.section(',', 1, 1).toDouble();
+ p.rx() = pair.section('/', 0, 0).toDouble();
+ p.ry() = pair.section('/', 1, 1).toDouble();
points.append(p);
}
}
return p;
}
- /*Mlt::Producer parentProd(producer->parent());
- Mlt::Service service(parentProd.get_service());
- mlt_service_lock(service.get_service());*/
int ow = width;
int oh = height;
mlt_image_format format = mlt_image_rgb24a;
new MainWindowAdaptor(this);
QDBusConnection dbus = QDBusConnection::sessionBus();
dbus.registerObject("/MainWindow", this);
-
- setlocale(LC_NUMERIC, "POSIX");
+ //setlocale(LC_NUMERIC, "POSIX");
if (!KdenliveSettings::colortheme().isEmpty()) slotChangePalette(NULL, KdenliveSettings::colortheme());
setFont(KGlobalSettings::toolBarFont());
parseProfiles(MltPath);
delete m_stopmotion;
m_stopmotion = NULL;
}
-
+
+ m_timer.start();
KProgressDialog progressDialog(this, i18n("Loading project"), i18n("Loading project"));
progressDialog.setAllowCancel(false);
progressDialog.progressBar()->setMaximum(4);
m_clipMonitor->refreshMonitor(true);
progressDialog.progressBar()->setValue(4);
+ bool readOnly = !doc->isReadOnly();
+ factory()->container("edit", this)->setEnabled(readOnly);
+ factory()->container("project", this)->setEnabled(readOnly);
+ factory()->container("tool", this)->setEnabled(readOnly);
+ factory()->container("clip", this)->setEnabled(readOnly);
+ factory()->container("timeline", this)->setEnabled(readOnly);
+ factory()->container("monitor", this)->setEnabled(readOnly);
if (openBackup) slotOpenBackupDialog(url);
}
void MainWindow::slotUpdateDocumentState(bool modified)
{
- if (!m_activeDocument) return;
+ if (!m_activeDocument || m_activeDocument->isReadOnly()) return;
setCaption(m_activeDocument->description(), modified);
m_saveAction->setEnabled(modified);
if (modified) {
connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
+ connect(m_projectList, SIGNAL(loadingIsOver()), this, SLOT(slotElapsedTime()));
connect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
}
+void MainWindow::slotElapsedTime()
+{
+ kDebug()<<"-----------------------------------------\n"<<"Time elapsed: "<<m_timer.elapsed()<<"\n-------------------------";
+}
+
#include "mainwindow.moc"
#ifdef DEBUG_MAINW
void loadLayouts();
StopmotionWidget *m_stopmotion;
+ QTime m_timer;
public slots:
/** @brief Prepares opening @param url.
/** @brief Disable proxies for this project. */
void slotDisableProxies();
+ void slotElapsedTime();
+
signals:
Q_SCRIPTABLE void abortRenderJob(const QString &url);
};
AbstractRender("capture", parent),
doCapture(0),
sendFrameForAnalysis(false),
+ analyseAudio(KdenliveSettings::monitor_audio()),
+ processingImage(false),
m_mltConsumer(NULL),
m_mltProducer(NULL),
m_mltProfile(NULL),
m_droppedFrames(0),
m_livePreview(KdenliveSettings::recording_preview()),
m_captureDisplayWidget(surface),
- m_winid((int) surface->winId()),
- analyseAudio(KdenliveSettings::monitor_audio()),
- processingImage(false)
+ m_winid((int) surface->winId())
{
if (profile.isEmpty()) profile = KdenliveSettings::current_profile();
buildConsumer(profile);
mlt_type = mlt_properties_get(properties, "mlt_type");
resource = mlt_properties_get(properties, "mlt_service");
}
- for (int trackNb = tractor.count() - 1; trackNb >= 0; --trackNb) {
- Mlt::Producer trackProducer(tractor.track(trackNb));
- Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
- if (trackPlaylist.type() == playlist_type) {
- for (int i = 0; i < trackPlaylist.count();i++) {
- // We need to manually decrease the ref count and close the producer, otherwise
- // the video4linux device stays open, seems like a bug in MLT that is not cleaning properly
- mlt_properties props = MLT_PRODUCER_PROPERTIES(trackPlaylist.get_clip(i)->get_parent());
- while (mlt_properties_ref_count(props) > 0) mlt_properties_dec_ref(props);
- if (trackPlaylist.get_clip(i)) mlt_producer_close(trackPlaylist.get_clip(i)->get_parent());
- }
- mlt_playlist_close(trackPlaylist.get_playlist());
- }
- }
delete field;
field = NULL;
}
m_view.profiles_list->blockSignals(false);
return;
}
-
+ QLocale locale;
m_selectedProfileIndex = m_view.profiles_list->currentIndex();
if (currentProfile.isEmpty()) currentProfile = m_view.profiles_list->itemData(m_view.profiles_list->currentIndex()).toString();
m_isCustomProfile = currentProfile.contains('/');
m_view.frame_den->setValue(values.value("frame_rate_den").toInt());
m_view.progressive->setChecked(values.value("progressive").toInt());
if (values.value("progressive").toInt()) {
- m_view.fields->setText(QString::number((double) values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
+ m_view.fields->setText(locale.toString((double) values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
} else {
- m_view.fields->setText(QString::number((double) 2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
+ m_view.fields->setText(locale.toString((double) 2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
}
int colorix = m_view.colorspace->findData(values.value("colorspace").toInt());
m_listView->processLayout();
QDomElement e = clip->toXML().cloneNode().toElement();
e.removeAttribute("file_hash");
+ m_mutex.lock();
m_infoQueue.insert(clip->getId(), e);
+ m_mutex.unlock();
}
else if (item->hasProxy() && !item->isProxyRunning()) {
slotCreateProxy(clip->getId());
updateButtons();
}
- if (getProperties && m_processingClips.isEmpty())
- m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //if (getProperties && m_processingClips.isEmpty())
+ //m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ if (getProperties)
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
void ProjectList::slotGotProxy(const QString &proxyPath)
}
}
e.setAttribute("replace", 1);
+ m_mutex.lock();
m_infoQueue.insert(clip->getId(), e);
- if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ m_mutex.unlock();
+ //if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
void ProjectList::slotResetProjectList()
m_refreshed = false;
}
-void ProjectList::requestClipInfo(const QDomElement xml, const QString id)
-{
- m_infoQueue.insert(id, xml);
- //if (m_infoQueue.count() == 1 || ) QTimer::singleShot(300, this, SLOT(slotProcessNextClipInQueue()));
-}
-
void ProjectList::slotProcessNextClipInQueue()
{
if (m_infoQueue.isEmpty()) {
emit processNextThumbnail();
return;
}
-
+ QMutexLocker locker(&m_mutex);
QMap<QString, QDomElement>::const_iterator j = m_infoQueue.constBegin();
if (j != m_infoQueue.constEnd()) {
QDomElement dom = j.value().cloneNode().toElement();
const QString id = j.key();
m_infoQueue.remove(id);
m_processingClips.append(id);
+ locker.unlock();
bool replace;
if (dom.hasAttribute("replace")) {
// Proxy action was enabled / disabled and we want to replace current producer
QPainter p(&missingPixmap);
p.drawPixmap(3, 3, icon.pixmap(width - 6, height - 6));
p.end();
-
+ kDebug()<<"//////////////7 UPDATE ALL CLPS";
while (*it) {
if ((*it)->type() == PROJECTSUBCLIPTYPE) {
// subitem
xml.removeAttribute("file_hash");
xml.removeAttribute("proxy_out");
}
- requestClipInfo(xml, clip->getId());
+ m_mutex.lock();
+ m_infoQueue.insert(clip->getId(), xml);
+ m_mutex.unlock();
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
else {
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDropEnabled);
++it;
}
- if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ /*while (!m_infoQueue.isEmpty()) {
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ }*/
+
if (m_listView->isEnabled())
monitorItemEditing(true);
m_listView->setSortingEnabled(true);
ProjectItem *item = getItemById(id);
m_processingClips.removeAll(id);
m_thumbnailQueue.removeAll(id);
- if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
if (item) {
const QString path = item->referencedClip()->fileURL().path();
if (item->referencedClip()->isPlaceHolder()) replace = false;
}
m_processingClips.removeAll(id);
m_thumbnailQueue.removeAll(id);
- if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
void ProjectList::slotAddColorClip()
m_timecode = doc->timecode();
m_commandStack = doc->commandStack();
m_doc = doc;
+ setEnabled(!m_doc->isReadOnly());
QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
QStringList openedFolders = doc->getExpandedFolders();
if (!m_refreshed) {
emit loadingIsOver();
emit displayMessage(QString(), -1);
+ m_refreshed = true;
}
- m_refreshed = true;
m_listView->blockSignals(false);
m_listView->setEnabled(true);
updateButtons();
if (!toReload.isEmpty())
emit clipNeedsReload(toReload, true);
- if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //if (!m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
bool ProjectList::adjustProjectProfileToItem(ProjectItem *item)
}
if (command->childCount() > 0) m_doc->commandStack()->push(command);
else delete command;
- if (!m_infoQueue.isEmpty() && !m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ //if (!m_infoQueue.isEmpty() && !m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
void ProjectList::slotProxyCurrentItem(bool doProxy)
}
else delete command;
//if (!m_infoQueue.isEmpty() && !m_queueRunner.isRunning() && m_processingClips.isEmpty()) m_queueRunner = QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
+ if (!m_infoQueue.isEmpty()) QtConcurrent::run(this, &ProjectList::slotProcessNextClipInQueue);
}
QToolButton *m_editButton;
QMap <QString, QDomElement> m_infoQueue;
QMap <QString, QDomElement> m_producerQueue;
- void requestClipInfo(const QDomElement xml, const QString id);
QList <QString> m_thumbnailQueue;
QAction *m_proxyAction;
QStringList m_processingClips;
QStringList m_abortProxy;
/** @brief Holds a list of proxy urls that are currently being created. */
QStringList m_processingProxy;
+ QMutex m_mutex;
void requestClipThumbnail(const QString id);
void ProjectSettings::slotUpdateDisplay()
{
+ QLocale locale;
QString currentProfile = profiles_list->itemData(profiles_list->currentIndex()).toString();
QMap< QString, QString > values = ProfilesDialog::getSettingsFromFile(currentProfile);
p_size->setText(values.value("width") + 'x' + values.value("height"));
p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
if (values.value("progressive").toInt() == 0) {
p_progressive->setText(i18n("Interlaced (%1 fields per second)",
- QString::number((double)2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2)));
+ locale.toString((double)2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2)));
} else {
p_progressive->setText(i18n("Progressive"));
}
void Render::getFileProperties(const QDomElement xml, const QString &clipId, int imageHeight, bool replaceProducer, bool selectClip)
{
QString path;
+ QLocale locale;
bool proxyProducer;
if (xml.hasAttribute("proxy") && xml.attribute("proxy") != "-") {
path = xml.attribute("proxy");
play.appendChild(doc.importNode(xml, true));
producer = new Mlt::Producer(*m_mltProfile, "xml-string", doc.toString().toUtf8().constData());
} else {
+ char *resTag = qstrdup(QString("nocache:" + path).toUtf8().constData());
producer = new Mlt::Producer(*m_mltProfile, path.toUtf8().constData());
+ delete[] resTag;
}
// Clip already has all properties
if (replaceProducer) emit blockClipMonitor(clipId);
// Querying a frame is required by MLT, otherwise the producer is not correctly initialised
- Mlt::Frame *frame = producer->get_frame();
- delete frame;
+ //Mlt::Frame *frame = producer->get_frame();
+ //delete frame;
emit replyGetFileProperties(clipId, producer, QMap < QString, QString >(), QMap < QString, QString >(), replaceProducer, selectClip);
return;
}
}
if (producer->get_double("meta.media.frame_rate_den") > 0) {
- filePropertyMap["fps"] = QString::number(producer->get_double("meta.media.frame_rate_num") / producer->get_double("meta.media.frame_rate_den"));
+ filePropertyMap["fps"] = locale.toString(producer->get_double("meta.media.frame_rate_num") / producer->get_double("meta.media.frame_rate_den"));
} else filePropertyMap["fps"] = producer->get("source_fps");
if (frame && frame->is_valid()) {
} else
pix.fill(Qt::black);
- if (frameNumber == 0 && variance < 6) {
+ if (frameNumber == 0 && variance< 6) {
// Thumbnail is not interesting (for example all black, seek to fetch better thumb
frameNumber = 100;
producer->seek(frameNumber);
void Render::saveZone(KUrl url, QString desc, QPoint zone)
{
- kDebug() << "// SAVING CLIP ZONE, RENDER: " << m_name;
Mlt::Consumer xmlConsumer(*m_mltProfile, ("xml:" + url.path()).toUtf8().constData());
m_mltProducer->optimise();
xmlConsumer.set("terminate_on_pause", 1);
void Render::start()
{
- kDebug() << "----- STARTING MONITOR: " << m_name;
if (m_winid == -1) {
kDebug() << "----- BROKEN MONITOR: " << m_name << ", RESTART";
return;
}
if (m_mltConsumer && m_mltConsumer->is_stopped()) {
- kDebug() << "----- MONITOR: " << m_name << " WAS STOPPED";
if (m_mltConsumer->start() == -1) {
//KMessageBox::error(qApp->activeWindow(), i18n("Could not create the video preview window.\nThere is something wrong with your Kdenlive install or your driver settings, please fix it."));
kDebug(QtWarningMsg) << "/ / / / CANNOT START MONITOR";
} else {
- kDebug() << "----- MONITOR: " << m_name << " REFRESH";
m_isBlocked = false;
refresh();
}
{
if (m_mltProducer == NULL) return;
if (m_mltConsumer && !m_mltConsumer->is_stopped()) {
- kDebug() << "///////////// RENDER STOPPED: " << m_name;
+ //kDebug() << "///////////// RENDER STOPPED: " << m_name;
//m_mltConsumer->set("refresh", 0);
m_mltConsumer->stop();
// delete m_mltConsumer;
// m_mltConsumer = NULL;
}
- kDebug() << "///////////// RENDER STOP2-------";
m_isBlocked = true;
if (m_mltProducer) {
//m_mltProducer->set("out", m_mltProducer->get_length() - 1);
//kDebug() << m_mltProducer->get_length();
}
- kDebug() << "///////////// RENDER STOP3-------";
}
void Render::stop(const GenTime & startTime)
{
-
- kDebug() << "///////////// RENDER STOP-------2";
if (m_mltProducer) {
if (m_isZoneMode) resetZoneMode();
m_mltProducer->set_speed(0.0);
Mlt::Producer *Render::checkSlowMotionProducer(Mlt::Producer *prod, QDomElement element)
{
if (element.attribute("speed", "1.0").toDouble() == 1.0 && element.attribute("strobe", "1").toInt() == 1) return prod;
-
+ QLocale locale;
// We want a slowmotion producer
double speed = element.attribute("speed", "1.0").toDouble();
int strobe = element.attribute("strobe", "1").toInt();
QString url = QString::fromUtf8(prod->get("resource"));
- url.append('?' + QString::number(speed));
+ url.append('?' + locale.toString(speed));
if (strobe > 1) url.append("&strobe=" + QString::number(strobe));
Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
if (!slowprod || slowprod->get_producer() == NULL) {
if (strobe > 1) slowprod->set("strobe", strobe);
QString id = prod->parent().get("id");
if (id.contains('_')) id = id.section('_', 0, 0);
- QString producerid = "slowmotion:" + id + ':' + QString::number(speed);
+ QString producerid = "slowmotion:" + id + ':' + locale.toString(speed);
if (strobe > 1) producerid.append(':' + QString::number(strobe));
slowprod->set("id", producerid.toUtf8().constData());
m_slowmotionProducers.insert(url, slowprod);
kWarning() << "// TRACTOR PROBLEM";
return false;
}
-
+ //service.lock();
Mlt::Tractor tractor(service);
- mlt_service_lock(service.get_service());
Mlt::Producer trackProducer(tractor.track(track));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipIndex = trackPlaylist.get_clip_index_at((int) position.frames(m_fps));
- // Display playlist info
- //kDebug() << "//// BEFORE -( " << position.frames(m_fps) << " )-------------------------------";
- /*for (int i = 0; i < trackPlaylist.count(); i++) {
- int blankStart = trackPlaylist.clip_start(i);
- int blankDuration = trackPlaylist.clip_length(i) - 1;
- QString blk;
- if (trackPlaylist.is_blank(i)) blk = "(blank)";
- kDebug()<<"CLIP "<<i<<": ("<<blankStart<<'x'<<blankStart + blankDuration<<")"<<blk;
- }*/
if (trackPlaylist.is_blank(clipIndex)) {
- kDebug() << "// WARNING, TRYING TO REMOVE A BLANK: " << position.frames(25);
- mlt_service_unlock(service.get_service());
+ kDebug() << "// WARNING, TRYING TO REMOVE A BLANK: " << position.frames(m_fps);
+ //mlt_service_unlock(service.get_service());
return false;
}
- //kDebug()<<"//// Deleting at: "<< (int) position.frames(m_fps) <<" --------------------------------------";
m_isBlocked = true;
Mlt::Producer *clip = trackPlaylist.replace_with_blank(clipIndex);
if (clip) delete clip;
trackPlaylist.consolidate_blanks(0);
- /*if (QString(clip.parent().get("transparency")).toInt() == 1)
- mltDeleteTransparency((int) position.frames(m_fps), track, QString(clip.parent().get("id")).toInt());*/
/* // Display playlist info
kDebug()<<"//// AFTER";
if (trackPlaylist.is_blank(i)) blk = "(blank)";
kDebug()<<"CLIP "<<i<<": ("<<blankStart<<'x'<<blankStart + blankDuration<<")"<<blk;
}*/
- mlt_service_unlock(service.get_service());
+ //service.unlock();
if (track != 0 && trackPlaylist.count() <= clipIndex) mltCheckLength(&tractor);
m_isBlocked = false;
return true;
kWarning() << "// TRACTOR PROBLEM";
return -1;
}
+
//kDebug() << "Changing clip speed, set in and out: " << info.cropStart.frames(m_fps) << " to " << (info.endPos - info.startPos).frames(m_fps) - 1;
Mlt::Tractor tractor(service);
Mlt::Producer trackProducer(tractor.track(info.track));
if ((serv == "avformat" || serv == "avformat-novalidate") && (speed != 1.0 || strobe > 1)) {
mlt_service_lock(service.get_service());
QString url = QString::fromUtf8(clipparent.get("resource"));
- url.append('?' + QString::number(speed));
+ url.append('?' + m_locale.toString(speed));
if (strobe > 1) url.append("&strobe=" + QString::number(strobe));
Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
if (!slowprod || slowprod->get_producer() == NULL) {
slowprod = new Mlt::Producer(*m_mltProfile, 0, ("framebuffer:" + url).toUtf8().constData());
if (strobe > 1) slowprod->set("strobe", strobe);
- QString producerid = "slowmotion:" + id + ':' + QString::number(speed);
+ QString producerid = "slowmotion:" + id + ':' + m_locale.toString(speed);
if (strobe > 1) producerid.append(':' + QString::number(strobe));
slowprod->set("id", producerid.toUtf8().constData());
// copy producer props
mlt_service_lock(service.get_service());
QString url = QString::fromUtf8(clipparent.get("resource"));
url = url.section('?', 0, 0);
- url.append('?' + QString::number(speed));
+ url.append('?' + m_locale.toString(speed));
if (strobe > 1) url.append("&strobe=" + QString::number(strobe));
Mlt::Producer *slowprod = m_slowmotionProducers.value(url);
if (!slowprod || slowprod->get_producer() == NULL) {
slowprod = new Mlt::Producer(*m_mltProfile, 0, ("framebuffer:" + url).toUtf8().constData());
slowprod->set("strobe", strobe);
- QString producerid = "slowmotion:" + id.section(':', 1, 1) + ':' + QString::number(speed);
+ QString producerid = "slowmotion:" + id.section(':', 1, 1) + ':' + m_locale.toString(speed);
if (strobe > 1) producerid.append(':' + QString::number(strobe));
slowprod->set("id", producerid.toUtf8().constData());
// copy producer props
// create filter
QString tag = params.paramValue("tag");
- kDebug() << " / / INSERTING EFFECT: " << tag << ", REGI: " << region;
+ //kDebug() << " / / INSERTING EFFECT: " << tag << ", REGI: " << region;
char *filterTag = qstrdup(tag.toUtf8().constData());
char *filterId = qstrdup(params.paramValue("id").toUtf8().constData());
QHash<QString, QString>::Iterator it;
if (!kfr.isEmpty()) {
QStringList keyFrames = kfr.split(';', QString::SkipEmptyParts);
- kDebug() << "// ADDING KEYFRAME EFFECT: " << params.paramValue("keyframes");
+ //kDebug() << "// ADDING KEYFRAME EFFECT: " << params.paramValue("keyframes");
char *starttag = qstrdup(params.paramValue("starttag", "start").toUtf8().constData());
char *endtag = qstrdup(params.paramValue("endtag", "end").toUtf8().constData());
- kDebug() << "// ADDING KEYFRAME TAGS: " << starttag << ", " << endtag;
+ //kDebug() << "// ADDING KEYFRAME TAGS: " << starttag << ", " << endtag;
//double max = params.paramValue("max").toDouble();
double min = params.paramValue("min").toDouble();
double factor = params.paramValue("factor", "1").toDouble();
}
filter->set("in", x1);
//kDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<<max<<", "<<y1<<", factor: "<<factor;
- filter->set(starttag, QString::number((min + y1) / factor).toUtf8().data());
+ filter->set(starttag, m_locale.toString((min + y1) / factor).toUtf8().data());
service.attach(*filter);
}
} else for (int i = 0; i < keyFrames.size() - 1; ++i) {
filter->set("in", x1);
filter->set("out", x2);
//kDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<<max<<", "<<y1<<", factor: "<<factor;
- filter->set(starttag, QString::number((min + y1) / factor).toUtf8().data());
- filter->set(endtag, QString::number((min + y2) / factor).toUtf8().data());
+ filter->set(starttag, m_locale.toString((min + y1) / factor).toUtf8().data());
+ filter->set(endtag, m_locale.toString((min + y2) / factor).toUtf8().data());
service.attach(*filter);
offset = 1;
}
return false;
}
m_isBlocked++;
- kDebug() << "// TRYING TO UPDATE CLIP at: " << pos << ", TK: " << track;
+ //kDebug() << "// TRYING TO UPDATE CLIP at: " << pos << ", TK: " << track;
Mlt::Service service(m_mltProducer->parent().get_service());
if (service.type() != tractor_type) {
kWarning() << "// TRACTOR PROBLEM";
Mlt::Producer trackProducer(tractor.track(startTrack));
Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
int clipIndex = trackPlaylist.get_clip_index_at(moveStart);
- kDebug() << "////// LOOKING FOR CLIP TO MOVE, INDEX: " << clipIndex;
+ //kDebug() << "////// LOOKING FOR CLIP TO MOVE, INDEX: " << clipIndex;
bool checkLength = false;
if (endTrack == startTrack) {
Mlt::Producer *clipProducer = trackPlaylist.replace_with_blank(clipIndex);
{
if (oldTag == tag && !force) mltUpdateTransitionParams(tag, a_track, b_track, in, out, xml);
else {
- kDebug()<<"// DELETING TRANS: "<<a_track<<"-"<<b_track;
+ //kDebug()<<"// DELETING TRANS: "<<a_track<<"-"<<b_track;
mltDeleteTransition(oldTag, a_track, b_track, in, out, xml, false);
mltAddTransition(tag, a_track, b_track, in, out, xml, false);
}
QString resource = mlt_properties_get(properties, "mlt_service");
const int old_pos = (int)((in + out).frames(m_fps) / 2);
- kDebug() << " del trans pos: " << in.frames(25) << "-" << out.frames(25);
+ //kDebug() << " del trans pos: " << in.frames(25) << "-" << out.frames(25);
while (mlt_type == "transition") {
mlt_transition tr = (mlt_transition) nextservice;
map[name] = e.attribute("value");
}
if (e.attribute("type") != "addedgeometry" && !e.attribute("factor").isEmpty() && e.attribute("factor").toDouble() > 0) {
- map[name] = QString::number(map.value(name).toDouble() / e.attribute("factor").toDouble());
+ map[name] = m_locale.toString(map.value(name).toDouble() / e.attribute("factor").toDouble());
//map[name]=map[name].replace(".",","); //FIXME how to solve locale conversion of . ,
}
/** @brief A human-readable description of this renderer. */
int m_winid;
+ QLocale m_locale;
+
void closeMlt();
void mltCheckLength(Mlt::Tractor *tractor);
void mltPasteEffects(Mlt::Producer *source, Mlt::Producer *dest);
double fps = (double) m_profile.frame_rate_num / m_profile.frame_rate_den;
guideStart = m_view.guide_start->itemData(m_view.guide_start->currentIndex()).toDouble();
guideEnd = m_view.guide_end->itemData(m_view.guide_end->currentIndex()).toDouble();
- render_process_args << "in=" + QString::number(GenTime(guideStart).frames(fps)) << "out=" + QString::number(GenTime(guideEnd).frames(fps));
+ render_process_args << "in=" + QString::number((int) GenTime(guideStart).frames(fps)) << "out=" + QString::number((int) GenTime(guideEnd).frames(fps));
}
if (!overlayargs.isEmpty()) render_process_args << "preargs=" + overlayargs.join(" ");
if (isOn) {
m_frame_preview->setHidden(true);
m_videoBox->setHidden(false);
+ QLocale locale;
MltVideoProfile profile;
QString resource;
}
capture_button->setEnabled(true);
live_button->setChecked(true);
- log_box->insertItem(-1, i18n("Playing %1x%2 (%3 fps)", profile.width, profile.height, QString::number((double)profile.frame_rate_num/profile.frame_rate_den).rightJustified(2, '0')));
+ log_box->insertItem(-1, i18n("Playing %1x%2 (%3 fps)", profile.width, profile.height, locale.toString((double)profile.frame_rate_num/profile.frame_rate_den).rightJustified(2, '0')));
log_box->setCurrentIndex(0);
}
else {
const QString Timecode::getTimecodeFrames(const GenTime & time) const
{
- return QString::number(time.frames(m_realFps));
+ return QString::number((int) time.frames(m_realFps));
}
const QString Timecode::getTimecodeSeconds(const GenTime & time) const
{
- return QString::number(time.seconds());
+ QLocale locale;
+ return locale.toString(time.seconds());
}
const QString Timecode::getTimecodeDropFrame(const GenTime & time) const
slotChangeZoom(m_doc->zoom().x(), m_doc->zoom().y());
slotSetZone(m_doc->zone(), false);
+ setEnabled(!doc->isReadOnly());
}
TrackView::~TrackView()
// parse project tracks
QDomElement mlt = doc.firstChildElement("mlt");
+ if (mlt.hasAttribute("LC_NUMERIC")) m_locale = QLocale(mlt.attribute("LC_NUMERIC"));
QDomElement tractor = mlt.firstChildElement("tractor");
QDomNodeList tracks = tractor.elementsByTagName("track");
QDomNodeList playlists = doc.elementsByTagName("playlist");
QDomNode n = producers.item(i);
e = n.toElement();
- /*
- // Check for invalid markup
- QDomNodeList params = e.elementsByTagName("property");
- for (int j = 0; j < params.count(); j++) {
- QDomElement p = params.item(j).toElement();
- if (p.attribute("name") == "markup") {
- QString val = p.text().toUtf8().data();
- kDebug()<<"//FOUND MARKUP, VAL: "<<val;
- //e.setAttribute("value", value);
- n.removeChild(params.item(j));
- break;
- }
- }
- */
-
if (e.hasAttribute("in") == false && e.hasAttribute("out") == false) continue;
int in = e.attribute("in").toInt();
int out = e.attribute("out").toInt();
// When adding composite transition, check if it is a wipe transition
if (mlt_geometry.count(';') == 1) {
mlt_geometry.remove(QChar('%'), Qt::CaseInsensitive);
- mlt_geometry.replace(QChar('x'), QChar(','), Qt::CaseInsensitive);
- QString start = mlt_geometry.section(';', 0, 0);
- start = start.section(':', 0, 1);
- start.replace(QChar(':'), QChar(','), Qt::CaseInsensitive);
- QString end = mlt_geometry.section('=', 1, 1);
- end = end.section(':', 0, 1);
- end.replace(QChar(':'), QChar(','), Qt::CaseInsensitive);
- start.append(',' + end);
- QStringList numbers = start.split(',', QString::SkipEmptyParts);
+ mlt_geometry.replace(QChar('x'), QChar(':'), Qt::CaseInsensitive);
+ mlt_geometry.replace(QChar(','), QChar(':'), Qt::CaseInsensitive);
+ mlt_geometry.replace(QChar('/'), QChar(':'), Qt::CaseInsensitive);
+
+ QString start = mlt_geometry.section('=', 0, 0).section(':', 0, -2) + ':';
+ start.append(mlt_geometry.section('=', 1, 1).section(':', 0, -2));
+ QStringList numbers = start.split(':', QString::SkipEmptyParts);
bool isWipeTransition = true;
int checkNumber;
for (int i = 0; i < numbers.size(); ++i) {
QString service = EffectsList::property(prod, "mlt_service");
QString type = EffectsList::property(prod, "mlt_type");
QString resource = EffectsList::property(prod, "resource");
- if (!resource.startsWith('/') && service != "colour") resource.prepend(docRoot);
+ if (!resource.startsWith('/') && service != "colour") {
+ resource.prepend(docRoot);
+ kDebug()<<"******************\nADJUSTED 1\n*************************";
+ }
QString length = EffectsList::property(prod, "length");
producerXml.setAttribute("mlt_service", service);
producerXml.setAttribute("mlt_type", type);
// add first keyframe
if (effectout <= effectin) {
// there is only one keyframe
- keyframes.append(QString::number(effectin) + ':' + QString::number(startvalue) + ';');
- } else keyframes.append(QString::number(effectin) + ':' + QString::number(startvalue) + ';' + QString::number(effectout) + ':' + QString::number(endvalue) + ';');
+ keyframes.append(QString::number(effectin) + ':' + m_locale.toString(startvalue) + ';');
+ } else keyframes.append(QString::number(effectin) + ':' + m_locale.toString(startvalue) + ';' + QString::number(effectout) + ':' + QString::number(endvalue) + ';');
QDomNode lastParsedEffect;
ix++;
QDomNode n2 = effects.at(ix);
}
}
if (continueParsing) {
- keyframes.append(QString::number(effectout) + ':' + QString::number(endvalue) + ';');
+ keyframes.append(QString::number(effectout) + ':' + m_locale.toString(endvalue) + ';');
ix++;
}
}
QStringList kfrs = paramvalue.split(";");
for (int l = 0; l < kfrs.count(); l++) {
QString fr = kfrs.at(l).section('=', 0, 0);
- double val = kfrs.at(l).section('=', 1, 1).toDouble();
- kfrs[l] = fr + ":" + QString::number((int)(val * fact));
+ double val = m_locale.toDouble(kfrs.at(l).section('=', 1, 1));
+ //kfrs[l] = fr + ":" + m_locale.toString((int)(val * fact));
+ kfrs[l] = fr + ":" + QString::number((int) (val * fact));
}
e.setAttribute("keyframes", kfrs.join(";"));
} else if (type == "double" || type == "constant") {
bool ok;
- e.setAttribute("value", paramvalue.toDouble(&ok) * fact);
+ e.setAttribute("value", m_locale.toDouble(paramvalue, &ok) * fact);
if (!ok)
e.setAttribute("value", paramvalue);
} else {
if (slowmotionClip) resource = resource.section('?', 0, 0);
// prepend MLT XML document root if no path in clip resource and not a color clip
- if (!resource.startsWith('/') && service != "colour") resource.prepend(docRoot);
+ if (!resource.startsWith('/') && service != "colour") {
+ resource.prepend(docRoot);
+ kDebug()<<"******************\nADJUSTED 2\n*************************";
+ }
DocClipBase *missingClip = NULL;
if (!resource.isEmpty()) {
QList <DocClipBase *> list = m_doc->clipManager()->getClipByResource(resource);
KdenliveDoc *m_doc;
int m_verticalZoom;
QString m_documentErrors;
+ QLocale m_locale;
void parseDocument(QDomDocument doc);
int slotAddProjectTrack(int ix, QDomElement xml, bool locked, QDomNodeList producers);
DocClipBase *getMissingProducer(const QString id) const;