Commit 95d462a7 authored by Laurent Montel's avatar Laurent Montel 😁

const'ref, fix indent

parent 25c924be
......@@ -34,10 +34,10 @@
#endif
Transition::Transition(const ItemInfo &info, int transitiontrack, double fps, const QDomElement &params, bool automaticTransition) :
AbstractClipItem(info, QRectF(), fps),
m_forceTransitionTrack(false),
m_automaticTransition(automaticTransition),
m_transitionTrack(transitiontrack)
AbstractClipItem(info, QRectF(), fps),
m_forceTransitionTrack(false),
m_automaticTransition(automaticTransition),
m_transitionTrack(transitiontrack)
{
setZValue(3);
m_info.cropDuration = info.endPos - info.startPos;
......@@ -88,7 +88,7 @@ Transition::~Transition()
Transition *Transition::clone()
{
QDomElement xml = toXML().cloneNode().toElement();
const QDomElement xml = toXML().cloneNode().toElement();
Transition *tr = new Transition(info(), transitionEndTrack(), m_fps, xml);
return tr;
}
......@@ -123,13 +123,15 @@ void Transition::setAutomatic(bool automatic)
update();
}
void Transition::setTransitionParameters(const QDomElement params)
void Transition::setTransitionParameters(const QDomElement &params)
{
m_parameters = params;
if (m_parameters.attribute("force_track") == "1") setForcedTrack(true, m_parameters.attribute("transition_btrack").toInt());
else if (m_parameters.attribute("force_track") == "0") setForcedTrack(false, m_parameters.attribute("transition_btrack").toInt());
m_name = i18n(m_parameters.firstChildElement("name").text().toUtf8().data());
update();
if (m_parameters != params) {
m_parameters = params;
if (m_parameters.attribute("force_track") == "1") setForcedTrack(true, m_parameters.attribute("transition_btrack").toInt());
else if (m_parameters.attribute("force_track") == "0") setForcedTrack(false, m_parameters.attribute("transition_btrack").toInt());
m_name = i18n(m_parameters.firstChildElement("name").text().toUtf8().data());
update();
}
}
int Transition::transitionEndTrack() const
......@@ -177,7 +179,7 @@ void Transition::paint(QPainter *painter,
// Draw clip name
if (isSelected() || (parentItem() && parentItem()->isSelected())) {
framePen.setColor(scene()->palette().highlight().color());
framePen.setColor(Qt::red);
framePen.setColor(Qt::red);
}
else {
framePen.setColor(brush().color().darker());
......@@ -220,11 +222,11 @@ QVariant Transition::itemChange(GraphicsItemChange change, const QVariant &value
int newTrack = newPos.y() / KdenliveSettings::trackheight();
newTrack = qMin(newTrack, projectScene()->tracksCount() - 1);
newTrack = qMax(newTrack, 0);
QStringList lockedTracks = property("locked_tracks").toStringList();
if (lockedTracks.contains(QString::number(newTrack))) {
// Trying to move to a locked track
return pos();
}
QStringList lockedTracks = property("locked_tracks").toStringList();
if (lockedTracks.contains(QString::number(newTrack))) {
// Trying to move to a locked track
return pos();
}
newPos.setY((int)(newTrack * KdenliveSettings::trackheight() + itemOffset() + 1));
// Only one clip is moving
QRectF sceneShape = rect();
......@@ -279,7 +281,7 @@ QVariant Transition::itemChange(GraphicsItemChange change, const QVariant &value
}
}
}
m_info.track = newTrack;
m_info.startPos = GenTime((int) newPos.x(), m_fps);
//kDebug()<<"// ITEM NEW POS: "<<newPos.x()<<", mapped: "<<mapToScene(newPos.x(), 0).x();
......@@ -362,37 +364,37 @@ bool Transition::updateKeyframes(int oldEnd)
int frame;
int i = 0;
if (oldEnd < duration) {
// Transition was expanded, check if we had a keyframe at end position
foreach(QString pos, values) {
if (!pos.contains('=')) {
++i;
continue;
}
frame = pos.section('=', 0, 0).toInt();
if (frame == oldEnd) {
// Move that keyframe to new end
// Transition was expanded, check if we had a keyframe at end position
foreach(QString pos, values) {
if (!pos.contains('=')) {
++i;
continue;
}
frame = pos.section('=', 0, 0).toInt();
if (frame == oldEnd) {
// Move that keyframe to new end
values[i] = QString::number(duration) + '=' + pos.section('=', 1);
pa.setAttribute("value", values.join(";"));
return true;
}
++i;
}
return false;
pa.setAttribute("value", values.join(";"));
return true;
}
++i;
}
return false;
}
else {
// Transition was shortened, check for out of bounds keyframes
foreach(const QString &pos, values) {
if (!pos.contains('=')) {
++i;
continue;
}
frame = pos.section('=', 0, 0).toInt();
if (frame > duration) {
modified = true;
break;
}
++i;
}
// Transition was shortened, check for out of bounds keyframes
foreach(const QString &pos, values) {
if (!pos.contains('=')) {
++i;
continue;
}
frame = pos.section('=', 0, 0).toInt();
if (frame > duration) {
modified = true;
break;
}
++i;
}
}
if (modified) {
if (i > 0) {
......
......@@ -59,7 +59,7 @@ public:
static int itemHeight();
static int itemOffset();
//const QMap < QString, QString > transitionParameters() const;
void setTransitionParameters(const QDomElement params);
void setTransitionParameters(const QDomElement &params);
void setTransitionTrack(int track);
/** @brief Links the transition to another track.
......
......@@ -29,9 +29,9 @@
#include <KDebug>
TransitionSettings::TransitionSettings(Monitor *monitor, QWidget* parent) :
QWidget(parent),
m_usedTransition(NULL),
m_autoTrackTransition(0)
QWidget(parent),
m_usedTransition(NULL),
m_autoTrackTransition(0)
{
setupUi(this);
QVBoxLayout *vbox1 = new QVBoxLayout(frame);
......@@ -114,8 +114,8 @@ void TransitionSettings::slotTransitionChanged(bool reinit, bool updateCurrent)
QDomElement newTransition = MainWindow::transitions.getEffectByName(transitionList->currentText()).cloneNode().toElement();
slotUpdateEffectParams(e, newTransition);
m_effectEdit->transferParamDesc(newTransition, m_usedTransition->info(), false);
if (m_effectEdit->needsMonitorEffectScene())
connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
if (m_effectEdit->needsMonitorEffectScene())
connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
} else if (!updateCurrent) {
// Transition changed, update parameters dialog
//slotUpdateEffectParams(e, e);
......@@ -124,19 +124,19 @@ void TransitionSettings::slotTransitionChanged(bool reinit, bool updateCurrent)
// Same transition, we just want to update the parameters value
int ix = transitionList->findData(m_usedTransition->transitionInfo(), Qt::UserRole, Qt::MatchExactly);
if (ix != transitionList->currentIndex()) {
// Transition type changed, reload params
transitionList->blockSignals(true);
transitionList->setCurrentIndex(ix);
transitionList->blockSignals(false);
m_effectEdit->transferParamDesc(e, m_usedTransition->info(), false);
}
else {
slotUpdateEffectParams(e, e);
if (m_usedTransition->hasGeometry())
m_effectEdit->transferParamDesc(m_usedTransition->toXML(), m_usedTransition->info(), false);
}
if (m_effectEdit->needsMonitorEffectScene())
connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
// Transition type changed, reload params
transitionList->blockSignals(true);
transitionList->setCurrentIndex(ix);
transitionList->blockSignals(false);
m_effectEdit->transferParamDesc(e, m_usedTransition->info(), false);
}
else {
slotUpdateEffectParams(e, e);
if (m_usedTransition->hasGeometry())
m_effectEdit->transferParamDesc(m_usedTransition->toXML(), m_usedTransition->info(), false);
}
if (m_effectEdit->needsMonitorEffectScene())
connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
}
slotCheckMonitorPosition(m_effectEdit->monitor()->render->seekFramePosition());
}
......@@ -200,14 +200,14 @@ void TransitionSettings::slotTransitionItemSelected(Transition* t, int nextTrack
transitionList->blockSignals(false);
}
if (m_effectEdit->needsMonitorEffectScene()) {
connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
}
connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int)));
}
} else {
// null transition selected
m_usedTransition = NULL;
ItemInfo info;
m_effectEdit->transferParamDesc(QDomElement(), info, false);
m_effectEdit->monitor()->slotShowEffectScene(false);
m_effectEdit->monitor()->slotShowEffectScene(false);
}
}
......@@ -232,30 +232,30 @@ void TransitionSettings::slotRenderPos(int pos)
{
if (m_usedTransition) {
m_effectEdit->slotSyncEffectsPos(pos - m_usedTransition->startPos().frames(KdenliveSettings::project_fps()));
if (isEnabled()) slotCheckMonitorPosition(pos);
if (isEnabled()) slotCheckMonitorPosition(pos);
}
}
void TransitionSettings::slotSeekTimeline(int pos)
{
if (m_usedTransition)
emit seekTimeline(m_usedTransition->startPos().frames(KdenliveSettings::project_fps()) + pos);
emit seekTimeline(m_usedTransition->startPos().frames(KdenliveSettings::project_fps()) + pos);
}
void TransitionSettings::slotCheckMonitorPosition(int renderPos)
{
if (!isEnabled()) return;
if (m_effectEdit->needsMonitorEffectScene()) {
if (renderPos >= m_usedTransition->startPos().frames(KdenliveSettings::project_fps()) && renderPos < m_usedTransition->endPos().frames(KdenliveSettings::project_fps())) {
if (!m_effectEdit->monitor()->effectSceneDisplayed()) {
m_effectEdit->monitor()->slotShowEffectScene(true);
}
} else {
m_effectEdit->monitor()->slotShowEffectScene(false);
}
if (renderPos >= m_usedTransition->startPos().frames(KdenliveSettings::project_fps()) && renderPos < m_usedTransition->endPos().frames(KdenliveSettings::project_fps())) {
if (!m_effectEdit->monitor()->effectSceneDisplayed()) {
m_effectEdit->monitor()->slotShowEffectScene(true);
}
} else {
m_effectEdit->monitor()->slotShowEffectScene(false);
}
}
else {
m_effectEdit->monitor()->slotShowEffectScene(false);
m_effectEdit->monitor()->slotShowEffectScene(false);
}
}
......
......@@ -61,7 +61,7 @@ private slots:
void slotCheckMonitorPosition(int renderPos);
signals:
void transitionUpdated(Transition *, QDomElement);
void transitionUpdated(Transition *, const QDomElement&);
void seekTimeline(int);
void importClipKeyframes(GRAPHICSRECTITEM = TRANSITIONWIDGET);
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment