Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Use std::unique_ptr instead of QScopedPointer

Freya Lupen0bb591da8096
diff --git a/libs/command/kis_command_utils.cpp b/libs/command/kis_command_utils.cpp
index a415c6b0e4..a9ba57d89b 100644
--- a/libs/command/kis_command_utils.cpp
+++ b/libs/command/kis_command_utils.cpp
@@ -221,7 +221,7 @@ namespace KisCommandUtils
return newCompositeParent;
}
- void redoAndMergeIntoAccumulatingCommand(KUndo2Command *cmd, QScopedPointer<KUndo2Command> &accumulatingCommand)
+ void redoAndMergeIntoAccumulatingCommand(KUndo2Command *cmd, std::unique_ptr<KUndo2Command> &accumulatingCommand)
{
cmd->redo();
if (accumulatingCommand) {
diff --git a/libs/command/kis_command_utils.h b/libs/command/kis_command_utils.h
index 7ecfee8102..f30d203bc0 100644
--- a/libs/command/kis_command_utils.h
+++ b/libs/command/kis_command_utils.h
@@ -175,7 +175,7 @@ namespace KisCommandUtils
* sets the accumulating command to that command
*/
KRITACOMMAND_EXPORT
- void redoAndMergeIntoAccumulatingCommand(KUndo2Command *cmd, QScopedPointer<KUndo2Command> &accumulatingCommand);
+ void redoAndMergeIntoAccumulatingCommand(KUndo2Command *cmd, std::unique_ptr<KUndo2Command> &accumulatingCommand);
}
#endif /* __KIS_COMMAND_UTILS_H */
diff --git a/libs/flake/resources/KoCssStylePreset.cpp b/libs/flake/resources/KoCssStylePreset.cpp
index 5dfec800b4..d589bbcd15 100644
--- a/libs/flake/resources/KoCssStylePreset.cpp
+++ b/libs/flake/resources/KoCssStylePreset.cpp
@@ -158,7 +158,7 @@ KoShape* KoCssStylePreset::generateSampleShape() const
const QString after = d->afterText;
const QString before = d->beforeText;
- QScopedPointer<KoSvgTextShape> sampleText(new KoSvgTextShape());
+ std::unique_ptr<KoSvgTextShape> sampleText(new KoSvgTextShape());
sampleText->insertText(0, sample.isEmpty()? name().isEmpty()? SAMPLE_PLACEHOLDER.toString(): name(): sample);
const QString type = styleType().isEmpty()? STYLE_TYPE_CHARACTER: styleType();
@@ -204,11 +204,11 @@ KoShape* KoCssStylePreset::generateSampleShape() const
sampleText->setShapesInside({inlineShape});
sampleText->relayout();
- return sampleText.take();
+ return sampleText.release();
} else {
/// For character the sample always needs to be set to be a child to
/// ensure that the character property doesn't include the default props.
- QScopedPointer<KoSvgTextShape> newShape(new KoSvgTextShape());
+ std::unique_ptr<KoSvgTextShape> newShape(new KoSvgTextShape());
KoSvgTextProperties paraProps = KoSvgTextProperties::defaultProperties();
// Set whitespace rule to pre-wrap.
paraProps.setProperty(KoSvgTextProperties::TextCollapseId, KoSvgText::Preserve);
@@ -221,8 +221,8 @@ KoShape* KoCssStylePreset::generateSampleShape() const
newShape->insertText(0, before);
}
- newShape->insertRichText(newShape->posForIndex(before.size()), sampleText.data());
- return newShape.take();
+ newShape->insertRichText(newShape->posForIndex(before.size()), sampleText.get());
+ return newShape.release();
}
return nullptr;
@@ -472,7 +472,7 @@ bool KoCssStylePreset::loadFromDevice(QIODevice *dev, KisResourcesInterfaceSP re
bool KoCssStylePreset::saveToDevice(QIODevice *dev) const
{
- QScopedPointer<KoShape> shape(generateSampleShape());
+ std::unique_ptr<KoShape> shape(generateSampleShape());
if (!shape) return false;
QMap<QString, QVariant> m = metadata();
@@ -480,7 +480,7 @@ bool KoCssStylePreset::saveToDevice(QIODevice *dev) const
shape->setAdditionalAttribute(TITLE, name());
const QRectF boundingRect = shape->boundingRect();
- SvgWriter writer({shape.take()});
+ SvgWriter writer({shape.release()});
return writer.save(*dev, boundingRect.size());
}
diff --git a/libs/flake/svg/SvgParser.cpp b/libs/flake/svg/SvgParser.cpp
index 2aec0a38a3..04d970c473 100644
--- a/libs/flake/svg/SvgParser.cpp
+++ b/libs/flake/svg/SvgParser.cpp
@@ -740,7 +740,7 @@ bool SvgParser::parseMarker(const QDomElement &e)
const QString id = e.attribute("id");
if (id.isEmpty()) return false;
- QScopedPointer<KoMarker> marker(new KoMarker());
+ std::unique_ptr<KoMarker> marker(new KoMarker());
marker->setCoordinateSystem(
KoMarker::coordinateSystemFromString(e.attribute("markerUnits", "strokeWidth")));
@@ -771,7 +771,7 @@ bool SvgParser::parseMarker(const QDomElement &e)
marker->setShapes({markerShape});
- m_markers.insert(id, QExplicitlySharedDataPointer<KoMarker>(marker.take()));
+ m_markers.insert(id, QExplicitlySharedDataPointer<KoMarker>(marker.release()));
return true;
}
@@ -782,7 +782,7 @@ bool SvgParser::parseSymbol(const QDomElement &e)
if (id.isEmpty()) return false;
- QScopedPointer<KoSvgSymbol> svgSymbol(new KoSvgSymbol());
+ std::unique_ptr<KoSvgSymbol> svgSymbol(new KoSvgSymbol());
// ensure that the clip path is loaded in local coordinates system
m_context.pushGraphicsContext(e, false);
@@ -791,13 +791,13 @@ bool SvgParser::parseSymbol(const QDomElement &e)
QString title = e.firstChildElement("title").toElement().text();
- QScopedPointer<KoShape> symbolShape(parseGroup(e));
+ std::unique_ptr<KoShape> symbolShape(parseGroup(e));
m_context.popGraphicsContext();
if (!symbolShape) return false;
- svgSymbol->shape = symbolShape.take();
+ svgSymbol->shape = symbolShape.release();
svgSymbol->title = title;
svgSymbol->id = id;
if (title.isEmpty()) svgSymbol->title = id;
@@ -814,7 +814,7 @@ bool SvgParser::parseSymbol(const QDomElement &e)
m_symbols.remove(id);
}
- m_symbols.insert(id, svgSymbol.take());
+ m_symbols.insert(id, svgSymbol.release());
return true;
}
diff --git a/libs/flake/tests/TestSvgParser.cpp b/libs/flake/tests/TestSvgParser.cpp
index cdac06c368..e9a76a015f 100644
--- a/libs/flake/tests/TestSvgParser.cpp
+++ b/libs/flake/tests/TestSvgParser.cpp
@@ -2932,31 +2932,31 @@ void TestSvgParser::testKoClipPathRendering()
clipPath2.lineTo(15,30);
clipPath2.lineTo(0,7);
- QScopedPointer<KoPathShape> shape1(KoPathShape::createShapeFromPainterPath(path1));
+ std::unique_ptr<KoPathShape> shape1(KoPathShape::createShapeFromPainterPath(path1));
shape1->setBackground(QSharedPointer<KoColorBackground>(new KoColorBackground(Qt::blue)));
- QScopedPointer<KoPathShape> shape2(KoPathShape::createShapeFromPainterPath(path2));
+ std::unique_ptr<KoPathShape> shape2(KoPathShape::createShapeFromPainterPath(path2));
shape2->setBackground(QSharedPointer<KoColorBackground>(new KoColorBackground(Qt::red)));
- QScopedPointer<KoPathShape> clipShape1(KoPathShape::createShapeFromPainterPath(clipPath1));
- KoClipPath *koClipPath1 = new KoClipPath({clipShape1.take()}, KoFlake::UserSpaceOnUse);
+ std::unique_ptr<KoPathShape> clipShape1(KoPathShape::createShapeFromPainterPath(clipPath1));
+ KoClipPath *koClipPath1 = new KoClipPath({clipShape1.release()}, KoFlake::UserSpaceOnUse);
koClipPath1->setClipRule(Qt::WindingFill);
shape1->setClipPath(koClipPath1);
- QScopedPointer<KoShapeGroup> group(new KoShapeGroup());
+ std::unique_ptr<KoShapeGroup> group(new KoShapeGroup());
{
- QList<KoShape*> shapes({shape1.take(), shape2.take()});
+ QList<KoShape*> shapes({shape1.release(), shape2.release()});
- KoShapeGroupCommand cmd(group.data(), shapes, false);
+ KoShapeGroupCommand cmd(group.get(), shapes, false);
cmd.redo();
}
- QScopedPointer<KoPathShape> clipShape2(KoPathShape::createShapeFromPainterPath(clipPath2));
- KoClipPath *koClipPath2 = new KoClipPath({clipShape2.take()}, KoFlake::UserSpaceOnUse);
+ std::unique_ptr<KoPathShape> clipShape2(KoPathShape::createShapeFromPainterPath(clipPath2));
+ KoClipPath *koClipPath2 = new KoClipPath({clipShape2.release()}, KoFlake::UserSpaceOnUse);
koClipPath2->setClipRule(Qt::WindingFill);
group->setClipPath(koClipPath2);
- SvgRenderTester::testRender(group.take(), "load", "clip_render_test", QSize(30,30), 72.0);
+ SvgRenderTester::testRender(group.release(), "load", "clip_render_test", QSize(30,30), 72.0);
}
void TestSvgParser::testKoClipPathRelativeRendering()
@@ -2976,31 +2976,31 @@ void TestSvgParser::testKoClipPathRelativeRendering()
clipPath2.lineTo(0.5,1);
clipPath2.lineTo(0,0);
- QScopedPointer<KoPathShape> shape1(KoPathShape::createShapeFromPainterPath(path1));
+ std::unique_ptr<KoPathShape> shape1(KoPathShape::createShapeFromPainterPath(path1));
shape1->setBackground(QSharedPointer<KoColorBackground>(new KoColorBackground(Qt::blue)));
- QScopedPointer<KoPathShape> shape2(KoPathShape::createShapeFromPainterPath(path2));
+ std::unique_ptr<KoPathShape> shape2(KoPathShape::createShapeFromPainterPath(path2));
shape2->setBackground(QSharedPointer<KoColorBackground>(new KoColorBackground(Qt::red)));
- QScopedPointer<KoPathShape> clipShape1(KoPathShape::createShapeFromPainterPath(clipPath1));
- KoClipPath *koClipPath1 = new KoClipPath({clipShape1.take()}, KoFlake::UserSpaceOnUse);
+ std::unique_ptr<KoPathShape> clipShape1(KoPathShape::createShapeFromPainterPath(clipPath1));
+ KoClipPath *koClipPath1 = new KoClipPath({clipShape1.release()}, KoFlake::UserSpaceOnUse);
koClipPath1->setClipRule(Qt::WindingFill);
shape1->setClipPath(koClipPath1);
- QScopedPointer<KoShapeGroup> group(new KoShapeGroup());
+ std::unique_ptr<KoShapeGroup> group(new KoShapeGroup());
{
- QList<KoShape*> shapes({shape1.take(), shape2.take()});
+ QList<KoShape*> shapes({shape1.release(), shape2.release()});
- KoShapeGroupCommand cmd(group.data(), shapes, false);
+ KoShapeGroupCommand cmd(group.get(), shapes, false);
cmd.redo();
}
- QScopedPointer<KoPathShape> clipShape2(KoPathShape::createShapeFromPainterPath(clipPath2));
- KoClipPath *koClipPath2 = new KoClipPath({clipShape2.take()}, KoFlake::ObjectBoundingBox);
+ std::unique_ptr<KoPathShape> clipShape2(KoPathShape::createShapeFromPainterPath(clipPath2));
+ KoClipPath *koClipPath2 = new KoClipPath({clipShape2.release()}, KoFlake::ObjectBoundingBox);
koClipPath2->setClipRule(Qt::WindingFill);
group->setClipPath(koClipPath2);
- SvgRenderTester::testRender(group.take(), "load", "relative_clip_render_test", QSize(30,30), 72.0);
+ SvgRenderTester::testRender(group.release(), "load", "relative_clip_render_test", QSize(30,30), 72.0);
}
void TestSvgParser::testRenderClipPath_User()
diff --git a/libs/flake/tools/KoPathControlPointMoveStrategy.cpp b/libs/flake/tools/KoPathControlPointMoveStrategy.cpp
index b251c57adc..c0e50d939f 100644
--- a/libs/flake/tools/KoPathControlPointMoveStrategy.cpp
+++ b/libs/flake/tools/KoPathControlPointMoveStrategy.cpp
@@ -52,7 +52,7 @@ void KoPathControlPointMoveStrategy::finishInteraction(Qt::KeyboardModifiers mod
KUndo2Command* KoPathControlPointMoveStrategy::createCommand()
{
if (m_intermediateCommand) {
- return new KisCommandUtils::SkipFirstRedoWrapper(m_intermediateCommand.take());
+ return new KisCommandUtils::SkipFirstRedoWrapper(m_intermediateCommand.release());
}
return nullptr;
}
diff --git a/libs/flake/tools/KoPathControlPointMoveStrategy.h b/libs/flake/tools/KoPathControlPointMoveStrategy.h
index df17ff7c66..d4283aaf0f 100644
--- a/libs/flake/tools/KoPathControlPointMoveStrategy.h
+++ b/libs/flake/tools/KoPathControlPointMoveStrategy.h
@@ -39,7 +39,7 @@ private:
KoPathPointData m_pointData;
KoPathShape *m_path;
KoPathPoint::PointType m_pointType;
- QScopedPointer<KUndo2Command> m_intermediateCommand;
+ std::unique_ptr<KUndo2Command> m_intermediateCommand;
};
#endif /* KOPATHCONTROLPOINTMOVESTRATEGY_H */
diff --git a/libs/flake/tools/KoPathPointMoveStrategy.cpp b/libs/flake/tools/KoPathPointMoveStrategy.cpp
index 447b5e1998..cbd3e03a79 100644
--- a/libs/flake/tools/KoPathPointMoveStrategy.cpp
+++ b/libs/flake/tools/KoPathPointMoveStrategy.cpp
@@ -59,7 +59,7 @@ void KoPathPointMoveStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
KUndo2Command* KoPathPointMoveStrategy::createCommand()
{
if (m_intermediateCommand) {
- return new KisCommandUtils::SkipFirstRedoWrapper(m_intermediateCommand.take());
+ return new KisCommandUtils::SkipFirstRedoWrapper(m_intermediateCommand.release());
}
return nullptr;
}
diff --git a/libs/flake/tools/KoPathPointMoveStrategy.h b/libs/flake/tools/KoPathPointMoveStrategy.h
index cce253439b..a2f3b08e7f 100644
--- a/libs/flake/tools/KoPathPointMoveStrategy.h
+++ b/libs/flake/tools/KoPathPointMoveStrategy.h
@@ -34,7 +34,7 @@ private:
QPointF m_move;
/// pointer to the path tool
KoPathTool *m_tool;
- QScopedPointer<KUndo2Command> m_intermediateCommand;
+ std::unique_ptr<KUndo2Command> m_intermediateCommand;
};
#endif /* KOPATHPOINTMOVESTRATEGY_H */
diff --git a/libs/flake/tools/KoPathTool.cpp b/libs/flake/tools/KoPathTool.cpp
index a393c0400a..d019094b7e 100644
--- a/libs/flake/tools/KoPathTool.cpp
+++ b/libs/flake/tools/KoPathTool.cpp
@@ -835,7 +835,7 @@ KoPathTool::PathSegment* KoPathTool::segmentAtPoint(const QPointF &point)
{
// the max allowed distance from a segment
const QRectF grabRoi = handleGrabRect(point);
- QScopedPointer<PathSegment> segment(new PathSegment);
+ std::unique_ptr<PathSegment> segment(new PathSegment);
Q_FOREACH (KoPathShape *shape, m_pointSelection.selectedShapes()) {
KoParameterShape * parameterShape = dynamic_cast<KoParameterShape*>(shape);
@@ -854,7 +854,7 @@ KoPathTool::PathSegment* KoPathTool::segmentAtPoint(const QPointF &point)
segment.reset();
}
- return segment.take();
+ return segment.release();
}
void KoPathTool::activate(const QSet<KoShape*> &shapes)
diff --git a/libs/image/KisOverlayPaintDeviceWrapper.cpp b/libs/image/KisOverlayPaintDeviceWrapper.cpp
index bf060e48db..e5f6baace0 100644
--- a/libs/image/KisOverlayPaintDeviceWrapper.cpp
+++ b/libs/image/KisOverlayPaintDeviceWrapper.cpp
@@ -32,7 +32,7 @@ struct KisOverlayPaintDeviceWrapper::Private
QScopedPointer<KoOptimizedPixelDataScalerU8ToU16Base> scaler;
KisPaintDeviceSP externalDestination;
- QScopedPointer<KUndo2Command> rootTransactionData;
+ std::unique_ptr<KUndo2Command> rootTransactionData;
KisChangeOverlayWrapperCommand *changeOverlayCommand;
std::vector<std::unique_ptr<KisTransaction>> overlayTransactions;
QSharedPointer<KisRectsGrid> previousGrid;
@@ -316,11 +316,11 @@ void KisOverlayPaintDeviceWrapper::beginTransaction(KUndo2Command *parent)
m_d->rootTransactionData.reset(new KUndo2Command(parent));
m_d->changeOverlayCommand = new KisChangeOverlayWrapperCommand(m_d.data());
- (void) new KisCommandUtils::SkipFirstRedoWrapper(m_d->changeOverlayCommand, m_d->rootTransactionData.data());
+ (void) new KisCommandUtils::SkipFirstRedoWrapper(m_d->changeOverlayCommand, m_d->rootTransactionData.get());
m_d->changeOverlayCommand->m_oldRectsGrid = m_d->previousGrid;
for (const auto &overlayDevice : m_d->overlays) {
- m_d->overlayTransactions.emplace_back(new KisTransaction(overlayDevice, m_d->rootTransactionData.data()));
+ m_d->overlayTransactions.emplace_back(new KisTransaction(overlayDevice, m_d->rootTransactionData.get()));
}
}
@@ -336,7 +336,7 @@ KUndo2Command *KisOverlayPaintDeviceWrapper::endTransaction()
m_d->previousGrid.reset(new KisRectsGrid(m_d->grid));
m_d->changeOverlayCommand->m_newRectsGrid = m_d->previousGrid;
- result = m_d->rootTransactionData.take();
+ result = m_d->rootTransactionData.release();
for (auto &transactionPtr : m_d->overlayTransactions) {
// the transactions are assigned as children to m_d->changeOverlayCommand
diff --git a/libs/image/commands/kis_node_property_list_command.cpp b/libs/image/commands/kis_node_property_list_command.cpp
index fe354c6675..828876d14c 100644
--- a/libs/image/commands/kis_node_property_list_command.cpp
+++ b/libs/image/commands/kis_node_property_list_command.cpp
@@ -231,10 +231,10 @@ void KisNodePropertyListCommand::setNodePropertiesAutoUndo(KisNodeSP node, KisIm
(properties.size() != 1 ||
!KisLayerPropertiesIcons::isStatelessProperty(*properties.begin()));
- QScopedPointer<KUndo2Command> cmd(new KisNodePropertyListCommand(node, proplist));
+ std::unique_ptr<KUndo2Command> cmd(new KisNodePropertyListCommand(node, proplist));
if (undo) {
- image->undoAdapter()->addCommand(cmd.take());
+ image->undoAdapter()->addCommand(cmd.release());
}
else {
/**
@@ -268,7 +268,7 @@ void KisNodePropertyListCommand::setNodePropertiesAutoUndo(KisNodeSP node, KisIm
QScopedPointer<KUndo2Command> m_cmd;
};
- KisStrokeId strokeId = image->startStroke(new SimpleLodResettingStroke(cmd.take()));
+ KisStrokeId strokeId = image->startStroke(new SimpleLodResettingStroke(cmd.release()));
image->endStroke(strokeId);
}
diff --git a/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp b/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp
index e2420c2303..37c2058070 100644
--- a/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp
+++ b/libs/image/commands_new/KisLazyCreateTransformMaskKeyframesCommand.cpp
@@ -36,7 +36,7 @@ bool KisLazyCreateTransformMaskKeyframesCommand::maskHasAnimation(KisTransformMa
void KisLazyCreateTransformMaskKeyframesCommand::populateChildCommands()
{
- QScopedPointer<KUndo2Command> parentCommand(new KUndo2Command);
+ std::unique_ptr<KUndo2Command> parentCommand(new KUndo2Command);
KIS_SAFE_ASSERT_RECOVER_RETURN(m_mask->parent());
@@ -52,18 +52,18 @@ void KisLazyCreateTransformMaskKeyframesCommand::populateChildCommands()
}
};
- addKeyframe(KisKeyframeChannel::PositionX, parentCommand.data());
- addKeyframe(KisKeyframeChannel::PositionY, parentCommand.data());
+ addKeyframe(KisKeyframeChannel::PositionX, parentCommand.get());
+ addKeyframe(KisKeyframeChannel::PositionY, parentCommand.get());
- addKeyframe(KisKeyframeChannel::ScaleX, parentCommand.data());
- addKeyframe(KisKeyframeChannel::ScaleY, parentCommand.data());
+ addKeyframe(KisKeyframeChannel::ScaleX, parentCommand.get());
+ addKeyframe(KisKeyframeChannel::ScaleY, parentCommand.get());
- addKeyframe(KisKeyframeChannel::ShearX, parentCommand.data());
- addKeyframe(KisKeyframeChannel::ShearY, parentCommand.data());
+ addKeyframe(KisKeyframeChannel::ShearX, parentCommand.get());
+ addKeyframe(KisKeyframeChannel::ShearY, parentCommand.get());
- addKeyframe(KisKeyframeChannel::RotationX, parentCommand.data());
- addKeyframe(KisKeyframeChannel::RotationY, parentCommand.data());
- addKeyframe(KisKeyframeChannel::RotationZ, parentCommand.data());
+ addKeyframe(KisKeyframeChannel::RotationX, parentCommand.get());
+ addKeyframe(KisKeyframeChannel::RotationY, parentCommand.get());
+ addKeyframe(KisKeyframeChannel::RotationZ, parentCommand.get());
- addCommand(parentCommand.take());
+ addCommand(parentCommand.release());
}
diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.cc
index db0caee3d8..e2a0411762 100644
--- a/libs/image/kis_image.cc
+++ b/libs/image/kis_image.cc
@@ -930,7 +930,7 @@ void KisImage::purgeUnusedData(bool isCancellable)
// all transactions will be linked to the final command via the
// parent-child relationship
- m_transactions.emplace_back(dev, m_finalCommand.data(), -1, nullptr, KisTransaction::None);
+ m_transactions.emplace_back(dev, m_finalCommand.get(), -1, nullptr, KisTransaction::None);
}
// now, when the transactions are started, we can merge the two lists
@@ -949,20 +949,20 @@ void KisImage::purgeUnusedData(bool isCancellable)
void finishStrokeCallback() override {
for (auto it = m_transactions.begin(); it != m_transactions.end(); ++it) {
- QScopedPointer<KUndo2Command> cmd(it->endAndTake());
+ std::unique_ptr<KUndo2Command> cmd(it->endAndTake());
// verify the transaction command is linked to m_finalCommand,
// if not, just delete on return
KIS_SAFE_ASSERT_RECOVER(cmd->hasParent()) { continue; }
// if has a parent, release...
- (void)cmd.take();
+ (void)cmd.release();
}
m_transactions.clear();
m_finalCommand->redo();
- m_image->postExecutionUndoAdapter()->addCommand(toQShared(m_finalCommand.take()));
+ m_image->postExecutionUndoAdapter()->addCommand(toQShared(m_finalCommand.release()));
// now reset the thumbnail generation limitation
KisLayerUtils::recursiveApplyNodes(m_image->root(),
@@ -975,7 +975,7 @@ void KisImage::purgeUnusedData(bool isCancellable)
private:
KisImageSP m_image;
- QScopedPointer<KUndo2Command> m_finalCommand;
+ std::unique_ptr<KUndo2Command> m_finalCommand;
std::vector<KisTransaction> m_transactions;
};
diff --git a/libs/image/kis_selection.cc b/libs/image/kis_selection.cc
index 18af6c73e6..8e290a464c 100644
--- a/libs/image/kis_selection.cc
+++ b/libs/image/kis_selection.cc
@@ -182,7 +182,7 @@ struct KisSelection::ChangeShapeSelectionCommand : public KUndo2Command
}
if (m_reincarnationCommand) {
- Private::safeDeleteShapeSelection(m_reincarnationCommand.take(), m_selection ? m_selection.data() : 0);
+ Private::safeDeleteShapeSelection(m_reincarnationCommand.release(), m_selection ? m_selection.data() : 0);
}
}
@@ -236,7 +236,7 @@ struct KisSelection::ChangeShapeSelectionCommand : public KUndo2Command
private:
KisSelectionWSP m_selection;
KisSelectionComponent *m_shapeSelection = 0;
- QScopedPointer<KUndo2Command> m_reincarnationCommand;
+ std::unique_ptr<KUndo2Command> m_reincarnationCommand;
bool m_firstRedo = true;
bool m_isFlatten = false;
};
diff --git a/libs/image/kis_stroke_strategy_undo_command_based.cpp b/libs/image/kis_stroke_strategy_undo_command_based.cpp
index 11dc49b609..1e1701ebc3 100644
--- a/libs/image/kis_stroke_strategy_undo_command_based.cpp
+++ b/libs/image/kis_stroke_strategy_undo_command_based.cpp
@@ -176,7 +176,7 @@ void KisStrokeStrategyUndoCommandBased::setMacroId(int value)
void KisStrokeStrategyUndoCommandBased::postProcessToplevelCommand(KUndo2Command *command)
{
if (m_commandExtraData) {
- command->setExtraData(m_commandExtraData.take());
+ command->setExtraData(m_commandExtraData.release());
}
KisSavedMacroCommand *savedCommand = dynamic_cast<KisSavedMacroCommand*>(command);
diff --git a/libs/image/kis_stroke_strategy_undo_command_based.h b/libs/image/kis_stroke_strategy_undo_command_based.h
index 330a89ac5a..82c693aeb9 100644
--- a/libs/image/kis_stroke_strategy_undo_command_based.h
+++ b/libs/image/kis_stroke_strategy_undo_command_based.h
@@ -149,7 +149,7 @@ private:
KUndo2CommandSP m_finishCommand;
KisStrokeUndoFacade *m_undoFacade {nullptr};
- QScopedPointer<KUndo2CommandExtraData> m_commandExtraData;
+ std::unique_ptr<KUndo2CommandExtraData> m_commandExtraData;
int m_macroId;
// protects done commands only
diff --git a/libs/image/kis_suspend_projection_updates_stroke_strategy.cpp b/libs/image/kis_suspend_projection_updates_stroke_strategy.cpp
index 1a05db8e56..9027efb9e9 100644
--- a/libs/image/kis_suspend_projection_updates_stroke_strategy.cpp
+++ b/libs/image/kis_suspend_projection_updates_stroke_strategy.cpp
@@ -210,7 +210,7 @@ struct KisSuspendProjectionUpdatesStrokeStrategy::Private
m_command->redo();
}
- QScopedPointer<StrokeJobCommand> m_command;
+ std::unique_ptr<StrokeJobCommand> m_command;
};
// Suspend job should be a barrier to ensure all
@@ -516,7 +516,7 @@ void KisSuspendProjectionUpdatesStrokeStrategy::doStrokeCallback(KisStrokeJobDat
runnable->run();
if (Private::UndoableData *undoable = dynamic_cast<Private::UndoableData*>(data)) {
- Private::StrokeJobCommand *command = undoable->m_command.take();
+ Private::StrokeJobCommand *command = undoable->m_command.release();
m_d->executedCommands.append(command);
}
}
diff --git a/libs/image/layerstyles/gimp_bump_map.cpp b/libs/image/layerstyles/gimp_bump_map.cpp
index fc837c65a3..e64e56279f 100644
--- a/libs/image/layerstyles/gimp_bump_map.cpp
+++ b/libs/image/layerstyles/gimp_bump_map.cpp
@@ -75,23 +75,23 @@ void bumpmap (KisPixelSelectionSP device,
const int selectionRowSize = selectionRect.width() * sizeof(quint8);
QScopedArrayPointer<quint8> dstRow(new quint8[selectionRowSize]);
- QScopedArrayPointer<quint8> bmRow1(new quint8[dataRowSize]);
- QScopedArrayPointer<quint8> bmRow2(new quint8[dataRowSize]);
- QScopedArrayPointer<quint8> bmRow3(new quint8[dataRowSize]);
+ std::unique_ptr<quint8[]> bmRow1(new quint8[dataRowSize]);
+ std::unique_ptr<quint8[]> bmRow2(new quint8[dataRowSize]);
+ std::unique_ptr<quint8[]> bmRow3(new quint8[dataRowSize]);
- device->readBytes(bmRow1.data(), dataRect.left(), dataRect.top(), dataRect.width(), 1);
- device->readBytes(bmRow2.data(), dataRect.left(), dataRect.top() + 1, dataRect.width(), 1);
- device->readBytes(bmRow3.data(), dataRect.left(), dataRect.top() + 2, dataRect.width(), 1);
+ device->readBytes(bmRow1.get(), dataRect.left(), dataRect.top(), dataRect.width(), 1);
+ device->readBytes(bmRow2.get(), dataRect.left(), dataRect.top() + 1, dataRect.width(), 1);
+ device->readBytes(bmRow3.get(), dataRect.left(), dataRect.top() + 2, dataRect.width(), 1);
- convertRow(bmRow1.data(), dataRect.width(), params.lut);
- convertRow(bmRow2.data(), dataRect.width(), params.lut);
- convertRow(bmRow3.data(), dataRect.width(), params.lut);
+ convertRow(bmRow1.get(), dataRect.width(), params.lut);
+ convertRow(bmRow2.get(), dataRect.width(), params.lut);
+ convertRow(bmRow3.get(), dataRect.width(), params.lut);
for (int row = selectionRect.top();
row < selectionRect.top() + selectionRect.height(); row++) {
bumpmap_row (bmvals, dstRow.data(), selectionRect.width(),
- bmRow1.data() + 1, bmRow2.data() + 1, bmRow3.data() + 1,
+ bmRow1.get() + 1, bmRow2.get() + 1, bmRow3.get() + 1,
&params);
device->writeBytes(dstRow.data(), selectionRect.left(), row, selectionRect.width(), 1);
@@ -99,8 +99,8 @@ void bumpmap (KisPixelSelectionSP device,
bmRow1.swap(bmRow2);
bmRow2.swap(bmRow3);
- device->readBytes(bmRow3.data(), dataRect.left(), row + 1, dataRect.width(), 1);
- convertRow(bmRow3.data(), dataRect.width(), params.lut);
+ device->readBytes(bmRow3.get(), dataRect.left(), row + 1, dataRect.width(), 1);
+ convertRow(bmRow3.get(), dataRect.width(), params.lut);
}
}
diff --git a/libs/koplugin/KoJsonTrader.cpp b/libs/koplugin/KoJsonTrader.cpp
index c3ca4e5f55..87c14c911a 100644
--- a/libs/koplugin/KoJsonTrader.cpp
+++ b/libs/koplugin/KoJsonTrader.cpp
@@ -150,7 +150,7 @@ void KoJsonTrader::initializePluginLoaderCache()
#endif
dbgPlugins << dirIter.fileName();
- QScopedPointer<QPluginLoader> loader(new QPluginLoader(dirIter.filePath()));
+ std::unique_ptr<QPluginLoader> loader(new QPluginLoader(dirIter.filePath()));
QJsonObject json = loader->metaData().value("MetaData").toObject();
dbgPlugins << json << json.value("X-KDE-ServiceTypes");
@@ -173,7 +173,7 @@ void KoJsonTrader::initializePluginLoaderCache()
cacheEntry.filePath = dirIter.filePath();
cacheEntry.serviceTypes = serviceTypes;
cacheEntry.mimeTypes = mimeTypes;
- cacheEntry.loader = toQShared(loader.take());
+ cacheEntry.loader = toQShared(loader.release());
m_pluginLoaderCache << cacheEntry;
}
}
diff --git a/libs/libkis/TransformMask.cpp b/libs/libkis/TransformMask.cpp
index 39df45ae8d..3443ae894e 100644
--- a/libs/libkis/TransformMask.cpp
+++ b/libs/libkis/TransformMask.cpp
@@ -101,15 +101,15 @@ bool TransformMask::fromXML (const QString &xml)
return false;
}
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command);
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command);
if (KisLazyCreateTransformMaskKeyframesCommand::maskHasAnimation(mask)) {
- new KisLazyCreateTransformMaskKeyframesCommand(mask, cmd.data());
+ new KisLazyCreateTransformMaskKeyframesCommand(mask, cmd.get());
}
- new KisSimpleModifyTransformMaskCommand(mask, params, {}, cmd.data());
+ new KisSimpleModifyTransformMaskCommand(mask, params, {}, cmd.get());
- KisProcessingApplicator::runSingleCommandStroke(this->node()->image(), cmd.take());
+ KisProcessingApplicator::runSingleCommandStroke(this->node()->image(), cmd.release());
return true;
}
diff --git a/libs/psd/psd_layer_section.cpp b/libs/psd/psd_layer_section.cpp
index 85ed174fb1..4c776ce4e1 100644
--- a/libs/psd/psd_layer_section.cpp
+++ b/libs/psd/psd_layer_section.cpp
@@ -125,7 +125,7 @@ bool PSDLayerMaskSection::readLayerInfoImpl(QIODevice &io)
dbgFile << "== Enter PSDLayerRecord";
PSDHeader sanitizedHeader(m_header);
sanitizedHeader.tiffStyleLayerBlock = false; // disable padding
- QScopedPointer<PSDLayerRecord> layerRecord(new PSDLayerRecord(sanitizedHeader));
+ std::unique_ptr<PSDLayerRecord> layerRecord(new PSDLayerRecord(sanitizedHeader));
if (!layerRecord->read(io)) {
error = QString("Could not load layer %1: %2").arg(i).arg(layerRecord->error);
return false;
@@ -133,7 +133,7 @@ bool PSDLayerMaskSection::readLayerInfoImpl(QIODevice &io)
dbgFile << "== Leave PSDLayerRecord";
dbgFile << "Finished reading layer" << i << layerRecord->layerName << "blending mode" << layerRecord->blendModeKey << io.pos()
<< "Number of channels:" << layerRecord->channelInfoRecords.size();
- layers << layerRecord.take();
+ layers << layerRecord.release();
}
}
diff --git a/libs/ui/KisDocument.cpp b/libs/ui/KisDocument.cpp
index a6247d36ed..d5a7e2a473 100644
--- a/libs/ui/KisDocument.cpp
+++ b/libs/ui/KisDocument.cpp
@@ -403,7 +403,7 @@ public:
bool imageModifiedWithoutUndo = false;
bool modifiedWhileSaving = false;
- QScopedPointer<KisDocument> backgroundSaveDocument;
+ std::unique_ptr<KisDocument> backgroundSaveDocument;
QPointer<KoUpdater> savingUpdater;
QFuture<KisImportExportErrorCode> childSavingFuture;
KritaUtils::ExportFileJob backgroundSaveJob;
@@ -1375,7 +1375,7 @@ KritaUtils::BackgroudSavingStartResult KisDocument::initiateSavingInBackground(c
{
KIS_ASSERT_RECOVER_RETURN_VALUE(job.isValid(), KritaUtils::BackgroudSavingStartResult::Failure);
- QScopedPointer<KisDocument> clonedDocument;
+ std::unique_ptr<KisDocument> clonedDocument;
if (!optionalClonedDocument) {
clonedDocument.reset(lockAndCloneForSaving());
@@ -1444,7 +1444,7 @@ KritaUtils::BackgroudSavingStartResult KisDocument::initiateSavingInBackground(c
*/
savingMutexLock.release();
- d->backgroundSaveDocument.reset(clonedDocument.take());
+ d->backgroundSaveDocument.reset(clonedDocument.release());
d->backgroundSaveJob = job;
d->modifiedWhileSaving = false;
@@ -1452,7 +1452,7 @@ KritaUtils::BackgroudSavingStartResult KisDocument::initiateSavingInBackground(c
d->backgroundSaveDocument->d->isAutosaving = true;
}
- connect(d->backgroundSaveDocument.data(),
+ connect(d->backgroundSaveDocument.get(),
SIGNAL(sigBackgroundSavingFinished(KisImportExportErrorCode, QString, QString)),
this,
SLOT(slotChildCompletedSavingInBackground(KisImportExportErrorCode, QString, QString)));
@@ -1475,7 +1475,7 @@ KritaUtils::BackgroudSavingStartResult KisDocument::initiateSavingInBackground(c
if (!error.isOk()) {
// the state should have been deinitialized in slotChildCompletedSavingInBackground()
KIS_SAFE_ASSERT_RECOVER (!d->backgroundSaveDocument && !d->backgroundSaveJob.isValid()) {
- d->backgroundSaveDocument.take()->deleteLater();
+ d->backgroundSaveDocument.release()->deleteLater();
d->savingMutex.unlock();
d->backgroundSaveJob = KritaUtils::ExportFileJob();
}
@@ -1506,7 +1506,7 @@ void KisDocument::slotChildCompletedSavingInBackground(KisImportExportErrorCode
d->backgroundSaveDocument->d->isAutosaving = false;
}
- d->backgroundSaveDocument.take()->deleteLater();
+ d->backgroundSaveDocument.release()->deleteLater();
KIS_ASSERT_RECOVER_RETURN(d->backgroundSaveJob.isValid());
diff --git a/libs/ui/KisPart.cpp b/libs/ui/KisPart.cpp
index fa0a66b899..6f586b3929 100644
--- a/libs/ui/KisPart.cpp
+++ b/libs/ui/KisPart.cpp
@@ -108,7 +108,7 @@ public:
QList<QPointer<KisDocument> > documents;
KisIdleWatcher idleWatcher;
KisAnimationCachePopulator animationCachePopulator;
- QScopedPointer<KisPlaybackEngine> playbackEngine;
+ std::unique_ptr<KisPlaybackEngine> playbackEngine;
KisSessionResourceSP currentSession;
bool closingSession{false};
@@ -500,7 +500,7 @@ KisAnimationCachePopulator* KisPart::cachePopulator() const
KisPlaybackEngine *KisPart::playbackEngine() const
{
- return d->playbackEngine.data();
+ return d->playbackEngine.get();
}
void KisPart::prioritizeFrameForCache(KisImageSP image, int frame) {
@@ -697,7 +697,7 @@ void KisPart::setPlaybackEngine(KisPlaybackEngine *p_playbackEngine)
{
// make sure that the old engine is still alive until the end
// of the emitted signal
- QScopedPointer backup(p_playbackEngine);
+ std::unique_ptr<KisPlaybackEngine> backup(p_playbackEngine);
d->playbackEngine.swap(backup);
// Log all changes to playback engine for easier debugging.
diff --git a/libs/ui/canvas/kis_image_pyramid.cpp b/libs/ui/canvas/kis_image_pyramid.cpp
index 4ee3662f57..26ebd0117d 100644
--- a/libs/ui/canvas/kis_image_pyramid.cpp
+++ b/libs/ui/canvas/kis_image_pyramid.cpp
@@ -217,10 +217,10 @@ void KisImagePyramid::retrieveImageData(const QRect &rect)
KisPaintDeviceSP originalProjection = m_originalImage->projection();
quint32 numPixels = rect.width() * rect.height();
- QScopedArrayPointer<quint8> originalBytes(
+ std::unique_ptr<quint8[]> originalBytes(
new quint8[originalProjection->colorSpace()->pixelSize() * numPixels]);
- originalProjection->readBytes(originalBytes.data(), rect);
+ originalProjection->readBytes(originalBytes.get(), rect);
if (m_displayFilter &&
m_useOcio &&
@@ -244,17 +244,17 @@ void KisImagePyramid::retrieveImageData(const QRect &rect)
destinationProfile);
if (projectionCs->colorDepthId() == Float32BitsColorDepthID) {
- m_displayFilter->filter(originalBytes.data(), numPixels);
+ m_displayFilter->filter(originalBytes.get(), numPixels);
} else {
- QScopedArrayPointer<quint8> dst(new quint8[floatCs->pixelSize() * numPixels]);
- projectionCs->convertPixelsTo(originalBytes.data(), dst.data(), floatCs, numPixels, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
- m_displayFilter->filter(dst.data(), numPixels);
+ std::unique_ptr<quint8[]> dst(new quint8[floatCs->pixelSize() * numPixels]);
+ projectionCs->convertPixelsTo(originalBytes.get(), dst.get(), floatCs, numPixels, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
+ m_displayFilter->filter(dst.get(), numPixels);
originalBytes.swap(dst);
}
{
- QScopedArrayPointer<quint8> dst(new quint8[modifiedMonitorCs->pixelSize() * numPixels]);
- floatCs->convertPixelsTo(originalBytes.data(), dst.data(), modifiedMonitorCs, numPixels, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
+ std::unique_ptr<quint8[]> dst(new quint8[modifiedMonitorCs->pixelSize() * numPixels]);
+ floatCs->convertPixelsTo(originalBytes.get(), dst.get(), modifiedMonitorCs, numPixels, KoColorConversionTransformation::internalRenderingIntent(), KoColorConversionTransformation::internalConversionFlags());
originalBytes.swap(dst);
}
#endif
@@ -264,25 +264,25 @@ void KisImagePyramid::retrieveImageData(const QRect &rect)
setChannelFlags(QBitArray());
}
if (!m_channelFlags.isEmpty() && !m_allChannelsSelected) {
- QScopedArrayPointer<quint8> dst(new quint8[projectionCs->pixelSize() * numPixels]);
+ std::unique_ptr<quint8[]> dst(new quint8[projectionCs->pixelSize() * numPixels]);
KisConfig cfg(true);
if (m_onlyOneChannelSelected && !cfg.showSingleChannelAsColor()) {
- projectionCs->convertChannelToVisualRepresentation(originalBytes.data(), dst.data(), numPixels, m_selectedChannelIndex);
+ projectionCs->convertChannelToVisualRepresentation(originalBytes.get(), dst.get(), numPixels, m_selectedChannelIndex);
}
else {
- projectionCs->convertChannelToVisualRepresentation(originalBytes.data(), dst.data(), numPixels, m_channelFlags);
+ projectionCs->convertChannelToVisualRepresentation(originalBytes.get(), dst.get(), numPixels, m_channelFlags);
}
originalBytes.swap(dst);
}
- QScopedArrayPointer<quint8> dst(new quint8[m_monitorColorSpace->pixelSize() * numPixels]);
- projectionCs->convertPixelsTo(originalBytes.data(), dst.data(), m_monitorColorSpace, numPixels, m_renderingIntent, m_conversionFlags);
+ std::unique_ptr<quint8[]> dst(new quint8[m_monitorColorSpace->pixelSize() * numPixels]);
+ projectionCs->convertPixelsTo(originalBytes.get(), dst.get(), m_monitorColorSpace, numPixels, m_renderingIntent, m_conversionFlags);
originalBytes.swap(dst);
}
- m_pyramid[ORIGINAL_INDEX]->writeBytes(originalBytes.data(), rect);
+ m_pyramid[ORIGINAL_INDEX]->writeBytes(originalBytes.get(), rect);
}
void KisImagePyramid::recalculateCache(KisPPUpdateInfoSP info)
diff --git a/libs/ui/input/kis_input_manager_p.cpp b/libs/ui/input/kis_input_manager_p.cpp
index d26ad285fc..ab60368590 100644
--- a/libs/ui/input/kis_input_manager_p.cpp
+++ b/libs/ui/input/kis_input_manager_p.cpp
@@ -529,7 +529,7 @@ void KisInputManager::Private::addWheelShortcut(KisAbstractInputAction* action,
const QList<Qt::Key> &modifiers,
KisShortcutConfiguration::MouseWheelMovement wheelAction)
{
- QScopedPointer<KisSingleActionShortcut> keyShortcut(
+ std::unique_ptr<KisSingleActionShortcut> keyShortcut(
new KisSingleActionShortcut(action, index));
KisSingleActionShortcut::WheelAction a;
@@ -553,7 +553,7 @@ void KisInputManager::Private::addWheelShortcut(KisAbstractInputAction* action,
return;
}
keyShortcut->setWheel(QSet<Qt::Key>(modifiers.begin(), modifiers.end()), a);
- matcher.addShortcut(keyShortcut.take());
+ matcher.addShortcut(keyShortcut.release());
}
void KisInputManager::Private::addTouchShortcut(KisAbstractInputAction* action, int index, KisShortcutConfiguration::GestureAction gesture)
diff --git a/libs/ui/kis_node_manager.cpp b/libs/ui/kis_node_manager.cpp
index 700746ad01..95feca6f1e 100644
--- a/libs/ui/kis_node_manager.cpp
+++ b/libs/ui/kis_node_manager.cpp
@@ -760,13 +760,13 @@ void KisNodeManager::createReferenceImage(bool fromLayer) {
: canvas->currentImage()->projection();
const QImage image = paintDevice->convertToQImage(0, KoColorConversionTransformation::internalRenderingIntent(),
KoColorConversionTransformation::internalConversionFlags());
- QScopedPointer<KisReferenceImage> reference(KisReferenceImage::fromQImage(*canvas->coordinatesConverter(), image));
+ std::unique_ptr<KisReferenceImage> reference(KisReferenceImage::fromQImage(*canvas->coordinatesConverter(), image));
KIS_SAFE_ASSERT_RECOVER_RETURN(canvas);
if (reference) {
if (document->referenceImagesLayer()) {
reference->setZIndex(document->referenceImagesLayer()->shapes().size());
}
- canvas->addCommand(KisReferenceImagesLayer::addReferenceImages(document, {reference.take()}));
+ canvas->addCommand(KisReferenceImagesLayer::addReferenceImages(document, {reference.release()}));
KoToolManager::instance()->switchToolRequested("ToolReferenceImages");
diff --git a/libs/ui/tests/FreehandStrokeBenchmark.cpp b/libs/ui/tests/FreehandStrokeBenchmark.cpp
index 3b012f0744..b319f65ecb 100644
--- a/libs/ui/tests/FreehandStrokeBenchmark.cpp
+++ b/libs/ui/tests/FreehandStrokeBenchmark.cpp
@@ -54,10 +54,10 @@ protected:
KisFreehandStrokeInfo *strokeInfo = new KisFreehandStrokeInfo();
- QScopedPointer<FreehandStrokeStrategy> stroke(
+ std::unique_ptr<FreehandStrokeStrategy> stroke(
new FreehandStrokeStrategy(resources, strokeInfo, kundo2_noi18n("Freehand Stroke")));
- return stroke.take();
+ return stroke.release();
}
void addPaintingJobs(KisImageWSP image,
@@ -77,10 +77,10 @@ protected:
pi1 = KisPaintInformation(QPointF(100, y), 0.5);
pi2 = KisPaintInformation(QPointF(4900, y + 100), 1.0);
- QScopedPointer<KisStrokeJobData> data(
+ std::unique_ptr<KisStrokeJobData> data(
new FreehandStrokeStrategy::Data(0, pi1, pi2));
- image->addJob(strokeId(), data.take());
+ image->addJob(strokeId(), data.release());
}
image->addJob(strokeId(), new KisAsynchronousStrokeUpdateHelper::UpdateData(true));
diff --git a/libs/ui/tests/KisPaintOnTransparencyMaskTest.cpp b/libs/ui/tests/KisPaintOnTransparencyMaskTest.cpp
index dfe67b7146..0170820b87 100644
--- a/libs/ui/tests/KisPaintOnTransparencyMaskTest.cpp
+++ b/libs/ui/tests/KisPaintOnTransparencyMaskTest.cpp
@@ -62,10 +62,10 @@ protected:
KisFreehandStrokeInfo *strokeInfo = new KisFreehandStrokeInfo();
- QScopedPointer<FreehandStrokeStrategy> stroke(
+ std::unique_ptr<FreehandStrokeStrategy> stroke(
new FreehandStrokeStrategy(resources, strokeInfo, kundo2_noi18n("Freehand Stroke")));
- return stroke.take();
+ return stroke.release();
}
void addPaintingJobs(KisImageWSP image,
@@ -85,10 +85,10 @@ protected:
pi1 = KisPaintInformation(QPointF(100, 100), 1.0);
pi2 = KisPaintInformation(QPointF(800, 800), 1.0);
- QScopedPointer<KisStrokeJobData> data(
+ std::unique_ptr<KisStrokeJobData> data(
new FreehandStrokeStrategy::Data(0, pi1, pi2));
- image->addJob(strokeId(), data.take());
+ image->addJob(strokeId(), data.release());
image->addJob(strokeId(), new KisAsynchronousStrokeUpdateHelper::UpdateData(true));
}
diff --git a/libs/ui/tests/freehand_stroke_test.cpp b/libs/ui/tests/freehand_stroke_test.cpp
index e7546f516b..32185fa9c8 100644
--- a/libs/ui/tests/freehand_stroke_test.cpp
+++ b/libs/ui/tests/freehand_stroke_test.cpp
@@ -83,10 +83,10 @@ protected:
KisFreehandStrokeInfo *strokeInfo = new KisFreehandStrokeInfo();
- QScopedPointer<FreehandStrokeStrategy> stroke(
+ std::unique_ptr<FreehandStrokeStrategy> stroke(
new FreehandStrokeStrategy(resources, strokeInfo, kundo2_noi18n("Freehand Stroke")));
- return stroke.take();
+ return stroke.release();
}
void addPaintingJobs(KisImageWSP image,
@@ -109,10 +109,10 @@ protected:
pi2 = KisPaintInformation(QPointF(300, 200));
}
- QScopedPointer<KisStrokeJobData> data(
+ std::unique_ptr<KisStrokeJobData> data(
new FreehandStrokeStrategy::Data(0, pi1, pi2));
- image->addJob(strokeId(), data.take());
+ image->addJob(strokeId(), data.release());
image->addJob(strokeId(), new KisAsynchronousStrokeUpdateHelper::UpdateData(true));
}
diff --git a/libs/ui/tool/kis_tool_utils.cpp b/libs/ui/tool/kis_tool_utils.cpp
index ad6b48500b..4f10aafc0e 100644
--- a/libs/ui/tool/kis_tool_utils.cpp
+++ b/libs/ui/tool/kis_tool_utils.cpp
@@ -228,7 +228,7 @@ namespace KisToolUtils {
[node, selection] () {
KisPaintDeviceSP device = node->paintDevice();
- QScopedPointer<KisCommandUtils::CompositeCommand> parentCommand(
+ std::unique_ptr<KisCommandUtils::CompositeCommand> parentCommand(
new KisCommandUtils::CompositeCommand());
KUndo2Command *autoKeyframeCommand = KisAutoKey::tryAutoCreateDuplicatedFrame(device);
@@ -250,7 +250,7 @@ namespace KisToolUtils {
device->setDirty(dirtyRect);
parentCommand->addCommand(transaction.endAndTake());
- return parentCommand.take();
+ return parentCommand.release();
});
applicator.applyCommand(cmd, KisStrokeJobData::CONCURRENT);
}
diff --git a/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.cpp b/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.cpp
index c8a400aa1a..c21eb4f7eb 100644
--- a/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.cpp
+++ b/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.cpp
@@ -293,24 +293,24 @@ void KisPainterBasedStrokeStrategy::initStrokeCallback()
}
}
- QScopedPointer<KisInterstrokeDataFactory> interstrokeDataFactory(
+ std::unique_ptr<KisInterstrokeDataFactory> interstrokeDataFactory(
KisPaintOpRegistry::instance()->createInterstrokeDataFactory(m_resources->currentPaintOpPreset()));
KIS_SAFE_ASSERT_RECOVER(!interstrokeDataFactory || !hasIndirectPainting) {
interstrokeDataFactory.reset();
}
- QScopedPointer<KisInterstrokeDataTransactionWrapperFactory> wrapper;
+ std::unique_ptr<KisInterstrokeDataTransactionWrapperFactory> wrapper;
if (interstrokeDataFactory) {
wrapper.reset(new KisInterstrokeDataTransactionWrapperFactory(
- interstrokeDataFactory.take(),
+ interstrokeDataFactory.release(),
supportsContinuedInterstrokeData()));
}
m_transaction.reset(new KisTransaction(KUndo2MagicString(), targetDevice, nullptr,
-1,
- wrapper.take()));
+ wrapper.release()));
// WARNING: masked brush cannot work without indirect painting mode!
KIS_SAFE_ASSERT_RECOVER_NOOP(!(supportsMaskingBrush() &&
@@ -416,7 +416,7 @@ void KisPainterBasedStrokeStrategy::finishStrokeCallback()
if (m_autokeyCommand) {
KisCommandUtils::CompositeCommand *wrapper = new KisCommandUtils::CompositeCommand(parentCommand.data());
- wrapper->addCommand(m_autokeyCommand.take());
+ wrapper->addCommand(m_autokeyCommand.release());
}
if (indirect && indirect->hasTemporaryTarget()) {
diff --git a/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h b/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h
index 191f7062da..ea9dd206fa 100644
--- a/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h
+++ b/libs/ui/tool/strokes/kis_painter_based_stroke_strategy.h
@@ -127,7 +127,7 @@ private:
KisPaintDeviceSP m_targetDevice;
KisSelectionSP m_activeSelection;
- QScopedPointer<KUndo2Command> m_autokeyCommand;
+ std::unique_ptr<KUndo2Command> m_autokeyCommand;
bool m_useMergeID {false};
diff --git a/libs/ui/tool/strokes/move_stroke_strategy.cpp b/libs/ui/tool/strokes/move_stroke_strategy.cpp
index 7ebce67d17..c18fd4a75d 100644
--- a/libs/ui/tool/strokes/move_stroke_strategy.cpp
+++ b/libs/ui/tool/strokes/move_stroke_strategy.cpp
@@ -107,7 +107,7 @@ struct MoveTransformMaskStrategy : public MoveNodeStrategyBase
}
QRect moveNode(const QPoint &offset) override {
- QScopedPointer<KUndo2Command> cmd;
+ std::unique_ptr<KUndo2Command> cmd;
QRect dirtyRect = m_node->projectionPlane()->tightUserVisibleBounds();
KisTransformMask *mask = dynamic_cast<KisTransformMask*>(m_node.data());
@@ -137,7 +137,7 @@ struct MoveTransformMaskStrategy : public MoveNodeStrategyBase
void finishMove(KUndo2Command *parentCommand) override {
KisCommandUtils::CompositeCommand *cmd = new KisCommandUtils::CompositeCommand(parentCommand);
- cmd->addCommand(m_undoCommand.take());
+ cmd->addCommand(m_undoCommand.release());
}
QRect cancelMove() override {
@@ -146,7 +146,7 @@ struct MoveTransformMaskStrategy : public MoveNodeStrategyBase
private:
QPoint m_currentOffset;
- QScopedPointer<KUndo2Command> m_undoCommand;
+ std::unique_ptr<KUndo2Command> m_undoCommand;
};
struct MovePaintableNodeStrategy : public MoveNodeStrategyBase
diff --git a/libs/ui/widgets/KoStrokeConfigWidget.cpp b/libs/ui/widgets/KoStrokeConfigWidget.cpp
index 8b28d22f56..b7120a1c11 100644
--- a/libs/ui/widgets/KoStrokeConfigWidget.cpp
+++ b/libs/ui/widgets/KoStrokeConfigWidget.cpp
@@ -567,7 +567,7 @@ void KoStrokeConfigWidget::applyMarkerChanges(int rawPosition)
KoFlake::MarkerPosition position = KoFlake::MarkerPosition(rawPosition);
- QScopedPointer<KoMarker> marker;
+ std::unique_ptr<KoMarker> marker;
switch (position) {
case KoFlake::StartMarker:
@@ -587,7 +587,7 @@ void KoStrokeConfigWidget::applyMarkerChanges(int rawPosition)
break;
}
- KUndo2Command* command = new KoPathShapeMarkerCommand(pathShapes, marker.take(), position);
+ KUndo2Command* command = new KoPathShapeMarkerCommand(pathShapes, marker.release(), position);
d->canvas->addCommand(command);
Q_EMIT sigStrokeChanged();
diff --git a/plugins/dockers/animation/KisAnimCurvesModel.cpp b/plugins/dockers/animation/KisAnimCurvesModel.cpp
index c89f6b7073..8f67dc2129 100644
--- a/plugins/dockers/animation/KisAnimCurvesModel.cpp
+++ b/plugins/dockers/animation/KisAnimCurvesModel.cpp
@@ -310,7 +310,7 @@ void KisAnimCurvesModel::endCommand()
bool KisAnimCurvesModel::adjustKeyframes(const QModelIndexList &indexes, int timeOffset, qreal valueOffset)
{
- QScopedPointer<KUndo2Command> command(
+ std::unique_ptr<KUndo2Command> command(
new KUndo2Command(
kundo2_i18np("Adjust Keyframe",
"Adjust %1 Keyframes",
@@ -320,7 +320,7 @@ bool KisAnimCurvesModel::adjustKeyframes(const QModelIndexList &indexes, int tim
KisImageBarrierLock lock(image());
if (timeOffset != 0) {
- bool ok = createOffsetFramesCommand(indexes, QPoint(timeOffset, 0), false, false, command.data());
+ bool ok = createOffsetFramesCommand(indexes, QPoint(timeOffset, 0), false, false, command.get());
if (!ok) return false;
}
@@ -338,10 +338,10 @@ bool KisAnimCurvesModel::adjustKeyframes(const QModelIndexList &indexes, int tim
};
new KisCommandUtils::LambdaCommand(
- command.data(),
+ command.get(),
[frameItems, valueOffset] () -> KUndo2Command* {
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command());
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command());
bool result = false;
@@ -359,15 +359,15 @@ bool KisAnimCurvesModel::adjustKeyframes(const QModelIndexList &indexes, int tim
const qreal currentValue = scalarKeyframe->value();
//TODO Undo considerations.
- scalarKeyframe->setValue(currentValue + valueOffset, cmd.data());
+ scalarKeyframe->setValue(currentValue + valueOffset, cmd.get());
result = true;
}
- return result ? new KisCommandUtils::SkipFirstRedoWrapper(cmd.take()) : 0;
+ return result ? new KisCommandUtils::SkipFirstRedoWrapper(cmd.release()) : 0;
});
}
- KisProcessingApplicator::runSingleCommandStroke(image(), command.take(),
+ KisProcessingApplicator::runSingleCommandStroke(image(), command.release(),
KisStrokeJobData::BARRIER,
KisStrokeJobData::EXCLUSIVE);
diff --git a/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp b/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp
index d986240c79..a52d4fa4e2 100644
--- a/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp
+++ b/plugins/dockers/animation/KisAnimTimelineFramesModel.cpp
@@ -976,7 +976,7 @@ bool KisAnimTimelineFramesModel::insertHoldFrames(const QModelIndexList &selecte
{
if (selectedIndexes.isEmpty() || insertCount == 0) return true;
- QScopedPointer<KUndo2Command> parentCommand(new KUndo2Command(kundo2_i18np("Insert frame", "Insert %1 frames", insertCount)));
+ std::unique_ptr<KUndo2Command> parentCommand(new KUndo2Command(kundo2_i18np("Insert frame", "Insert %1 frames", insertCount)));
{
KisImageBarrierLock locker(m_d->image);
@@ -1074,7 +1074,7 @@ bool KisAnimTimelineFramesModel::insertHoldFrames(const QModelIndexList &selecte
QPoint(plannedFrameMove, 0),
false,
true,
- parentCommand.data());
+ parentCommand.get());
}
if (originalActiveKeyframe) {
@@ -1083,11 +1083,11 @@ bool KisAnimTimelineFramesModel::insertHoldFrames(const QModelIndexList &selecte
activeNode,
KisKeyframeChannel::Raster,
originalActiveKeyframe,
- parentCommand.data());
+ parentCommand.get());
}
}
- KisProcessingApplicator::runSingleCommandStroke(m_d->image, parentCommand.take(),
+ KisProcessingApplicator::runSingleCommandStroke(m_d->image, parentCommand.get(),
KisStrokeJobData::BARRIER,
KisStrokeJobData::EXCLUSIVE);
return true;
diff --git a/plugins/dockers/animation/KisAnimUtils.cpp b/plugins/dockers/animation/KisAnimUtils.cpp
index a6dcbe12b6..e2c49b2b0d 100644
--- a/plugins/dockers/animation/KisAnimUtils.cpp
+++ b/plugins/dockers/animation/KisAnimUtils.cpp
@@ -42,7 +42,7 @@ namespace KisAnimUtils {
[image, node, channelId, time, copy] () mutable -> KUndo2Command* {
bool success = false;
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command());
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command());
KisKeyframeChannel *channel = node->getKeyframeChannel(channelId);
quint8 originalOpacity = node->opacity();
@@ -62,7 +62,7 @@ namespace KisAnimUtils {
if ((copy || shouldPreserveCanvas) && channel->activeKeyframeAt(time)) {
if (!channel->keyframeAt(time)) {
- channel->copyKeyframe(channel->activeKeyframeTime(time), time, cmd.data());
+ channel->copyKeyframe(channel->activeKeyframeTime(time), time, cmd.get());
success = true;
}
} else {
@@ -76,7 +76,7 @@ namespace KisAnimUtils {
if (device) {
const QRect dirtyRect = device->extent();
- KisTransaction transaction(kundo2_i18n("Clear"), device, cmd.data());
+ KisTransaction transaction(kundo2_i18n("Clear"), device, cmd.get());
device->clear();
(void) transaction.endAndTake(); // saved as 'parent'
@@ -106,9 +106,9 @@ namespace KisAnimUtils {
if (isScalar && referenceKey) {
KisScalarKeyframeChannel* scalarChannel = static_cast<KisScalarKeyframeChannel*>(channel);
const qreal value = scalarChannel->valueAt(time); //Get interpolated value.
- scalarChannel->addScalarKeyframe(time, value, cmd.data());
+ scalarChannel->addScalarKeyframe(time, value, cmd.get());
} else {
- channel->addKeyframe(time, cmd.data());
+ channel->addKeyframe(time, cmd.get());
}
// Use color label of previous key, if exists...
@@ -125,7 +125,7 @@ namespace KisAnimUtils {
// maybe there is a better way to do this
node->setOpacity(originalOpacity);
- return success ? cmd.take() : nullptr;
+ return success ? cmd.release() : nullptr;
});
return cmd;
@@ -150,7 +150,7 @@ namespace KisAnimUtils {
[image, frames] () {
bool result = false;
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command());
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command());
Q_FOREACH (const FrameItem &item, frames) {
const int time = item.time;
@@ -164,12 +164,12 @@ namespace KisAnimUtils {
KisKeyframeSP keyframe = channel->keyframeAt(time);
if (!keyframe) continue;
- channel->removeKeyframe(time, cmd.data());
+ channel->removeKeyframe(time, cmd.get());
result = true;
}
- return result ? cmd.take() : 0;
+ return result ? cmd.release() : 0;
});
KisProcessingApplicator::runSingleCommandStroke(image, cmd,
@@ -329,7 +329,7 @@ namespace KisAnimUtils {
[srcDstPairs, copy, moveEmptyFrames] () -> KUndo2Command* {
bool result = false;
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command());
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command());
using MoveChain = QList<FrameItem>;
QHash<FrameItem, MoveChain> moveMap;
@@ -373,9 +373,9 @@ namespace KisAnimUtils {
FrameItem srcItem = *frameIt++;
if (!isCycle) {
- moveOneFrameItem(srcItem, dstItem, copy, moveEmptyFrames, cmd.data());
+ moveOneFrameItem(srcItem, dstItem, copy, moveEmptyFrames, cmd.get());
} else {
- swapOneFrameItem(srcItem, dstItem, cmd.data());
+ swapOneFrameItem(srcItem, dstItem, cmd.get());
}
dstItem = srcItem;
@@ -383,7 +383,7 @@ namespace KisAnimUtils {
}
}
- return result ? cmd.take() : nullptr;
+ return result ? cmd.release() : nullptr;
});
return cmd;
@@ -400,7 +400,7 @@ namespace KisAnimUtils {
[srcDstPairs, parentCommand]() -> KUndo2Command*
{
Q_UNUSED(parentCommand);
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command());
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command());
foreach (const FrameMovePair &move, srcDstPairs) {
KisRasterKeyframeChannel *srcRasterChan = dynamic_cast<KisRasterKeyframeChannel*>(move.first.node->getKeyframeChannel(move.first.channel));
@@ -411,13 +411,13 @@ namespace KisAnimUtils {
}
if (srcRasterChan == dstRasterChan) {
- srcRasterChan->cloneKeyframe(move.first.time, move.second.time, cmd.data());
+ srcRasterChan->cloneKeyframe(move.first.time, move.second.time, cmd.get());
} else {
- KisKeyframeChannel::copyKeyframe(srcRasterChan, move.first.time, dstRasterChan, move.second.time, cmd.data());
+ KisKeyframeChannel::copyKeyframe(srcRasterChan, move.first.time, dstRasterChan, move.second.time, cmd.get());
}
}
- return cmd.take();
+ return cmd.release();
});
}
@@ -426,7 +426,7 @@ namespace KisAnimUtils {
KUndo2Command* cmd = new KisCommandUtils::LambdaCommand(
kundo2_i18n("Make clones Unique"),
[frames]() {
- QScopedPointer<KUndo2Command> cmd(new KUndo2Command());
+ std::unique_ptr<KUndo2Command> cmd(new KUndo2Command());
foreach (const FrameItem &frameItem, frames) {
KisRasterKeyframeChannel *rasterChan = dynamic_cast<KisRasterKeyframeChannel*>(frameItem.node->getKeyframeChannel(frameItem.channel));
@@ -434,10 +434,10 @@ namespace KisAnimUtils {
continue;
}
- rasterChan->makeUnique(frameItem.time, cmd.data());
+ rasterChan->makeUnique(frameItem.time, cmd.get());
}
- return cmd.take();
+ return cmd.release();
});
KisProcessingApplicator::runSingleCommandStroke(image, cmd,
diff --git a/plugins/dockers/animation/KisTimeBasedItemModel.cpp b/plugins/dockers/animation/KisTimeBasedItemModel.cpp
index a59b497966..f44a331524 100644
--- a/plugins/dockers/animation/KisTimeBasedItemModel.cpp
+++ b/plugins/dockers/animation/KisTimeBasedItemModel.cpp
@@ -452,7 +452,7 @@ bool KisTimeBasedItemModel::removeFramesAndOffset(QModelIndexList indicesToRemov
bool KisTimeBasedItemModel::mirrorFrames(QModelIndexList indexes)
{
- QScopedPointer<KUndo2Command> parentCommand(new KUndo2Command(kundo2_i18n("Mirror Frames")));
+ std::unique_ptr<KUndo2Command> parentCommand(new KUndo2Command(kundo2_i18n("Mirror Frames")));
{
KisImageBarrierLock locker(m_d->image);
@@ -488,25 +488,25 @@ bool KisTimeBasedItemModel::mirrorFrames(QModelIndexList indexes)
channel->swapKeyframes(srcIt->column(),
dstIt->column(),
- parentCommand.data());
+ parentCommand.get());
}
else if (channel->keyframeAt(srcIt->column())) {
channel->insertKeyframe(dstIt->column(),
channel->keyframeAt(srcIt->column()),
- parentCommand.data());
+ parentCommand.get());
channel->removeKeyframe(srcIt->column(),
- parentCommand.data());
+ parentCommand.get());
}
else if (channel->keyframeAt(dstIt->column())) {
channel->insertKeyframe(srcIt->column(),
channel->keyframeAt(dstIt->column()),
- parentCommand.data());
+ parentCommand.get());
channel->removeKeyframe(dstIt->column(),
- parentCommand.data());
+ parentCommand.get());
}
}
@@ -517,7 +517,7 @@ bool KisTimeBasedItemModel::mirrorFrames(QModelIndexList indexes)
}
KisProcessingApplicator::runSingleCommandStroke(m_d->image,
- parentCommand.take(),
+ parentCommand.release(),
KisStrokeJobData::BARRIER,
KisStrokeJobData::EXCLUSIVE);
return true;
diff --git a/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.cpp b/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.cpp
index 00fab3c43c..c1e2f69fe7 100644
--- a/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.cpp
+++ b/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.cpp
@@ -34,8 +34,8 @@ void KisColorSmudgeInterstrokeData::beginTransaction()
KIS_SAFE_ASSERT_RECOVER_RETURN(!m_parentCommand);
m_parentCommand.reset(new KUndo2Command());
- m_heightmapDeviceTransaction.reset(new KisTransaction(heightmapDevice, m_parentCommand.data()));
- overlayDeviceWrapper.beginTransaction(m_parentCommand.data());
+ m_heightmapDeviceTransaction.reset(new KisTransaction(heightmapDevice, m_parentCommand.get()));
+ overlayDeviceWrapper.beginTransaction(m_parentCommand.get());
}
KUndo2Command *KisColorSmudgeInterstrokeData::endTransaction()
@@ -46,5 +46,5 @@ KUndo2Command *KisColorSmudgeInterstrokeData::endTransaction()
(void) m_heightmapDeviceTransaction->endAndTake();
(void) overlayDeviceWrapper.endTransaction();
- return m_parentCommand.take();
+ return m_parentCommand.release();
}
diff --git a/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.h b/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.h
index a5187c5cc8..adf74bffaf 100644
--- a/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.h
+++ b/plugins/paintops/colorsmudge/KisColorSmudgeInterstrokeData.h
@@ -35,7 +35,7 @@ struct KisColorSmudgeInterstrokeData : public KisInterstrokeData
KUndo2Command * endTransaction() override;
private:
- QScopedPointer<KUndo2Command> m_parentCommand;
+ std::unique_ptr<KUndo2Command> m_parentCommand;
QScopedPointer<KisTransaction> m_heightmapDeviceTransaction;
};
diff --git a/plugins/paintops/defaultpaintops/brush/KisBrushOpResources.cpp b/plugins/paintops/defaultpaintops/brush/KisBrushOpResources.cpp
index 5231e08fb6..94a0d1251c 100644
--- a/plugins/paintops/defaultpaintops/brush/KisBrushOpResources.cpp
+++ b/plugins/paintops/defaultpaintops/brush/KisBrushOpResources.cpp
@@ -73,7 +73,7 @@ KisBrushOpResources::~KisBrushOpResources()
void KisBrushOpResources::syncResourcesToSeqNo(int seqNo, const KisPaintInformation &info)
{
colorSource->selectColor(m_d->mixOption.apply(info), info);
- m_d->darkenOption.apply(colorSource.data(), info);
+ m_d->darkenOption.apply(colorSource.get(), info);
if (m_d->hsvTransformation) {
Q_FOREACH (KisHSVOption * option, m_d->hsvOptions) {
diff --git a/plugins/paintops/defaultpaintops/brush/KisDabRenderingQueueCache.cpp b/plugins/paintops/defaultpaintops/brush/KisDabRenderingQueueCache.cpp
index 3458d3cfa4..8a9b5d3afa 100644
--- a/plugins/paintops/defaultpaintops/brush/KisDabRenderingQueueCache.cpp
+++ b/plugins/paintops/defaultpaintops/brush/KisDabRenderingQueueCache.cpp
@@ -29,5 +29,5 @@ void KisDabRenderingQueueCache::getDabType(bool hasDabInCache, KisDabCacheUtils:
bool KisDabRenderingQueueCache::hasSeparateOriginal(KisDabCacheUtils::DabRenderingResources *resources) const
{
- return needSeparateOriginal(resources->textureOption.data(), resources->sharpnessOption.data());
+ return needSeparateOriginal(resources->textureOption.get(), resources->sharpnessOption.get());
}
diff --git a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
index 4505a9ee89..d164a3f7e2 100644
--- a/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
+++ b/plugins/paintops/defaultpaintops/duplicate/kis_duplicateop.cpp
@@ -203,13 +203,13 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
quint16 srcData[4];
quint16 tmpData[4];
- QScopedArrayPointer<qreal> matrix(new qreal[ 3 * healSW * healSH ]);
+ std::unique_ptr<qreal[]> matrix(new qreal[ 3 * healSW * healSH ]);
// First divide
const KoColorSpace* srcCs = realSourceDevice->colorSpace();
const KoColorSpace* tmpCs = m_srcdev->colorSpace();
KisHLineConstIteratorSP srcIt = realSourceDevice->createHLineConstIteratorNG(healRect.x(), healRect.y() , healSW);
KisHLineIteratorSP tmpIt = m_srcdev->createHLineIteratorNG(0, 0, healSW);
- qreal* matrixIt = matrix.data();
+ qreal* matrixIt = matrix.get();
for (int j = 0; j < healSH; j++) {
for (int i = 0; i < healSW; i++) {
srcCs->toLabA16(srcIt->oldRawData(), (quint8*)srcData, 1);
@@ -229,10 +229,10 @@ KisSpacingInformation KisDuplicateOp::paintAt(const KisPaintInformation& info)
{
int iter = 0;
qreal err;
- QScopedArrayPointer<qreal> solution(new qreal[ 3 * healSW * healSH ]);
+ std::unique_ptr<qreal[]> solution(new qreal[ 3 * healSW * healSH ]);
do {
- err = DuplicateOpUtils::minimizeEnergy(matrix.data(), solution.data(), healSW, healSH);
+ err = DuplicateOpUtils::minimizeEnergy(matrix.get(), solution.get(), healSW, healSH);
solution.swap(matrix);
diff --git a/plugins/paintops/libpaintop/KisDabCacheUtils.h b/plugins/paintops/libpaintop/KisDabCacheUtils.h
index 468d7b984e..a18aef81e6 100644
--- a/plugins/paintops/libpaintop/KisDabCacheUtils.h
+++ b/plugins/paintops/libpaintop/KisDabCacheUtils.h
@@ -39,10 +39,10 @@ struct PAINTOP_EXPORT DabRenderingResources
virtual void syncResourcesToSeqNo(int seqNo, const KisPaintInformation &info);
KisBrushSP brush;
- QScopedPointer<KisColorSource> colorSource;
+ std::unique_ptr<KisColorSource> colorSource;
- QScopedPointer<KisSharpnessOption> sharpnessOption;
- QScopedPointer<KisTextureOption> textureOption;
+ std::unique_ptr<KisSharpnessOption> sharpnessOption;
+ std::unique_ptr<KisTextureOption> textureOption;
KisPaintDeviceSP colorSourceDevice;
diff --git a/plugins/paintops/libpaintop/kis_dab_cache.cpp b/plugins/paintops/libpaintop/kis_dab_cache.cpp
index 6a32e465e6..ebf9537c63 100644
--- a/plugins/paintops/libpaintop/kis_dab_cache.cpp
+++ b/plugins/paintops/libpaintop/kis_dab_cache.cpp
@@ -143,9 +143,9 @@ struct TemporaryResourcesWithoutOwning : public KisDabCacheUtils::DabRenderingRe
~TemporaryResourcesWithoutOwning() override {
// we do not own these resources, so just
// release them before destruction
- colorSource.take();
- sharpnessOption.take();
- textureOption.take();
+ colorSource.release();
+ sharpnessOption.release();
+ textureOption.release();
}
};
diff --git a/plugins/paintops/libpaintop/kis_dab_cache_base.cpp b/plugins/paintops/libpaintop/kis_dab_cache_base.cpp
index d8dd5973d4..fad7fa086f 100644
--- a/plugins/paintops/libpaintop/kis_dab_cache_base.cpp
+++ b/plugins/paintops/libpaintop/kis_dab_cache_base.cpp
@@ -247,7 +247,7 @@ void KisDabCacheBase::fetchDabGenerationInfo(bool hasDabInCache,
request.shape,
request.info,
di->mirrorProperties,
- resources->sharpnessOption.data());
+ resources->sharpnessOption.get());
di->shape = KisDabShape(request.shape.scale(), request.shape.ratio(), position.realAngle);
di->dstDabRect = position.rect;
di->subPixel = position.subPixel;
@@ -255,7 +255,7 @@ void KisDabCacheBase::fetchDabGenerationInfo(bool hasDabInCache,
const bool supportsCaching = resources->brush->supportsCaching();
const KisUniformColorSource *uniformColorSource =
- resources->colorSource ? dynamic_cast<const KisUniformColorSource*>(resources->colorSource.data()) : 0;
+ resources->colorSource ? dynamic_cast<const KisUniformColorSource*>(resources->colorSource.get()) : 0;
di->solidColorFill = !resources->colorSource || uniformColorSource;
di->paintColor = uniformColorSource ?
@@ -283,6 +283,6 @@ void KisDabCacheBase::fetchDabGenerationInfo(bool hasDabInCache,
m_d->lastSavedDabParameters = newParams;
}
- di->needsPostprocessing = needSeparateOriginal(resources->textureOption.data(), resources->sharpnessOption.data());
+ di->needsPostprocessing = needSeparateOriginal(resources->textureOption.get(), resources->sharpnessOption.get());
}
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.cpp b/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.cpp
index e9891c8538..9a0e56c909 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.cpp
+++ b/plugins/tools/defaulttool/defaulttool/ShapeGradientEditStrategy.cpp
@@ -35,7 +35,7 @@ struct ShapeGradientEditStrategy::Private
QPointF initialOffset;
KoShapeGradientHandles gradientHandles;
KoShapeGradientHandles::Handle::Type handleType {KoShapeGradientHandles::Handle::Type::None};
- QScopedPointer<KUndo2Command> intermediateCommand;
+ std::unique_ptr<KUndo2Command> intermediateCommand;
};
@@ -79,7 +79,7 @@ void ShapeGradientEditStrategy::handleMouseMove(const QPointF &mouseLocation, Qt
KUndo2Command *ShapeGradientEditStrategy::createCommand()
{
return m_d->intermediateCommand ?
- new KisCommandUtils::SkipFirstRedoWrapper(m_d->intermediateCommand.take()) :
+ new KisCommandUtils::SkipFirstRedoWrapper(m_d->intermediateCommand.release()) :
nullptr;
}
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeMeshGradientEditStrategy.cpp b/plugins/tools/defaulttool/defaulttool/ShapeMeshGradientEditStrategy.cpp
index 751ba6ea3e..389bb757d2 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeMeshGradientEditStrategy.cpp
+++ b/plugins/tools/defaulttool/defaulttool/ShapeMeshGradientEditStrategy.cpp
@@ -22,7 +22,7 @@ struct ShapeMeshGradientEditStrategy::Private {
QPointF start;
KoShapeMeshGradientHandles::Handle startHandle;
KoShapeMeshGradientHandles handles;
- QScopedPointer<KUndo2Command> intermediateCommand;
+ std::unique_ptr<KUndo2Command> intermediateCommand;
};
ShapeMeshGradientEditStrategy::ShapeMeshGradientEditStrategy(KoToolBase *tool,
@@ -54,7 +54,7 @@ void ShapeMeshGradientEditStrategy::handleMouseMove(const QPointF &mouseLocation
KUndo2Command* ShapeMeshGradientEditStrategy::createCommand()
{
return m_d->intermediateCommand ?
- new KisCommandUtils::SkipFirstRedoWrapper(m_d->intermediateCommand.take()) :
+ new KisCommandUtils::SkipFirstRedoWrapper(m_d->intermediateCommand.release()) :
nullptr;
}
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp
index 2dc1f4d23b..7f6f3672f9 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp
+++ b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.cpp
@@ -215,7 +215,7 @@ KUndo2Command *ShapeResizeStrategy::createCommand()
m_executedCommand->setSkipOneRedo(true);
}
- return m_executedCommand.take();
+ return m_executedCommand.release();
}
void ShapeResizeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
diff --git a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h
index 51993bfb8f..dc3acb8f72 100644
--- a/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h
+++ b/plugins/tools/defaulttool/defaulttool/ShapeResizeStrategy.h
@@ -54,7 +54,7 @@ private:
QPointF m_globalStillPoint;
QPointF m_globalCenterPoint;
- QScopedPointer<KoShapeResizeCommand> m_executedCommand;
+ std::unique_ptr<KoShapeResizeCommand> m_executedCommand;
bool m_forceUniformScalingMode {false};
};
diff --git a/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp b/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp
index 7946373e0f..6cb2176283 100644
--- a/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp
+++ b/plugins/tools/tool_knife/CutThroughShapeStrategy.cpp
@@ -202,18 +202,18 @@ void CutThroughShapeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
KisAlgebra2D::cropLineToRect(leftLineLong, outlineRectBiggerInt, true, true);
KisAlgebra2D::cropLineToRect(rightLineLong, outlineRectBiggerInt, true, true);
- QScopedPointer<KUndo2Command> cmd = QScopedPointer<KUndo2Command>(new KUndo2Command(kundo2_i18n("Knife tool: cut through shapes")));
+ std::unique_ptr<KUndo2Command> cmd = std::unique_ptr<KUndo2Command>(new KUndo2Command(kundo2_i18n("Knife tool: cut through shapes")));
- new KoKeepShapesSelectedCommand(m_selectedShapes, {}, kisCanvas->selectedShapesProxy(), false, cmd.data());
+ new KoKeepShapesSelectedCommand(m_selectedShapes, {}, kisCanvas->selectedShapesProxy(), false, cmd.get());
if (leftLine.length() == 0 || rightLine.length() == 0) {
KIS_SAFE_ASSERT_RECOVER_RETURN(gapLine.length() != 0 && gapLines[0].length() != 0 && gapLines[1].length() != 0 && "Original gap lines shouldn't be empty at this point");
// looks like *all* shapes need to be cut out
- tool()->canvas()->shapeController()->removeShapes(m_allShapes, cmd.data());
- tool()->canvas()->addCommand(cmd.take());
+ tool()->canvas()->shapeController()->removeShapes(m_allShapes, cmd.get());
+ tool()->canvas()->addCommand(cmd.release());
return;
}
@@ -277,7 +277,7 @@ void CutThroughShapeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
// this is needed because Qt linearize curves; this allows for a
// "sane" linearization instead of a very blocky appearance
path = booleanWorkaroundTransformInverted.map(path);
- QScopedPointer<KoPathShape> shape = QScopedPointer<KoPathShape>(KoPathShape::createShapeFromPainterPath(path));
+ std::unique_ptr<KoPathShape> shape = std::unique_ptr<KoPathShape>(KoPathShape::createShapeFromPainterPath(path));
shape->closeMerge();
if (shape->boundingRect().isEmpty()) {
@@ -291,10 +291,10 @@ void CutThroughShapeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
KoShapeContainer *parent = referenceShape->parent();
if (wasSelected) {
- newSelectedShapes << shape.data();
+ newSelectedShapes << shape.get();
}
- tool()->canvas()->shapeController()->addShapeDirect(shape.take(), parent, cmd.data());
+ tool()->canvas()->shapeController()->addShapeDirect(shape.release(), parent, cmd.get());
}
@@ -305,9 +305,9 @@ void CutThroughShapeStrategy::finishInteraction(Qt::KeyboardModifiers modifiers)
}
if (affectedShapes > 0) {
- tool()->canvas()->shapeController()->removeShapes(shapesToRemove, cmd.data());
- new KoKeepShapesSelectedCommand({}, newSelectedShapes, tool()->canvas()->selectedShapesProxy(), true, cmd.data());
- tool()->canvas()->addCommand(cmd.take());
+ tool()->canvas()->shapeController()->removeShapes(shapesToRemove, cmd.get());
+ new KoKeepShapesSelectedCommand({}, newSelectedShapes, tool()->canvas()->selectedShapesProxy(), true, cmd.get());
+ tool()->canvas()->addCommand(cmd.release());
}
diff --git a/plugins/tools/tool_transform2/tool_transform_args.cc b/plugins/tools/tool_transform2/tool_transform_args.cc
index 1f58251812..49e7727762 100644
--- a/plugins/tools/tool_transform2/tool_transform_args.cc
+++ b/plugins/tools/tool_transform2/tool_transform_args.cc
@@ -565,7 +565,7 @@ void ToolTransformArgs::saveContinuedState()
void ToolTransformArgs::restoreContinuedState()
{
- QScopedPointer<ToolTransformArgs> tempTransformation(
+ std::unique_ptr<ToolTransformArgs> tempTransformation(
new ToolTransformArgs(*m_continuedTransformation));
*this = *tempTransformation;
@@ -574,7 +574,7 @@ void ToolTransformArgs::restoreContinuedState()
const ToolTransformArgs* ToolTransformArgs::continuedTransform() const
{
- return m_continuedTransformation.data();
+ return m_continuedTransformation.get();
}
const KisBezierTransformMesh *ToolTransformArgs::meshTransform() const
diff --git a/plugins/tools/tool_transform2/tool_transform_args.h b/plugins/tools/tool_transform2/tool_transform_args.h
index ac9f39807c..3225d90dba 100644
--- a/plugins/tools/tool_transform2/tool_transform_args.h
+++ b/plugins/tools/tool_transform2/tool_transform_args.h
@@ -380,7 +380,7 @@ private:
* stores the initial step of our transform. All cancel and revert
* operations should revert to it.
*/
- QScopedPointer<ToolTransformArgs> m_continuedTransformation;
+ std::unique_ptr<ToolTransformArgs> m_continuedTransformation;
//PixelPrecision should always be in powers of 2
int m_pixelPrecision {8};