Commit 2f74100f authored by Dmitry Kazakov's avatar Dmitry Kazakov

Redesigned Animation docker to fit the Scott's design

Also refactor KisKeyframeChannel classes to use shared pointers
whenever possible.

Conflicts:
	krita/pics/CMakeLists.txt
	krita/plugins/extensions/dockers/animation/animation_docker.cpp
	krita/ui/canvas/kis_animation_player.h
parent 85da2e0d
......@@ -86,7 +86,7 @@ void KisImageAnimationInterface::setRange(const KisTimeRange range) {
emit sigRangeChanged();
}
int KisImageAnimationInterface::framerate()
int KisImageAnimationInterface::framerate() const
{
return m_d->framerate;
}
......
......@@ -100,7 +100,7 @@ public:
const KisTimeRange &currentRange() const;
void setRange(const KisTimeRange range);
int framerate();
int framerate() const;
public Q_SLOTS:
void setFramerate(int fps);
......
......@@ -126,41 +126,36 @@ KisNodeWSP KisKeyframeChannel::node() const
cmd = __tempCommand.data(); \
}
KisKeyframe *KisKeyframeChannel::addKeyframe(int time, KUndo2Command *parentCommand)
KisKeyframeSP KisKeyframeChannel::addKeyframe(int time, KUndo2Command *parentCommand)
{
LAZY_INITIALIZE_PARENT_COMMAND(parentCommand);
return insertKeyframe(time, 0, parentCommand);
return insertKeyframe(time, KisKeyframeSP(), parentCommand);
}
void KisKeyframeChannel::deleteKeyframeImpl(KisKeyframeSP sharedKeyframe)
void KisKeyframeChannel::deleteKeyframeImpl(KisKeyframeSP keyframe)
{
KisKeyframe *keyframe = sharedKeyframe.data();
QRect rect = affectedRect(keyframe);
KisTimeRange range = affectedFrames(keyframe->time());
emit sigKeyframeAboutToBeRemoved(keyframe);
emit sigKeyframeAboutToBeRemoved(keyframe.data());
m_d->keys.remove(keyframe->time());
emit sigKeyframeRemoved(keyframe);
emit sigKeyframeRemoved(keyframe.data());
requestUpdate(range, rect);
}
bool KisKeyframeChannel::deleteKeyframe(KisKeyframe *keyframe, KUndo2Command *parentCommand)
bool KisKeyframeChannel::deleteKeyframe(KisKeyframeSP keyframe, KUndo2Command *parentCommand)
{
LAZY_INITIALIZE_PARENT_COMMAND(parentCommand);
// upgrade our raw pointer up to a shared one
KisKeyframeSP sharedKeyframe = m_d->keys[keyframe->time()];
bool result = false;
if (canDeleteKeyframe(keyframe)) {
Q_ASSERT(parentCommand);
KUndo2Command *cmd = new InsertFrameCommand(this, sharedKeyframe, false, parentCommand);
KUndo2Command *cmd = new InsertFrameCommand(this, keyframe, false, parentCommand);
cmd->redo();
destroyKeyframe(keyframe, parentCommand);
......@@ -173,24 +168,22 @@ bool KisKeyframeChannel::deleteKeyframe(KisKeyframe *keyframe, KUndo2Command *pa
return result;
}
void KisKeyframeChannel::moveKeyframeImpl(KisKeyframeSP sharedKeyframe, int newTime)
void KisKeyframeChannel::moveKeyframeImpl(KisKeyframeSP keyframe, int newTime)
{
KisKeyframe *keyframe = sharedKeyframe.data();
KIS_ASSERT_RECOVER_RETURN(keyframe);
KIS_ASSERT_RECOVER_RETURN(!keyframeAt(newTime));
KisTimeRange rangeSrc = affectedFrames(keyframe->time());
QRect rectSrc = affectedRect(keyframe);
emit sigKeyframeAboutToBeMoved(keyframe, newTime);
emit sigKeyframeAboutToBeMoved(keyframe.data(), newTime);
m_d->keys.remove(keyframe->time());
int oldTime = keyframe->time();
keyframe->setTime(newTime);
m_d->keys.insert(newTime, sharedKeyframe);
m_d->keys.insert(newTime, keyframe);
emit sigKeyframeMoved(keyframe, oldTime);
emit sigKeyframeMoved(keyframe.data(), oldTime);
KisTimeRange rangeDst = affectedFrames(keyframe->time());
QRect rectDst = affectedRect(keyframe);
......@@ -199,36 +192,33 @@ void KisKeyframeChannel::moveKeyframeImpl(KisKeyframeSP sharedKeyframe, int newT
requestUpdate(rangeDst, rectDst);
}
bool KisKeyframeChannel::moveKeyframe(KisKeyframe *keyframe, int newTime, KUndo2Command *parentCommand)
bool KisKeyframeChannel::moveKeyframe(KisKeyframeSP keyframe, int newTime, KUndo2Command *parentCommand)
{
LAZY_INITIALIZE_PARENT_COMMAND(parentCommand);
// upgrade our raw pointer up to a shared one
KisKeyframeSP sharedKeyframe = m_d->keys[keyframe->time()];
KisKeyframe *other = keyframeAt(newTime);
KisKeyframeSP other = keyframeAt(newTime);
if (other) return false;
KUndo2Command *cmd = new MoveFrameCommand(this, sharedKeyframe, keyframe->time(), newTime, parentCommand);
KUndo2Command *cmd = new MoveFrameCommand(this, keyframe, keyframe->time(), newTime, parentCommand);
cmd->redo();
return true;
}
KisKeyframe *KisKeyframeChannel::copyKeyframe(const KisKeyframe *keyframe, int newTime, KUndo2Command *parentCommand)
KisKeyframeSP KisKeyframeChannel::copyKeyframe(const KisKeyframeSP keyframe, int newTime, KUndo2Command *parentCommand)
{
LAZY_INITIALIZE_PARENT_COMMAND(parentCommand);
return insertKeyframe(newTime, keyframe, parentCommand);
}
KisKeyframe *KisKeyframeChannel::keyframeAt(int time)
KisKeyframeSP KisKeyframeChannel::keyframeAt(int time)
{
KeyframesMap::iterator i = m_d->keys.find(time);
if (i != m_d->keys.end()) {
return i.value().data();
return i.value();
}
return 0;
return KisKeyframeSP();
}
KisKeyframeSP KisKeyframeChannel::activeKeyframeAt(int time) const
......@@ -294,7 +284,7 @@ int KisKeyframeChannel::keyframeCount() const
return m_d->keys.count();
}
int KisKeyframeChannel::keyframeRowIndexOf(KisKeyframe *keyframe) const
int KisKeyframeChannel::keyframeRowIndexOf(KisKeyframeSP keyframe) const
{
KeyframesMap::const_iterator it = m_d->keys.constBegin();
KeyframesMap::const_iterator end = m_d->keys.constEnd();
......@@ -312,20 +302,20 @@ int KisKeyframeChannel::keyframeRowIndexOf(KisKeyframe *keyframe) const
return -1;
}
KisKeyframe* KisKeyframeChannel::keyframeAtRow(int row) const
KisKeyframeSP KisKeyframeChannel::keyframeAtRow(int row) const
{
KeyframesMap::const_iterator it = m_d->keys.constBegin();
KeyframesMap::const_iterator end = m_d->keys.constEnd();
for (; it != end; ++it) {
if (row <= 0) {
return it.value().data();
return it.value();
}
row--;
}
return 0;
return KisKeyframeSP();
}
int KisKeyframeChannel::keyframeInsertionRow(int time) const
......@@ -355,7 +345,7 @@ QDomElement KisKeyframeChannel::toXML(QDomDocument doc, const QString &layerFile
QDomElement keyframeElement = doc.createElement("keyframe");
keyframeElement.setAttribute("time", keyframe->time());
saveKeyframe(keyframe.data(), keyframeElement, layerFilename);
saveKeyframe(keyframe, keyframeElement, layerFilename);
channelElement.appendChild(keyframeElement);
}
......@@ -384,30 +374,28 @@ const KisKeyframeChannel::KeyframesMap& KisKeyframeChannel::constKeys() const
return m_d->keys;
}
void KisKeyframeChannel::insertKeyframeImpl(KisKeyframeSP sharedKeyframe)
void KisKeyframeChannel::insertKeyframeImpl(KisKeyframeSP keyframe)
{
KisKeyframe *keyframe = sharedKeyframe.data();
const int time = keyframe->time();
emit sigKeyframeAboutToBeAdded(keyframe);
m_d->keys.insert(time, sharedKeyframe);
emit sigKeyframeAdded(keyframe);
emit sigKeyframeAboutToBeAdded(keyframe.data());
m_d->keys.insert(time, keyframe);
emit sigKeyframeAdded(keyframe.data());
QRect rect = affectedRect(keyframe);
KisTimeRange range = affectedFrames(time);
requestUpdate(range, rect);
}
KisKeyframe * KisKeyframeChannel::insertKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand)
KisKeyframeSP KisKeyframeChannel::insertKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand)
{
KisKeyframe *keyframe = keyframeAt(time);
KisKeyframeSP keyframe = keyframeAt(time);
if (keyframe) return keyframe;
Q_ASSERT(parentCommand);
keyframe = createKeyframe(time, copySrc, parentCommand);
KUndo2Command *cmd = new InsertFrameCommand(this, toQShared(keyframe), true, parentCommand);
KUndo2Command *cmd = new InsertFrameCommand(this, keyframe, true, parentCommand);
cmd->redo();
return keyframe;
......
......@@ -48,12 +48,12 @@ public:
KisNodeWSP node() const;
KisKeyframe *addKeyframe(int time, KUndo2Command *parentCommand = 0);
bool deleteKeyframe(KisKeyframe *keyframe, KUndo2Command *parentCommand = 0);
bool moveKeyframe(KisKeyframe *keyframe, int newTime, KUndo2Command *parentCommand = 0);
KisKeyframe *copyKeyframe(const KisKeyframe *keyframe, int newTime, KUndo2Command *parentCommand = 0);
KisKeyframeSP addKeyframe(int time, KUndo2Command *parentCommand = 0);
bool deleteKeyframe(KisKeyframeSP keyframe, KUndo2Command *parentCommand = 0);
bool moveKeyframe(KisKeyframeSP keyframe, int newTime, KUndo2Command *parentCommand = 0);
KisKeyframeSP copyKeyframe(const KisKeyframeSP keyframe, int newTime, KUndo2Command *parentCommand = 0);
KisKeyframe *keyframeAt(int time);
KisKeyframeSP keyframeAt(int time);
KisKeyframeSP activeKeyframeAt(int time) const;
KisKeyframeSP nextKeyframe(KisKeyframeSP keyframe) const;
......@@ -77,16 +77,16 @@ public:
int keyframeCount() const;
int keyframeRowIndexOf(KisKeyframe *keyframe) const;
KisKeyframe* keyframeAtRow(int row) const;
int keyframeRowIndexOf(KisKeyframeSP keyframe) const;
KisKeyframeSP keyframeAtRow(int row) const;
int keyframeInsertionRow(int time) const;
virtual bool hasScalarValue() const = 0;
virtual qreal minScalarValue() const = 0;
virtual qreal maxScalarValue() const = 0;
virtual qreal scalarValue(const KisKeyframe *keyframe) const = 0;
virtual void setScalarValue(KisKeyframe *keyframe, qreal value, KUndo2Command *parentCommand = 0) = 0;
virtual qreal scalarValue(const KisKeyframeSP keyframe) const = 0;
virtual void setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand = 0) = 0;
virtual QDomElement toXML(QDomDocument doc, const QString &layerFilename);
virtual void loadXML(const QDomElement &channelNode);
......@@ -106,15 +106,15 @@ protected:
const KeyframesMap &constKeys() const;
KeyframesMap::const_iterator activeKeyIterator(int time) const;
virtual KisKeyframe* createKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand) = 0;
virtual bool canDeleteKeyframe(KisKeyframe *key) = 0;
virtual void destroyKeyframe(KisKeyframe *key, KUndo2Command *parentCommand) = 0;
virtual KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand) = 0;
virtual bool canDeleteKeyframe(KisKeyframeSP key) = 0;
virtual void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand) = 0;
virtual QRect affectedRect(KisKeyframe *key) = 0;
virtual QRect affectedRect(KisKeyframeSP key) = 0;
virtual void requestUpdate(const KisTimeRange &range, const QRect &rect);
virtual KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode) = 0;
virtual void saveKeyframe(KisKeyframe *keyframe, QDomElement keyframeElement, const QString &layerFilename) = 0;
virtual void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename) = 0;
private:
void insertKeyframeImpl(KisKeyframeSP keyframe);
......@@ -125,7 +125,7 @@ private:
struct MoveFrameCommand;
private:
KisKeyframe * insertKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand);
KisKeyframeSP insertKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
struct Private;
QScopedPointer<Private> m_d;
......
......@@ -92,18 +92,18 @@ QString KisRasterKeyframeChannel::chooseFrameFilename(int frameId, const QString
KisKeyframe *KisRasterKeyframeChannel::createKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand)
KisKeyframeSP KisRasterKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand)
{
int srcFrame = (copySrc != 0) ? copySrc->value() : 0;
int frameId = m_d->paintDevice->framesInterface()->createFrame((copySrc != 0), srcFrame, QPoint(), parentCommand);
KisKeyframe *keyframe = new KisKeyframe(this, time, (quint32)frameId);
KisKeyframeSP keyframe(new KisKeyframe(this, time, (quint32)frameId));
return keyframe;
}
bool KisRasterKeyframeChannel::canDeleteKeyframe(KisKeyframe *key)
bool KisRasterKeyframeChannel::canDeleteKeyframe(KisKeyframeSP key)
{
Q_UNUSED(key);
......@@ -111,12 +111,12 @@ bool KisRasterKeyframeChannel::canDeleteKeyframe(KisKeyframe *key)
return keys().count() > 1 && key->time() != 0;
}
void KisRasterKeyframeChannel::destroyKeyframe(KisKeyframe *key, KUndo2Command *parentCommand)
void KisRasterKeyframeChannel::destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand)
{
m_d->paintDevice->framesInterface()->deleteFrame(key->value(), parentCommand);
}
QRect KisRasterKeyframeChannel::affectedRect(KisKeyframe *key)
QRect KisRasterKeyframeChannel::affectedRect(KisKeyframeSP key)
{
KeyframesMap::iterator it = keys().find(key->time());
QRect rect;
......@@ -165,7 +165,7 @@ void KisRasterKeyframeChannel::loadXML(const QDomElement &channelNode)
KisKeyframeChannel::loadXML(channelNode);
}
void KisRasterKeyframeChannel::saveKeyframe(KisKeyframe *keyframe, QDomElement keyframeElement, const QString &layerFilename)
void KisRasterKeyframeChannel::saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename)
{
int frameId = keyframe->value();
......@@ -227,14 +227,14 @@ qreal KisRasterKeyframeChannel::maxScalarValue() const
return 0;
}
qreal KisRasterKeyframeChannel::scalarValue(const KisKeyframe *keyframe) const
qreal KisRasterKeyframeChannel::scalarValue(const KisKeyframeSP keyframe) const
{
Q_UNUSED(keyframe);
return 0;
}
void KisRasterKeyframeChannel::setScalarValue(KisKeyframe *keyframe, qreal value, KUndo2Command *parentCommand)
void KisRasterKeyframeChannel::setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand)
{
Q_UNUSED(keyframe);
Q_UNUSED(value);
......
......@@ -54,21 +54,21 @@ public:
bool hasScalarValue() const;
qreal minScalarValue() const;
qreal maxScalarValue() const;
qreal scalarValue(const KisKeyframe *keyframe) const;
void setScalarValue(KisKeyframe *keyframe, qreal value, KUndo2Command *parentCommand);
qreal scalarValue(const KisKeyframeSP keyframe) const;
void setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand);
QDomElement toXML(QDomDocument doc, const QString &layerFilename);
void loadXML(const QDomElement &channelNode);
protected:
KisKeyframe *createKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand);
bool canDeleteKeyframe(KisKeyframe *key);
void destroyKeyframe(KisKeyframe *key, KUndo2Command *parentCommand);
KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
bool canDeleteKeyframe(KisKeyframeSP key);
void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand);
QRect affectedRect(KisKeyframe *key);
QRect affectedRect(KisKeyframeSP key);
void requestUpdate(const KisTimeRange &range, const QRect &rect);
void saveKeyframe(KisKeyframe *keyframe, QDomElement keyframeElement, const QString &layerFilename);
void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename);
KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode);
private:
......
......@@ -63,7 +63,7 @@ qreal KisScalarKeyframeChannel::maxScalarValue() const
return m_d->maxValue;
}
qreal KisScalarKeyframeChannel::scalarValue(const KisKeyframe *keyframe) const
qreal KisScalarKeyframeChannel::scalarValue(const KisKeyframeSP keyframe) const
{
return m_d->values[keyframe->value()];
}
......@@ -94,7 +94,7 @@ private:
qreal m_newValue;
};
void KisScalarKeyframeChannel::setScalarValue(KisKeyframe *keyframe, qreal value, KUndo2Command *parentCommand)
void KisScalarKeyframeChannel::setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand)
{
QScopedPointer<KUndo2Command> tempCommand;
if (!parentCommand) {
......@@ -142,7 +142,7 @@ private:
bool m_insert;
};
KisKeyframe *KisScalarKeyframeChannel::createKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand)
KisKeyframeSP KisScalarKeyframeChannel::createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand)
{
qreal value = (copySrc != 0) ? scalarValue(copySrc) : 0;
int index = m_d->firstFreeIndex++;
......@@ -150,16 +150,16 @@ KisKeyframe *KisScalarKeyframeChannel::createKeyframe(int time, const KisKeyfram
KUndo2Command *cmd = new Private::InsertValueCommand(m_d.data(), index, value, true, parentCommand);
cmd->redo();
return new KisKeyframe(this, time, index);
return toQShared(new KisKeyframe(this, time, index));
}
bool KisScalarKeyframeChannel::canDeleteKeyframe(KisKeyframe *key)
bool KisScalarKeyframeChannel::canDeleteKeyframe(KisKeyframeSP key)
{
Q_UNUSED(key);
return true;
}
void KisScalarKeyframeChannel::destroyKeyframe(KisKeyframe *key, KUndo2Command *parentCommand)
void KisScalarKeyframeChannel::destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand)
{
int index = key->value();
......@@ -169,13 +169,13 @@ void KisScalarKeyframeChannel::destroyKeyframe(KisKeyframe *key, KUndo2Command *
cmd->redo();
}
QRect KisScalarKeyframeChannel::affectedRect(KisKeyframe *key)
QRect KisScalarKeyframeChannel::affectedRect(KisKeyframeSP key)
{
Q_UNUSED(key);
return QRect();
}
void KisScalarKeyframeChannel::saveKeyframe(KisKeyframe *keyframe, QDomElement keyframeElement, const QString &layerFilename)
void KisScalarKeyframeChannel::saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename)
{
Q_UNUSED(layerFilename);
keyframeElement.setAttribute("value", m_d->values[keyframe->value()]);
......@@ -187,8 +187,8 @@ KisKeyframeSP KisScalarKeyframeChannel::loadKeyframe(const QDomElement &keyframe
QVariant value = keyframeNode.toElement().attribute("value");
KUndo2Command tempParentCommand;
KisKeyframe *keyframe = createKeyframe(time, 0, &tempParentCommand);
KisKeyframeSP keyframe = createKeyframe(time, KisKeyframeSP(), &tempParentCommand);
setScalarValue(keyframe, value.toReal());
return toQShared(keyframe);
return keyframe;
}
......@@ -31,17 +31,17 @@ public:
bool hasScalarValue() const;
qreal minScalarValue() const;
qreal maxScalarValue() const;
qreal scalarValue(const KisKeyframe *keyframe) const;
void setScalarValue(KisKeyframe *keyframe, qreal value, KUndo2Command *parentCommand = 0);
qreal scalarValue(const KisKeyframeSP keyframe) const;
void setScalarValue(KisKeyframeSP keyframe, qreal value, KUndo2Command *parentCommand = 0);
protected:
KisKeyframe *createKeyframe(int time, const KisKeyframe *copySrc, KUndo2Command *parentCommand);
bool canDeleteKeyframe(KisKeyframe *key);
void destroyKeyframe(KisKeyframe *key, KUndo2Command *parentCommand);
KisKeyframeSP createKeyframe(int time, const KisKeyframeSP copySrc, KUndo2Command *parentCommand);
bool canDeleteKeyframe(KisKeyframeSP key);
void destroyKeyframe(KisKeyframeSP key, KUndo2Command *parentCommand);
QRect affectedRect(KisKeyframe *key);
QRect affectedRect(KisKeyframeSP key);
void saveKeyframe(KisKeyframe *keyframe, QDomElement keyframeElement, const QString &layerFilename);
void saveKeyframe(KisKeyframeSP keyframe, QDomElement keyframeElement, const QString &layerFilename);
KisKeyframeSP loadKeyframe(const QDomElement &keyframeNode);
private:
......
......@@ -88,10 +88,10 @@ void KisTransactionData::Private::tryCreateNewFrame(KisPaintDeviceSP device, int
KisRasterKeyframeChannel *channel = device->keyframeChannel();
KIS_ASSERT_RECOVER(channel) { return; }
KisKeyframe *keyframe = channel->keyframeAt(time);
KisKeyframeSP keyframe = channel->keyframeAt(time);
if (!keyframe) {
keyframe = channel->activeKeyframeAt(time).data();
keyframe = channel->activeKeyframeAt(time);
channel->copyKeyframe(keyframe, time, &newFrameCommand);
}
}
......
......@@ -57,7 +57,7 @@ void KisKeyframingTest::cleanupTestCase()
void KisKeyframingTest::testScalarChannel()
{
KisScalarKeyframeChannel *channel = new KisScalarKeyframeChannel(KoID("", ""), 0, -17, 31);
KisKeyframe *key;
KisKeyframeSP key;
bool ok;
QCOMPARE(channel->hasScalarValue(), true);
......@@ -76,7 +76,7 @@ void KisKeyframingTest::testScalarChannel()
// Adding a keyframe where one exists
KisKeyframe *key2 = channel->addKeyframe(42);
KisKeyframeSP key2 = channel->addKeyframe(42);
QVERIFY(key2 == key);
// Copying a keyframe
......@@ -110,7 +110,7 @@ void KisKeyframingTest::testScalarChannel()
void KisKeyframingTest::testScalarChannelUndoRedo()
{
KisScalarKeyframeChannel *channel = new KisScalarKeyframeChannel(KoID("", ""), 0, -17, 31);
KisKeyframe *key;
KisKeyframeSP key;
QCOMPARE(channel->hasScalarValue(), true);
QCOMPARE(channel->minScalarValue(), -17.0);
......@@ -130,7 +130,7 @@ void KisKeyframingTest::testScalarChannelUndoRedo()
addCmd.undo();
KisKeyframe *newKey = 0;
KisKeyframeSP newKey;
newKey = channel->keyframeAt(42);
QVERIFY(!newKey);
......@@ -161,11 +161,11 @@ void KisKeyframingTest::testRasterChannel()
QCOMPARE(channel->frameIdAt(0), 0);
QVERIFY(channel->keyframeAt(0) != 0);
KisKeyframe * key_0 = channel->keyframeAt(0);
KisKeyframeSP key_0 = channel->keyframeAt(0);
// New keyframe
KisKeyframe * key_10 = channel->addKeyframe(10);
KisKeyframeSP key_10 = channel->addKeyframe(10);
QCOMPARE(channel->keyframeCount(), 2);
QCOMPARE(dev->framesInterface()->frames().count(), 2);
QVERIFY(channel->frameIdAt(10) != 0);
......@@ -186,7 +186,7 @@ void KisKeyframingTest::testRasterChannel()
// Duplicate keyframe
KisKeyframe * key_20 = channel->copyKeyframe(key_0, 20);
KisKeyframeSP key_20 = channel->copyKeyframe(key_0, 20);
bounds->testingSetTime(20);
QImage thumb3a = dev->createThumbnail(50, 50);
......@@ -229,7 +229,7 @@ void KisKeyframingTest::testRasterChannel()
void KisKeyframingTest::testChannelSignals()
{
KisScalarKeyframeChannel *channel = new KisScalarKeyframeChannel(KoID("", ""), 0, -17, 31);
KisKeyframe *key;
KisKeyframeSP key;
KisKeyframe *resKey;
qRegisterMetaType<KisKeyframe*>("KisKeyframePtr");
......@@ -260,9 +260,9 @@ void KisKeyframingTest::testChannelSignals()
QCOMPARE(spyPostAdd.count(), 1);
resKey = spyPreAdd.at(0).at(0).value<KisKeyframe*>();
QVERIFY(resKey == key);
QVERIFY(resKey == key.data());
resKey = spyPostAdd.at(0).at(0).value<KisKeyframe*>();
QVERIFY(resKey == key);
QVERIFY(resKey == key.data());
// Moving a keyframe
......@@ -273,10 +273,10 @@ void KisKeyframingTest::testChannelSignals()
QCOMPARE(spyPostMove.count(), 1);
resKey = spyPreMove.at(0).at(0).value<KisKeyframe*>();
QVERIFY(resKey == key);
QVERIFY(resKey == key.data());
QCOMPARE(spyPreMove.at(0).at(1).toInt(), 15);
resKey = spyPostMove.at(0).at(0).value<KisKeyframe*>();
QVERIFY(resKey == key);
QVERIFY(resKey == key.data());
// No-op move (no signals)
......
......@@ -1615,7 +1615,7 @@ void KisPaintDeviceTest::testFramesLeaking()
QVERIFY(o.m_currentData == o.m_frames[1]);
QCOMPARE(o.m_frames.size(), 3);
KisKeyframe* key;
KisKeyframeSP key;
// deletion of frame 0 is forbidden
key = channel->keyframeAt(0);
......@@ -1623,7 +1623,7 @@ void KisPaintDeviceTest::testFramesLeaking()
QVERIFY(!channel->deleteKeyframe(key));
// delete keyframe at position 11
key = channel->activeKeyframeAt(11).data();
key = channel->activeKeyframeAt(11);
QVERIFY(key);
QCOMPARE(key->time(), 10);
QVERIFY(channel->deleteKeyframe(key));
......@@ -1637,7 +1637,7 @@ void KisPaintDeviceTest::testFramesLeaking()
QCOMPARE(o.m_frames.size(), 2);
// deletion of frame 0 is forbidden
key = channel->activeKeyframeAt(11).data();
key = channel->activeKeyframeAt(11);