From kde-commits Wed Dec 07 23:11:09 2016 From: Jean-Baptiste Mardelle Date: Wed, 07 Dec 2016 23:11:09 +0000 To: kde-commits Subject: [kdenlive] src: Merge branch '16.12' Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=148115228406045 Git commit 1c4d36900a9a50f2e8276c4f6bf7747464765c38 by Jean-Baptiste Mardel= le. Committed on 07/12/2016 at 23:09. Pushed by mardelle into branch 'master'. Merge branch '16.12' M +2 -2 src/effectstack/widgets/animationwidget.cpp M +2 -1 src/mltcontroller/effectscontroller.cpp M +1 -1 src/timeline/abstractclipitem.cpp M +14 -12 src/timeline/customtrackview.cpp M +39 -21 src/timeline/keyframeview.cpp M +1 -0 src/timeline/keyframeview.h https://commits.kde.org/kdenlive/1c4d36900a9a50f2e8276c4f6bf7747464765c38 diff --cc src/effectstack/widgets/animationwidget.cpp index 8e31f7eae,f290c6561..6da89ca46 --- a/src/effectstack/widgets/animationwidget.cpp +++ b/src/effectstack/widgets/animationwidget.cpp @@@ -728,13 -711,13 +728,13 @@@ void AnimationWidget::buildSliderWidget = double factor =3D e.hasAttribute(QStringLiteral("factor")) ? locale.t= oDouble(e.attribute(QStringLiteral("factor"))) : 1; DoubleParameterWidget *doubleparam =3D new DoubleParameterWidget(para= mName, 0, - e.attr= ibute(QStringLiteral("min")).toDouble(), e.attribute(QStringLiteral("max"))= .toDouble(), - e.attr= ibute(QStringLiteral("default")).toDouble() * factor, comment, index, e.att= ribute(QStringLiteral("suffix")), e.attribute(QStringLiteral("decimals")).t= oInt(), true, this); + e.attribute(QStringLiteral("min")).toDouble(), e.attribute(QS= tringLiteral("max")).toDouble(), + e.attribute(QStringLiteral("default")).toDouble() * factor, c= omment, index, e.attribute(QStringLiteral("suffix")), e.attribute(QStringLi= teral("decimals")).toInt(), true, this); doubleparam->setObjectName(paramTag); doubleparam->factor =3D factor; - connect(doubleparam, SIGNAL(valueChanged(double)), this, SLOT(slotAdj= ustKeyframeValue(double))); + connect(doubleparam, &DoubleParameterWidget::valueChanged, this, &Ani= mationWidget::slotAdjustKeyframeValue); layout()->addWidget(doubleparam); - if (!e.hasAttribute(QStringLiteral("intimeline")) || e.attribute(QStr= ingLiteral("intimeline")) =3D=3D QLatin1String("1")) { + if ((!e.hasAttribute(QStringLiteral("intimeline")) || e.attribute(QSt= ringLiteral("intimeline")) =3D=3D QLatin1String("1")) && !e.hasAttribute(QS= tringLiteral("notintimeline"))) { doubleparam->setInTimelineProperty(true); doubleparam->setChecked(true); m_inTimeline =3D paramTag; diff --cc src/mltcontroller/effectscontroller.cpp index 18f4da1a2,a63366e77..772ac90ae --- a/src/mltcontroller/effectscontroller.cpp +++ b/src/mltcontroller/effectscontroller.cpp @@@ -302,8 -273,9 +302,9 @@@ void EffectsController::initEffect(cons bool hasValue =3D e.hasAttribute(QStringLiteral("value")); // Check if this effect has a variable parameter, init effects de= fault value if ((type =3D=3D QLatin1String("animatedrect") || type =3D=3D QLa= tin1String("geometry")) && !hasValue) { - QString kfr =3D AnimationWidget::getDefaultKeyframes(info.cro= pStart.frames(fps), e.attribute(QStringLiteral("default")), type =3D=3D QLa= tin1String("geometry")); + int pos =3D type =3D=3D QLatin1String("geometry") ? 0 : info.= cropStart.frames(fps); + QString kfr =3D AnimationWidget::getDefaultKeyframes(pos, e.a= ttribute(QStringLiteral("default")), type =3D=3D QLatin1String("geometry")); - if (kfr.contains("%")) { + if (kfr.contains(QLatin1String("%"))) { kfr =3D EffectsController::getStringRectEval(pInfo, kfr); } e.setAttribute(QStringLiteral("value"), kfr); diff --cc src/timeline/abstractclipitem.cpp index 561ff2d46,7d51cd5fa..166496699 --- a/src/timeline/abstractclipitem.cpp +++ b/src/timeline/abstractclipitem.cpp @@@ -514,11 -479,9 +514,11 @@@ void AbstractClipItem::movedKeyframe(QD int end =3D (cropStart() + cropDuration()).frames(m_fps) - 1; for (int i =3D 0; i < params.count(); ++i) { QDomElement e =3D params.item(i).toElement(); - if (e.isNull()) continue; + if (e.isNull()) { + continue; + } QString paramName =3D e.attribute(QStringLiteral("name")); - if (e.attribute(QStringLiteral("type")) =3D=3D QLatin1String("ani= mated")) { + if (e.attribute(QStringLiteral("type")).startsWith(QLatin1String(= "animated"))) { if (m_keyframeView.activeParam(paramName)) { // inserting a keyframe touches all animated params for (int j =3D 0; j < params.count(); ++j) { diff --cc src/timeline/customtrackview.cpp index f501f8bef,19939d439..b44dd8aac --- a/src/timeline/customtrackview.cpp +++ b/src/timeline/customtrackview.cpp @@@ -7285,25 -6834,24 +7285,25 @@@ void CustomTrackView::splitAudio(bool w if (!info.isValid()) { // Operate on current selection selection =3D scene()->selectedItems(); - destTrack =3D m_timeline->audioTarget; if (selection.isEmpty()) { emit displayMessage(i18n("You must select at least one clip f= or this action"), ErrorMessage); - if (!hasMasterCommand) + if (!hasMasterCommand) { delete masterCommand; + } return; } - } else { - new SplitAudioCommand(this, info.track, destTrack, info.startPos,= masterCommand); - } - for (int i =3D 0; i < selection.count(); ++i) { - if (selection.at(i)->type() =3D=3D AVWidget) { - ClipItem *clip =3D static_cast (selection.at(i)); - if (clip->clipType() =3D=3D AV || clip->clipType() =3D=3D Pla= ylist) { - if (clip->parentItem()) { - emit displayMessage(i18n("Cannot split audio of group= ed clips"), ErrorMessage); - } else { - new SplitAudioCommand(this, clip->track(), destTrack,= clip->startPos(), masterCommand); + if (KdenliveSettings::splitaudio()) { + destTrack =3D m_timeline->audioTarget; + } + for (int i =3D 0; i < selection.count(); ++i) { + if (selection.at(i)->type() =3D=3D AVWidget) { + ClipItem *clip =3D static_cast (selection.at(= i)); + if (clip->clipType() =3D=3D AV || clip->clipType() =3D=3D= Playlist) { + if (clip->parentItem()) { + emit displayMessage(i18n("Cannot split audio of g= rouped clips"), ErrorMessage); + } else { + new SplitAudioCommand(this, clip->track(), destTr= ack, clip->startPos(), masterCommand); + } } } } diff --cc src/timeline/keyframeview.cpp index 37b3dcdab,84777d428..334542855 --- a/src/timeline/keyframeview.cpp +++ b/src/timeline/keyframeview.cpp @@@ -75,11 -72,10 +75,11 @@@ QPointF KeyframeView::keyframePoint(con br.bottom() - br.height() * (value * factor - min) / (= max - min)); } = -void KeyframeView::drawKeyFrames(QRectF br, int length, bool active, QPai= nter *painter, const QTransform &transformation) +void KeyframeView::drawKeyFrames(const QRectF &br, int length, bool activ= e, QPainter *painter, const QTransform &transformation) { - if (duration =3D=3D 0 || m_keyframeType =3D=3D NoKeyframe || !m_keyAn= im.is_valid() || m_keyAnim.key_count() < 1) { - if (duration =3D=3D 0 || m_inTimeline.isEmpty() || m_keyframeType =3D= =3D NoKeyframe || !m_keyAnim.is_valid() || m_keyAnim.key_count() < 1) ++ if (duration =3D=3D 0 || m_inTimeline.isEmpty() || m_keyframeType =3D= =3D NoKeyframe || !m_keyAnim.is_valid() || m_keyAnim.key_count() < 1) { return; + } duration =3D length; //m_keyAnim.set_length(length); painter->save(); @@@ -862,10 -846,11 +870,11 @@@ bool KeyframeView::loadKeyframes(const = m_keyframeType =3D NoKeyframe; duration =3D length; m_inTimeline.clear(); + m_notInTimeline.clear(); // reset existing properties int max =3D m_keyProperties.count(); - for (int i =3D max -1; i >=3D 0; i--) { - m_keyProperties.set(m_keyProperties.get_name(i), (char*) NULL); + for (int i =3D max - 1; i >=3D 0; i--) { + m_keyProperties.set(m_keyProperties.get_name(i), (char *) Q_NULLP= TR); } attachToEnd =3D -2; m_useOffset =3D effect.attribute(QStringLiteral("kdenlive:sync_in_out= ")) !=3D QLatin1String("1"); @@@ -898,14 -876,23 +900,28 @@@ info.factor =3D 1; } m_paramInfos.insert(paramName, info); - if (!e.hasAttribute(QStringLiteral("intimeline")) || e.attribute(= QStringLiteral("intimeline")) =3D=3D QLatin1String("1")) { - // Active parameter - m_keyframeMin =3D info.min; - m_keyframeMax =3D info.max; - m_keyframeDefault =3D locale.toDouble(info.defaultValue); - m_keyframeFactor =3D info.factor; - attachToEnd =3D checkNegatives(e.attribute(QStringLiteral("va= lue")).toUtf8().constData(), duration - m_offset); - m_inTimeline =3D paramName; + if (e.hasAttribute(QStringLiteral("notintimeline"))) { + // This param should not be drawn in timeline + m_notInTimeline << paramName; + } else { - if (type =3D=3D QLatin1String("keyframe")) m_keyframeType =3D= NormalKeyframe; - else if (type =3D=3D QLatin1String("simplekeyframe")) m_keyfr= ameType =3D SimpleKeyframe; - else if (type =3D=3D QLatin1String("geometry") || type =3D=3D= QLatin1String("animatedrect")) m_keyframeType =3D GeometryKeyframe; - else if (type =3D=3D QLatin1String("animated")) m_keyframeTyp= e =3D AnimatedKeyframe; ++ if (type =3D=3D QLatin1String("keyframe")) { ++ m_keyframeType =3D NormalKeyframe; ++ } else if (type =3D=3D QLatin1String("simplekeyframe")) { ++ m_keyframeType =3D SimpleKeyframe; ++ } else if (type =3D=3D QLatin1String("geometry") || type =3D= =3D QLatin1String("animatedrect")) { ++ m_keyframeType =3D GeometryKeyframe; ++ } else if (type =3D=3D QLatin1String("animated")) { ++ m_keyframeType =3D AnimatedKeyframe; ++ } + if (!e.hasAttribute(QStringLiteral("intimeline")) || e.attrib= ute(QStringLiteral("intimeline")) =3D=3D QLatin1String("1")) { + // Active parameter + m_keyframeMin =3D info.min; + m_keyframeMax =3D info.max; + m_keyframeDefault =3D locale.toDouble(info.defaultValue); + m_keyframeFactor =3D info.factor; - attachToEnd =3D checkNegatives(e.attribute("value").toUtf= 8().constData(), duration - m_offset); ++ attachToEnd =3D checkNegatives(e.attribute(QStringLiteral= ("value")).toUtf8().constData(), duration - m_offset); + m_inTimeline =3D paramName; + } } // parse keyframes QString value =3D e.attribute(QStringLiteral("value")); @@@ -938,9 -923,8 +954,9 @@@ = void KeyframeView::setOffset(int frames) { - if (!m_keyAnim.is_valid()) { - if (duration =3D=3D 0 || !m_keyAnim.is_valid()) ++ if (duration =3D=3D 0 || !m_keyAnim.is_valid()) { return; + } if (m_keyAnim.is_key(-m_offset)) { mlt_keyframe_type type =3D m_keyAnim.keyframe_type(-m_offset); double value =3D m_keyProperties.anim_get_double(m_inTimeline.toU= tf8().constData(), -m_offset, duration - m_offset); @@@ -990,11 -974,13 +1006,13 @@@ void KeyframeView::reset( duration =3D 0; attachToEnd =3D -2; activeKeyframe =3D -1; + m_inTimeline.clear(); + m_notInTimeline.clear(); int max =3D m_keyProperties.count(); - for (int i =3D max -1; i >=3D 0; i--) { - m_keyProperties.set(m_keyProperties.get_name(i), (char*) NULL); + for (int i =3D max - 1; i >=3D 0; i--) { + m_keyProperties.set(m_keyProperties.get_name(i), (char *) Q_NULLP= TR); } - emit updateKeyframes(); = + emit updateKeyframes(); } = //static diff --cc src/timeline/keyframeview.h index d3deebfb3,34b4e7212..0db983f91 --- a/src/timeline/keyframeview.h +++ b/src/timeline/keyframeview.h @@@ -120,11 -120,12 +120,12 @@@ private int m_handleSize; bool m_useOffset; int m_offset; + QStringList m_notInTimeline; - double keyframeUnmap(QRectF br, double y); - double keyframeMap(QRectF br, double value); - QPointF keyframeMap(QRectF br, int frame, double value); - QPointF keyframePoint(QRectF br, int index); - QPointF keyframePoint(QRectF br, int frame, double value, double fact= or, double min, double max); + double keyframeUnmap(const QRectF &br, double y); + double keyframeMap(const QRectF &br, double value); + QPointF keyframeMap(const QRectF &br, int frame, double value); + QPointF keyframePoint(const QRectF &br, int index); + QPointF keyframePoint(const QRectF &br, int frame, double value, doub= le factor, double min, double max); struct ParameterInfo { double factor; double min;