From 1e007c2d73386e714ed480aba390b827e181994a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Thu, 14 Jul 2011 21:06:38 +0000 Subject: [PATCH] Required changes to make Kdenlive work with some locales that have a comma (,) as numeric separator. Also now documents with a different locale will open as read only. Sadly this breaks the string freeze by introducing a new string and probably messing up some effects translation, since I changed the "paramlist" type to use ';' as separator instead of ','. svn path=/trunk/kdenlive/; revision=5793 --- CMakeLists.txt | 7 +-- data/kdenliveeffectscategory.rc | 6 +- effects/audiopan.xml | 2 +- effects/channelcopy.xml | 4 +- effects/frei0r_alpha0ps.xml | 6 +- effects/frei0r_alphagrad.xml | 4 +- effects/frei0r_alphaspot.xml | 6 +- effects/frei0r_bezier_curves.xml | 6 +- effects/frei0r_c0rners.xml | 6 +- effects/frei0r_coloradj_rgb.xml | 6 +- effects/frei0r_curves.xml | 4 +- effects/frei0r_defish0r.xml | 10 ++-- effects/frei0r_facedetect.xml | 4 +- effects/frei0r_levels.xml | 4 +- effects/frei0r_pr0be.xml | 4 +- effects/frei0r_pr0file.xml | 6 +- effects/frei0r_select0r.xml | 10 ++-- effects/mirror.xml | 2 +- effects/obscure.xml | 2 +- effects/rotoscoping.xml | 4 +- effects/sox_flanger.xml | 4 +- src/beziercurve/cubicbezierspline.cpp | 9 +-- src/clipitem.cpp | 53 ++++++++++-------- src/clipproperties.cpp | 3 +- src/colorscopes/vectorscope.cpp | 9 +-- src/customtrackview.cpp | 31 +++++++---- src/customtrackview.h | 1 + src/documentvalidator.cpp | 19 ++++++- src/dvdwizard.cpp | 4 +- src/effectstackedit.cpp | 48 ++++++++-------- src/initeffects.cpp | 43 ++++++++++++--- src/kdenlivedoc.cpp | 8 ++- src/kdenlivedoc.h | 2 + src/kis_cubic_curve.cpp | 12 ++-- src/kthumb.cpp | 3 - src/mainwindow.cpp | 21 +++++-- src/mainwindow.h | 3 + src/mltdevicecapture.cpp | 20 +------ src/profilesdialog.cpp | 6 +- src/projectlist.cpp | 52 ++++++++++++------ src/projectlist.h | 2 +- src/projectsettings.cpp | 3 +- src/renderer.cpp | 79 +++++++++++---------------- src/renderer.h | 2 + src/renderwidget.cpp | 2 +- src/stopmotion/stopmotion.cpp | 3 +- src/timecode.cpp | 5 +- src/trackview.cpp | 56 ++++++++----------- src/trackview.h | 1 + 49 files changed, 340 insertions(+), 267 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91716399..19557a17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,15 +14,14 @@ include(MacroLibrary) 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}) diff --git a/data/kdenliveeffectscategory.rc b/data/kdenliveeffectscategory.rc index 5bc3c74f..1a5a09f9 100644 --- a/data/kdenliveeffectscategory.rc +++ b/data/kdenliveeffectscategory.rc @@ -8,7 +8,7 @@ Colour - Crop & transform + Crop and transform Audio correction @@ -22,8 +22,8 @@ Fun - - Blur & hide + + Blur and hide Motion diff --git a/effects/audiopan.xml b/effects/audiopan.xml index 97b2b3ed..4f01812c 100644 --- a/effects/audiopan.xml +++ b/effects/audiopan.xml @@ -3,7 +3,7 @@ Pan Adjust the left/right spread of a channel Dan Dennedy - + Left,Right Channel diff --git a/effects/channelcopy.xml b/effects/channelcopy.xml index 1cfac8e8..9223899d 100644 --- a/effects/channelcopy.xml +++ b/effects/channelcopy.xml @@ -3,11 +3,11 @@ Mono to stereo Copy one channel to another Dan Dennedy - + Left,Right From - + Left,Right To diff --git a/effects/frei0r_alpha0ps.xml b/effects/frei0r_alpha0ps.xml index 7ac05659..cb1a57b7 100644 --- a/effects/frei0r_alpha0ps.xml +++ b/effects/frei0r_alpha0ps.xml @@ -1,10 +1,10 @@ - + Alpha operations Display and manipulation of the alpha channel Marko Cebokli - + Image,Alpha as gray,Gray + red,Selection on black,Selection on gray,Selection on white,Selection on checkers Display @@ -13,7 +13,7 @@ Display input alpha - + NO OP,Shave,Shrink hard,Shrink soft,Grow hard,Grow soft,Threshold Operation diff --git a/effects/frei0r_alphagrad.xml b/effects/frei0r_alphagrad.xml index 4c516cce..e970893f 100644 --- a/effects/frei0r_alphagrad.xml +++ b/effects/frei0r_alphagrad.xml @@ -1,5 +1,5 @@ - + Alpha gradient Fill the alpha channel with a specified gradient Marko Cebokli @@ -25,7 +25,7 @@ Max - + Write on clear,Max,Min,Add,Subtract Operation diff --git a/effects/frei0r_alphaspot.xml b/effects/frei0r_alphaspot.xml index 748fd7da..e31d4e9e 100644 --- a/effects/frei0r_alphaspot.xml +++ b/effects/frei0r_alphaspot.xml @@ -1,11 +1,11 @@ - + Alpha shapes Draws simple shapes into the alpha channel Marko Cebokli - + Rectangle,Ellipse,Triangle,Diamond Shape @@ -42,7 +42,7 @@ Max - + Write on clear,Max,Min,Add,Subtract Operation diff --git a/effects/frei0r_bezier_curves.xml b/effects/frei0r_bezier_curves.xml index 61374e9d..e87f1a66 100644 --- a/effects/frei0r_bezier_curves.xml +++ b/effects/frei0r_bezier_curves.xml @@ -1,15 +1,15 @@ - + Bézier Curves Color curves adjustment Till Theato, Maksim Golovkin - + RGB,Red,Green,Blue,Alpha,Luma,Hue,Saturation Channel - + Rec. 601,Rec. 709 Luma formula diff --git a/effects/frei0r_c0rners.xml b/effects/frei0r_c0rners.xml index def9d3c2..4ddb7467 100644 --- a/effects/frei0r_c0rners.xml +++ b/effects/frei0r_c0rners.xml @@ -1,5 +1,5 @@ - + Corners Four corners geometry engine Marko Cebokli @@ -52,7 +52,7 @@ Enable Stretch - + Nearest neighbor,Bilinear,Bicubic smooth,Bicubic sharp,Spline 4x4,Spline 6x6,Lanczos Interpolator @@ -61,7 +61,7 @@ Transparent Background - + Write on clear,Maximum,Minimum,Add,Subtract Alpha operation diff --git a/effects/frei0r_coloradj_rgb.xml b/effects/frei0r_coloradj_rgb.xml index b5abd62b..f8adceca 100644 --- a/effects/frei0r_coloradj_rgb.xml +++ b/effects/frei0r_coloradj_rgb.xml @@ -1,5 +1,5 @@ - + RGB adjustment Simple color adjustment Marko Cebokli @@ -16,7 +16,7 @@ B - + Add constant,Change gamma,Multiply Action @@ -29,7 +29,7 @@ Alpha controlled - + Rec. 601,Rec. 709 Luma formula diff --git a/effects/frei0r_curves.xml b/effects/frei0r_curves.xml index 690691d9..aeb79647 100644 --- a/effects/frei0r_curves.xml +++ b/effects/frei0r_curves.xml @@ -3,7 +3,7 @@ Curves Color curves adjustment Maksim Golovkin - + Red,Green,Blue,Luma Channel @@ -51,7 +51,7 @@ Show graph in picture - + Top Left,Top Right,Bottom Left,Bottom Right Graph position diff --git a/effects/frei0r_defish0r.xml b/effects/frei0r_defish0r.xml index 77ccb219..ad90a582 100644 --- a/effects/frei0r_defish0r.xml +++ b/effects/frei0r_defish0r.xml @@ -1,5 +1,5 @@ - + Defish Non rectilinear lens mappings Marko Cebokli @@ -9,22 +9,22 @@ DeFish - + Equidistant,Orthographic,Equiarea,Stereographic Type - + Fill,Center,Fit,Manual Scaling Manual Scale - + Nearest neighbor,Bilinear,Bicubic smooth,Bicubic sharp,Spline 4x4,Spline 6x6,Lanczos Interpolator - + Square,PAL DV,NTSC DV,HDV,Manual Aspect type diff --git a/effects/frei0r_facedetect.xml b/effects/frei0r_facedetect.xml index c4ac254f..3bfe379d 100644 --- a/effects/frei0r_facedetect.xml +++ b/effects/frei0r_facedetect.xml @@ -1,5 +1,5 @@ - + Face detect Detect faces and draw shapes on them using OpenCV binarymillenium, Dan Dennedy @@ -24,7 +24,7 @@ How often to detect a face. In between checks, it does object motion tracking. - + circle,ellipse,rectangle,random Shape diff --git a/effects/frei0r_levels.xml b/effects/frei0r_levels.xml index 470702de..2c80efc8 100644 --- a/effects/frei0r_levels.xml +++ b/effects/frei0r_levels.xml @@ -3,7 +3,7 @@ Levels Adjust levels Maksim Golovkin - + Red,Green,Blue,Luma Channel @@ -25,7 +25,7 @@ Show histogram - + Top Left,Top Right,Bottom Left,Bottom Right Histogram position diff --git a/effects/frei0r_pr0be.xml b/effects/frei0r_pr0be.xml index 375806f2..6bd6e977 100644 --- a/effects/frei0r_pr0be.xml +++ b/effects/frei0r_pr0be.xml @@ -1,10 +1,10 @@ - + pr0be Measure video values Marko Cebokli - + RGB,Y'PbPr - rec. 601,Y'PbPr - rec. 709,HSV,HSL Measurement diff --git a/effects/frei0r_pr0file.xml b/effects/frei0r_pr0file.xml index afd55119..94adb4a3 100644 --- a/effects/frei0r_pr0file.xml +++ b/effects/frei0r_pr0file.xml @@ -1,5 +1,5 @@ - + pr0file 2D video oscilloscope Marko Cebokli @@ -20,7 +20,7 @@ Length - + R,G,B,Y',Pr,Pb,Alpha Channel @@ -81,7 +81,7 @@ 256 scale - + CCIR rec. 601,CCIR rec. 709 Color diff --git a/effects/frei0r_select0r.xml b/effects/frei0r_select0r.xml index b96877e2..76473186 100644 --- a/effects/frei0r_select0r.xml +++ b/effects/frei0r_select0r.xml @@ -1,5 +1,5 @@ - + Color Selection Color based alpha selection Marko Cebokli @@ -24,22 +24,22 @@ Delta B / I / I - + RGB,ABI,HCI Selection subspace - + Box,Ellipsoid,Diamond Subspace shape - + Hard,Fat,Normal,Skinny Edge mode - + Write on clear,Max,Min,Add,Subtract Operation diff --git a/effects/mirror.xml b/effects/mirror.xml index 7ca6557d..9f905c45 100644 --- a/effects/mirror.xml +++ b/effects/mirror.xml @@ -3,7 +3,7 @@ Mirror Flip your image in any direction Charles Yates - + Mirroring direction diff --git a/effects/obscure.xml b/effects/obscure.xml index 83e61e74..cf5f3085 100644 --- a/effects/obscure.xml +++ b/effects/obscure.xml @@ -3,7 +3,7 @@ Obscure Hide a region of the clip Charles Yates - + Region diff --git a/effects/rotoscoping.xml b/effects/rotoscoping.xml index 6e565938..afdd481c 100644 --- a/effects/rotoscoping.xml +++ b/effects/rotoscoping.xml @@ -4,12 +4,12 @@ Keyframable vector based rotoscoping Till Theato - + Alpha,Luma,RGB Mode - + Write on clear,Maximum,Minimum,Add,Subtract Alpha Operation diff --git a/effects/sox_flanger.xml b/effects/sox_flanger.xml index a0a4e3ee..515b3d43 100644 --- a/effects/sox_flanger.xml +++ b/effects/sox_flanger.xml @@ -18,13 +18,13 @@ Speed - + Shape Phase - + Interpolation diff --git a/src/beziercurve/cubicbezierspline.cpp b/src/beziercurve/cubicbezierspline.cpp index 175aed21..13b1b73e 100644 --- a/src/beziercurve/cubicbezierspline.cpp +++ b/src/beziercurve/cubicbezierspline.cpp @@ -17,7 +17,7 @@ ***************************************************************************/ #include "cubicbezierspline.h" - +#include /** @brief For sorting a Bezier spline. Whether a is before b. */ static bool pointLessThan(const BPoint &a, const BPoint &b) @@ -69,10 +69,11 @@ void CubicBezierSpline::fromString(const QString& spline) 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("|"); } diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 2af20baf..f761acf6 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -320,6 +320,7 @@ void ClipItem::initEffect(QDomElement effect, int diff) 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); @@ -340,7 +341,7 @@ bool ClipItem::checkKeyFrames() // 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; @@ -350,7 +351,7 @@ bool ClipItem::checkKeyFrames() 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; @@ -362,12 +363,12 @@ bool ClipItem::checkKeyFrames() 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; @@ -392,6 +393,7 @@ void ClipItem::setKeyframes(const int ix, const QStringList keyframes) { 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++) { @@ -401,17 +403,17 @@ void ClipItem::setKeyframes(const int ix, const QStringList keyframes) 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; @@ -427,6 +429,7 @@ void ClipItem::setKeyframes(const int ix, const QStringList keyframes) 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"); @@ -436,18 +439,18 @@ void ClipItem::setSelectedEffect(const int ix) 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()) @@ -1362,6 +1365,7 @@ void ClipItem::setEffectAt(int ix, QDomElement effect) EffectsParameterList ClipItem::addEffect(const QDomElement effect, bool /*animate*/) { bool needRepaint = false; + QLocale locale; int ix; if (!effect.hasAttribute("kdenlive_ix")) { ix = effectsCounter(); @@ -1398,12 +1402,12 @@ EffectsParameterList ClipItem::addEffect(const QDomElement effect, bool /*animat } 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(";")); @@ -1466,8 +1470,8 @@ EffectsParameterList ClipItem::addEffect(const QDomElement effect, bool /*animat 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)); } } } @@ -1648,6 +1652,7 @@ bool ClipItem::isVideoOnly() const 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"); @@ -1660,14 +1665,14 @@ void ClipItem::insertKeyframe(QDomElement effect, int pos, int val) 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); @@ -1686,6 +1691,7 @@ void ClipItem::insertKeyframe(QDomElement effect, int pos, int val) 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); @@ -1703,7 +1709,7 @@ void ClipItem::movedKeyframe(QDomElement effect, int oldpos, int newpos, double 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)); } @@ -1719,6 +1725,7 @@ void ClipItem::movedKeyframe(QDomElement effect, int oldpos, int newpos, double void ClipItem::updateKeyframes(QDomElement effect) { m_keyframes.clear(); + QLocale locale; // parse keyframes QDomNodeList params = effect.elementsByTagName("parameter"); QDomElement e = params.item(m_visibleParam).toElement(); @@ -1730,7 +1737,7 @@ void ClipItem::updateKeyframes(QDomElement effect) 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; @@ -1830,11 +1837,12 @@ bool ClipItem::updateNormalKeyframes(QDomElement parameter) { 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 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::iterator i = keyframes.end(); @@ -1929,3 +1937,4 @@ void ClipItem::slotGotThumbsCache() } #include "clipitem.moc" + diff --git a/src/clipproperties.cpp b/src/clipproperties.cpp index 5d1c9b40..f9d79573 100644 --- a/src/clipproperties.cpp +++ b/src/clipproperties.cpp @@ -711,6 +711,7 @@ const QString &ClipProperties::clipId() const QMap ClipProperties::properties() { QMap props; + QLocale locale; CLIPTYPE t = UNKNOWN; if (m_clip != NULL) { t = m_clip->clipType(); @@ -741,7 +742,7 @@ QMap ClipProperties::properties() 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()) { diff --git a/src/colorscopes/vectorscope.cpp b/src/colorscopes/vectorscope.cpp index 2802a5d4..fc98f1c7 100644 --- a/src/colorscopes/vectorscope.cpp +++ b/src/colorscopes/vectorscope.cpp @@ -215,7 +215,7 @@ QImage Vectorscope::renderHUD(uint) { QImage hud; - + QLocale locale; if (m_mouseWithinWidget) { // Mouse moved: Draw a circle over the scope @@ -247,10 +247,10 @@ QImage Vectorscope::renderHUD(uint) } 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 { @@ -505,8 +505,9 @@ QImage Vectorscope::renderBackground(uint) 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(); } diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 4fddc3a6..7faf8a2a 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -130,7 +130,7 @@ CustomTrackView::CustomTrackView(KdenliveDoc *doc, CustomTrackScene* projectscen m_commandStack = doc->commandStack(); else m_commandStack = NULL; - + m_ct = 0; setMouseTracking(true); setAcceptDrops(true); setFrameShape(QFrame::NoFrame); @@ -3711,9 +3711,15 @@ void CustomTrackView::mouseReleaseEvent(QMouseEvent * event) 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: "<fps())<<", "<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: "<fps())<<", TK: "<renderer()->saveSceneList(QString("/tmp/error%1.mlt").arg(m_ct), QDomElement()); + exit(1); return; } m_waitingThumbs.removeAll(item); @@ -5514,6 +5520,7 @@ void CustomTrackView::adjustKeyfames(GenTime oldstart, GenTime newstart, GenTime // 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(); @@ -5527,9 +5534,9 @@ void CustomTrackView::adjustKeyfames(GenTime oldstart, GenTime newstart, GenTime 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: "<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); @@ -5680,8 +5687,8 @@ void CustomTrackView::saveThumbnails() } 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); @@ -5809,6 +5816,7 @@ void CustomTrackView::autoTransition() 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(); @@ -5817,7 +5825,7 @@ QStringList CustomTrackView::getLadspaParams(QDomElement effect) const 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")); } } @@ -6531,6 +6539,7 @@ void CustomTrackView::slotAddTrackEffect(const QDomElement effect, int ix) 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")); @@ -6554,7 +6563,7 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement effect) 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(";")); @@ -6589,7 +6598,7 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement effect) 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")); } diff --git a/src/customtrackview.h b/src/customtrackview.h index 8b0b2da5..36f94626 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -282,6 +282,7 @@ protected: virtual Qt::DropActions supportedDropActions() const; private: + int m_ct; int m_tracksHeight; int m_projectDuration; int m_cursorPos; diff --git a/src/documentvalidator.cpp b/src/documentvalidator.cpp index 44fd3a41..d3eda935 100644 --- a/src/documentvalidator.cpp +++ b/src/documentvalidator.cpp @@ -48,8 +48,25 @@ bool DocumentValidator::validate(const double currentVersion) // 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; /* diff --git a/src/dvdwizard.cpp b/src/dvdwizard.cpp index fe997c0a..9f5ee443 100644 --- a/src/dvdwizard.cpp +++ b/src/dvdwizard.cpp @@ -305,9 +305,9 @@ void DvdWizard::generateDvd() // 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++; } diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 3d4a481f..f66cfaf1 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -281,7 +281,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool } 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(','); @@ -552,16 +552,17 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool 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; @@ -571,13 +572,13 @@ wipeInfo EffectStackEdit::getWipeInfo(QString value) 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; @@ -597,38 +598,38 @@ QString EffectStackEdit::getWipeString(wipeInfo info) 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)); @@ -638,6 +639,7 @@ QString EffectStackEdit::getWipeString(wipeInfo info) 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"); @@ -663,7 +665,7 @@ void EffectStackEdit::collectAllParameters() 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(); @@ -722,8 +724,8 @@ void EffectStackEdit::collectAllParameters() 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()) diff --git a/src/initeffects.cpp b/src/initeffects.cpp index 1c995ad2..e3fe464f 100644 --- a/src/initeffects.cpp +++ b/src/initeffects.cpp @@ -97,7 +97,7 @@ void initEffects::refreshLumas() 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; } } @@ -108,7 +108,7 @@ void initEffects::refreshLumas() 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; } } @@ -355,17 +355,24 @@ void initEffects::parseEffectFile(EffectsList *customEffectList, EffectsList *au 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; } @@ -373,6 +380,26 @@ void initEffects::parseEffectFile(EffectsList *customEffectList, EffectsList *au 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()); @@ -783,7 +810,7 @@ void initEffects::fillTransitionsList(Mlt::Repository *repository, EffectsList * 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") { @@ -795,7 +822,7 @@ void initEffects::fillTransitionsList(Mlt::Repository *repository, EffectsList * 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")); @@ -840,7 +867,7 @@ void initEffects::fillTransitionsList(Mlt::Repository *repository, EffectsList * 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")); diff --git a/src/kdenlivedoc.cpp b/src/kdenlivedoc.cpp index db62a28b..e190123f 100644 --- a/src/kdenlivedoc.cpp +++ b/src/kdenlivedoc.cpp @@ -389,7 +389,7 @@ QDomDocument KdenliveDoc::createEmptyDocument(QList tracks) 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); @@ -961,6 +961,7 @@ void KdenliveDoc::setUrl(KUrl url) void KdenliveDoc::setModified(bool mod) { + if (isReadOnly()) return; if (!m_url.isEmpty() && mod && KdenliveSettings::crashrecovery()) { m_autoSaveTimer->start(3000); } @@ -1636,6 +1637,11 @@ void KdenliveDoc::backupLastSavedVersion(const QString &path) } } +bool KdenliveDoc::isReadOnly() const +{ + return m_documentProperties.contains("readonly"); +} + void KdenliveDoc::cleanupBackupFiles() { KUrl backupFile = m_projectFolder; diff --git a/src/kdenlivedoc.h b/src/kdenlivedoc.h index 958c59cf..0d1cd569 100644 --- a/src/kdenlivedoc.h +++ b/src/kdenlivedoc.h @@ -163,6 +163,8 @@ Q_OBJECT public: 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; diff --git a/src/kis_cubic_curve.cpp b/src/kis_cubic_curve.cpp index 849d57b9..55b12233 100644 --- a/src/kis_cubic_curve.cpp +++ b/src/kis_cubic_curve.cpp @@ -24,6 +24,7 @@ #include #include #include +#include template class KisTridiagonalSystem @@ -402,9 +403,10 @@ void KisCubicCurve::removePoint(int idx) 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 += ';'; } @@ -418,10 +420,10 @@ void KisCubicCurve::fromString(const QString& string) QList 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); } } diff --git a/src/kthumb.cpp b/src/kthumb.cpp index 6392f2b0..8fa3d6aa 100644 --- a/src/kthumb.cpp +++ b/src/kthumb.cpp @@ -174,9 +174,6 @@ QImage KThumb::getFrame(Mlt::Producer *producer, int framepos, int width, int he 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; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 7574120f..ccda3a2c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -154,8 +154,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & 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); @@ -2030,7 +2029,8 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) 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); @@ -2086,6 +2086,13 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale) 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); } @@ -2366,7 +2373,7 @@ void MainWindow::slotUpdateMousePosition(int pos) 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) { @@ -2527,6 +2534,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc) //cha 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())); @@ -4362,6 +4370,11 @@ void MainWindow::slotBlockClipMonitor(const QString id) } +void MainWindow::slotElapsedTime() +{ + kDebug()<<"-----------------------------------------\n"<<"Time elapsed: "<winId()), - analyseAudio(KdenliveSettings::monitor_audio()), - processingImage(false) + m_winid((int) surface->winId()) { if (profile.isEmpty()) profile = KdenliveSettings::current_profile(); buildConsumer(profile); @@ -196,20 +196,6 @@ void MltDeviceCapture::stop() 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; } diff --git a/src/profilesdialog.cpp b/src/profilesdialog.cpp index 156aa17e..68aff469 100644 --- a/src/profilesdialog.cpp +++ b/src/profilesdialog.cpp @@ -569,7 +569,7 @@ void ProfilesDialog::slotUpdateDisplay(QString currentProfile) 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('/'); @@ -589,9 +589,9 @@ void ProfilesDialog::slotUpdateDisplay(QString currentProfile) 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()); diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 666036d4..ab153157 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -1024,7 +1024,9 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties) 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()); @@ -1071,8 +1073,10 @@ void ProjectList::slotAddClip(DocClipBase *clip, bool getProperties) 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) @@ -1107,8 +1111,11 @@ void ProjectList::slotGotProxy(ProjectItem *item) } } 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() @@ -1120,25 +1127,20 @@ 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::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 @@ -1176,7 +1178,7 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged) 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 @@ -1202,7 +1204,10 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged) 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); @@ -1240,7 +1245,12 @@ void ProjectList::updateAllClips(bool displayRatioChanged, bool fpsChanged) ++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); @@ -1356,7 +1366,8 @@ void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace) 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; @@ -1390,7 +1401,8 @@ void ProjectList::slotRemoveInvalidProxy(const QString &id, bool durationError) } 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() @@ -1510,6 +1522,7 @@ void ProjectList::setDocument(KdenliveDoc *doc) m_timecode = doc->timecode(); m_commandStack = doc->commandStack(); m_doc = doc; + setEnabled(!m_doc->isReadOnly()); QMap flist = doc->clipManager()->documentFolderList(); QStringList openedFolders = doc->getExpandedFolders(); @@ -1566,8 +1579,8 @@ void ProjectList::slotCheckForEmptyQueue() if (!m_refreshed) { emit loadingIsOver(); emit displayMessage(QString(), -1); + m_refreshed = true; } - m_refreshed = true; m_listView->blockSignals(false); m_listView->setEnabled(true); updateButtons(); @@ -1741,7 +1754,8 @@ void ProjectList::slotReplyGetFileProperties(const QString &clipId, Mlt::Produce 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) @@ -2434,7 +2448,8 @@ void ProjectList::updateProxyConfig() } 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) @@ -2483,6 +2498,7 @@ 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); } diff --git a/src/projectlist.h b/src/projectlist.h index b064f4ba..63c8f745 100644 --- a/src/projectlist.h +++ b/src/projectlist.h @@ -266,7 +266,6 @@ private: QToolButton *m_editButton; QMap m_infoQueue; QMap m_producerQueue; - void requestClipInfo(const QDomElement xml, const QString id); QList m_thumbnailQueue; QAction *m_proxyAction; QStringList m_processingClips; @@ -274,6 +273,7 @@ private: 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); diff --git a/src/projectsettings.cpp b/src/projectsettings.cpp index 5f5e902a..8edb9254 100644 --- a/src/projectsettings.cpp +++ b/src/projectsettings.cpp @@ -330,6 +330,7 @@ void ProjectSettings::accept() 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")); @@ -338,7 +339,7 @@ void ProjectSettings::slotUpdateDisplay() 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")); } diff --git a/src/renderer.cpp b/src/renderer.cpp index b96f1f6b..5a859b9a 100644 --- a/src/renderer.cpp +++ b/src/renderer.cpp @@ -556,6 +556,7 @@ void Render::slotSplitView(bool doit) 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"); @@ -590,7 +591,9 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int 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; } @@ -693,8 +696,8 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int // 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; } @@ -758,7 +761,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int } 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()) { @@ -796,7 +799,7 @@ void Render::getFileProperties(const QDomElement xml, const QString &clipId, int } 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); @@ -1146,7 +1149,6 @@ bool Render::saveSceneList(QString path, QDomElement kdenliveData) 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); @@ -1254,18 +1256,15 @@ void Render::slotOsdTimeout() 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(); } @@ -1277,13 +1276,12 @@ void Render::stop() { 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) { @@ -1292,13 +1290,10 @@ void Render::stop() //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); @@ -1639,12 +1634,12 @@ void Render::mltCheckLength(Mlt::Tractor *tractor) 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) { @@ -1652,7 +1647,7 @@ Mlt::Producer *Render::checkSlowMotionProducer(Mlt::Producer *prod, QDomElement 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); @@ -1879,34 +1874,21 @@ bool Render::mltRemoveClip(int track, GenTime position) 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 "< 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 @@ -2247,13 +2230,13 @@ int Render::mltChangeClipSpeed(ItemInfo info, ItemInfo speedIndependantInfo, dou 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 @@ -2476,7 +2459,7 @@ bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int // 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::Iterator it; @@ -2484,10 +2467,10 @@ bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int 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(); @@ -2510,7 +2493,7 @@ bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int } filter->set("in", x1); //kDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<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) { @@ -2530,8 +2513,8 @@ bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int filter->set("in", x1); filter->set("out", x2); //kDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<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; } @@ -3199,7 +3182,7 @@ bool Render::mltUpdateClipProducer(int track, int pos, Mlt::Producer *prod) 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"; @@ -3251,7 +3234,7 @@ bool Render::mltMoveClip(int startTrack, int endTrack, int moveStart, int moveEn 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); @@ -3486,7 +3469,7 @@ void Render::mltUpdateTransition(QString oldTag, QString tag, int a_track, int b { if (oldTag == tag && !force) mltUpdateTransitionParams(tag, a_track, b_track, in, out, xml); else { - kDebug()<<"// DELETING TRANS: "< Render::mltGetTransitionParamsFromXml(QDomElement xml) 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 . , } diff --git a/src/renderer.h b/src/renderer.h index 39690902..9749583b 100644 --- a/src/renderer.h +++ b/src/renderer.h @@ -306,6 +306,8 @@ private: /** @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); diff --git a/src/renderwidget.cpp b/src/renderwidget.cpp index 302f229e..8c2f9e9d 100644 --- a/src/renderwidget.cpp +++ b/src/renderwidget.cpp @@ -739,7 +739,7 @@ void RenderWidget::slotExport(bool scriptExport, int zoneIn, int zoneOut, const 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(" "); diff --git a/src/stopmotion/stopmotion.cpp b/src/stopmotion/stopmotion.cpp index 136273cd..1055d0c2 100644 --- a/src/stopmotion/stopmotion.cpp +++ b/src/stopmotion/stopmotion.cpp @@ -461,6 +461,7 @@ void StopmotionWidget::slotLive(bool isOn) if (isOn) { m_frame_preview->setHidden(true); m_videoBox->setHidden(false); + QLocale locale; MltVideoProfile profile; QString resource; @@ -499,7 +500,7 @@ void StopmotionWidget::slotLive(bool isOn) } 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 { diff --git a/src/timecode.cpp b/src/timecode.cpp index 3b574977..5e68e0d0 100644 --- a/src/timecode.cpp +++ b/src/timecode.cpp @@ -374,12 +374,13 @@ const QString Timecode::getTimecodeHH_MM_SS_HH(const GenTime & time) const 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 diff --git a/src/trackview.cpp b/src/trackview.cpp index 41ea5209..0e2bcd8a 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -118,6 +118,7 @@ TrackView::TrackView(KdenliveDoc *doc, bool *ok, QWidget *parent) : slotChangeZoom(m_doc->zoom().x(), m_doc->zoom().y()); slotSetZone(m_doc->zone(), false); + setEnabled(!doc->isReadOnly()); } TrackView::~TrackView() @@ -199,6 +200,7 @@ void TrackView::parseDocument(QDomDocument doc) // 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"); @@ -216,21 +218,6 @@ void TrackView::parseDocument(QDomDocument doc) 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: "< list = m_doc->clipManager()->getClipByResource(resource); diff --git a/src/trackview.h b/src/trackview.h index 5dcbd7e9..b7ea50db 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -100,6 +100,7 @@ private: 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; -- 2.39.2