Commit f3aab8b0 authored by Frederik Gladhorn's avatar Frederik Gladhorn

Add override keyword to virtuals

This makes refactoring easier since the compiler detects renames.
parent 2aaa11b1
......@@ -49,7 +49,7 @@ public:
}
///Reimplemented
virtual bool importResourceFile(const QString& filename, bool fileCreation = true) {
bool importResourceFile(const QString& filename, bool fileCreation = true) override {
QFileInfo fi(filename);
if (fi.exists() == false)
return false;
......@@ -77,7 +77,7 @@ public:
private:
///Reimplemented
virtual QList<KisBrushSP> createResources(const QString & filename) {
QList<KisBrushSP> createResources(const QString & filename) override {
QList<KisBrushSP> brushes;
QString fileExtension = QFileInfo(filename).suffix().toLower();
......@@ -97,7 +97,7 @@ private:
}
///Reimplemented
virtual KisBrushSP createResource(const QString & filename) {
KisBrushSP createResource(const QString & filename) override {
QString fileExtension = QFileInfo(filename).suffix().toLower();
......
......@@ -102,7 +102,7 @@ protected:
return index;
}
int chooseNextBrush(const KisPaintInformation& info) {
int chooseNextBrush(const KisPaintInformation& info) override {
quint32 brushIndex = 0;
if (!m_isInitialized) {
......@@ -128,7 +128,7 @@ protected:
return brushIndex;
}
void updateBrushIndexes(const KisPaintInformation& info) {
void updateBrushIndexes(const KisPaintInformation& info) override {
for (int i = 0; i < m_parasite.dim; i++) {
m_parasite.index[i] = selectPost(m_parasite.selection[i],
m_parasite.index[i],
......@@ -169,7 +169,7 @@ public:
return true;
}
void notifyStrokeStarted() {
void notifyStrokeStarted() override {
m_isInitialized = false;
}
......
......@@ -106,7 +106,7 @@ public:
return renderedChar;
}
void clear() {
void clear() override {
m_brushesMap.clear();
KisBrushesPipe<KisGbrBrush>::clear();
}
......@@ -117,18 +117,18 @@ public:
return m_brushesMap.value(m_text.at(0));
}
void notifyStrokeStarted() {
void notifyStrokeStarted() override {
m_charIndex = 0;
updateBrushIndexesImpl();
}
protected:
int chooseNextBrush(const KisPaintInformation& info) {
int chooseNextBrush(const KisPaintInformation& info) override {
Q_UNUSED(info);
return m_currentBrushIndex;
}
void updateBrushIndexes(const KisPaintInformation& info) {
void updateBrushIndexes(const KisPaintInformation& info) override {
Q_UNUSED(info);
m_charIndex++;
......
......@@ -41,7 +41,7 @@ class KoOdfGradientBackgroundPrivate : public KoShapeBackgroundPrivate
public:
KoOdfGradientBackgroundPrivate()
: style(), cx(0), cy(0), startColor(), endColor(), angle(0), border(0), opacity(1.0) {};
~KoOdfGradientBackgroundPrivate(){};
~KoOdfGradientBackgroundPrivate() override{};
//data
QString style;
int cx;
......
......@@ -50,7 +50,7 @@ public:
{
}
~KoPatternBackgroundPrivate() {
~KoPatternBackgroundPrivate() override {
delete imageData;
}
......
......@@ -40,21 +40,21 @@ class ShapeGroupContainerModel : public SimpleShapeContainerModel
{
public:
ShapeGroupContainerModel(KoShapeGroup *group) : m_group(group) {}
~ShapeGroupContainerModel() {}
~ShapeGroupContainerModel() override {}
virtual void add(KoShape *child)
void add(KoShape *child) override
{
SimpleShapeContainerModel::add(child);
m_group->invalidateSizeCache();
}
virtual void remove(KoShape *child)
void remove(KoShape *child) override
{
SimpleShapeContainerModel::remove(child);
m_group->invalidateSizeCache();
}
virtual void childChanged(KoShape *shape, KoShape::ChangeType type)
void childChanged(KoShape *shape, KoShape::ChangeType type) override
{
SimpleShapeContainerModel::childChanged(shape, type);
//debugFlake << type;
......@@ -87,7 +87,7 @@ public:
model = new ShapeGroupContainerModel(q);
}
~KoShapeGroupPrivate()
~KoShapeGroupPrivate() override
{
}
......
......@@ -41,7 +41,7 @@ public:
: controller(c), executed(false) {
}
~Private() {
~Private() override {
if (executed) {
qDeleteAll(oldClipPaths);
} else {
......@@ -82,7 +82,7 @@ public:
}
/// reimplemented from KoOdfPaste
virtual bool process(const KoXmlElement &body, KoOdfReadStore &odfStore) {
bool process(const KoXmlElement &body, KoOdfReadStore &odfStore) override {
KoOdfLoadingContext loadingContext(odfStore.styles(), odfStore.store());
KoShapeLoadingContext context(loadingContext, controller->resourceManager());
......
......@@ -43,63 +43,63 @@ public:
{
}
~SimpleCanvas()
~SimpleCanvas() override
{
delete m_shapeManager;
}
virtual void gridSize(QPointF *offset, QSizeF *spacing) const
void gridSize(QPointF *offset, QSizeF *spacing) const override
{
*offset = QPointF();
*spacing = QSizeF();
};
virtual bool snapToGrid() const
bool snapToGrid() const override
{
return false;
}
virtual void addCommand(KUndo2Command *)
void addCommand(KUndo2Command *) override
{
}
virtual KoShapeManager *shapeManager() const
KoShapeManager *shapeManager() const override
{
return m_shapeManager;
}
virtual void updateCanvas(const QRectF&)
void updateCanvas(const QRectF&) override
{
}
virtual KoToolProxy *toolProxy() const
KoToolProxy *toolProxy() const override
{
return 0;
}
virtual KoViewConverter *viewConverter() const
KoViewConverter *viewConverter() const override
{
return 0;
}
virtual QWidget *canvasWidget()
QWidget *canvasWidget() override
{
return 0;
}
virtual const QWidget *canvasWidget() const
const QWidget *canvasWidget() const override
{
return 0;
}
virtual KoUnit unit() const
KoUnit unit() const override
{
return KoUnit(KoUnit::Point);
}
virtual void updateInputMethodInfo() {}
void updateInputMethodInfo() override {}
void setCursor(const QCursor &) {}
void setCursor(const QCursor &) override {}
private:
KoShapeManager *m_shapeManager;
......
......@@ -51,12 +51,12 @@ public:
class UniversalSelector : public CssSelectorBase
{
public:
virtual bool match(const KoXmlElement &)
bool match(const KoXmlElement &) override
{
// matches always
return true;
}
virtual QString toString() const
QString toString() const override
{
return "*";
}
......@@ -70,15 +70,15 @@ public:
: m_type(type)
{
}
virtual bool match(const KoXmlElement &e)
bool match(const KoXmlElement &e) override
{
return e.tagName() == m_type;
}
virtual QString toString() const
QString toString() const override
{
return m_type;
}
virtual int priority()
int priority() override
{
return 1;
}
......@@ -97,15 +97,15 @@ public:
if (id.startsWith('#'))
m_id = id.mid(1);
}
virtual bool match(const KoXmlElement &e)
bool match(const KoXmlElement &e) override
{
return e.attribute("id") == m_id;
}
virtual QString toString() const
QString toString() const override
{
return '#'+m_id;
}
virtual int priority()
int priority() override
{
return 100;
}
......@@ -148,7 +148,7 @@ public:
}
}
virtual bool match(const KoXmlElement &e)
bool match(const KoXmlElement &e) override
{
switch(m_type) {
case Exists:
......@@ -170,7 +170,7 @@ public:
return false;
}
}
virtual QString toString() const
QString toString() const override
{
QString str('[');
str += m_attribute;
......@@ -185,7 +185,7 @@ public:
str += ']';
return str;
}
virtual int priority()
int priority() override
{
return 10;
}
......@@ -212,7 +212,7 @@ public:
{
}
virtual bool match(const KoXmlElement &e)
bool match(const KoXmlElement &e) override
{
if (m_pseudoClass == ":first-child") {
KoXmlNode parent = e.parentNode();
......@@ -228,11 +228,11 @@ public:
return false;
}
}
virtual QString toString() const
QString toString() const override
{
return m_pseudoClass;
}
virtual int priority()
int priority() override
{
return 10;
}
......@@ -250,12 +250,12 @@ public:
{
compile();
}
virtual ~CssSimpleSelector()
~CssSimpleSelector() override
{
qDeleteAll(m_selectors);
}
virtual bool match(const KoXmlElement &e)
bool match(const KoXmlElement &e) override
{
Q_FOREACH (CssSelectorBase *s, m_selectors) {
if (!s->match(e))
......@@ -265,7 +265,7 @@ public:
return true;
}
QString toString() const
QString toString() const override
{
QString str;
Q_FOREACH (CssSelectorBase *s, m_selectors) {
......@@ -273,7 +273,7 @@ public:
}
return str;
}
virtual int priority()
int priority() override
{
int p = 0;
Q_FOREACH (CssSelectorBase *s, m_selectors) {
......@@ -386,11 +386,11 @@ public:
{
compile(tokens);
}
virtual ~CssComplexSelector()
~CssComplexSelector() override
{
qDeleteAll(m_selectors);
}
QString toString() const
QString toString() const override
{
QString str;
int selectorCount = m_selectors.count();
......@@ -404,7 +404,7 @@ public:
return str;
}
virtual bool match(const KoXmlElement &e)
bool match(const KoXmlElement &e) override
{
int selectorCount = m_selectors.count();
int combinatorCount = m_combinators.length();
......@@ -469,7 +469,7 @@ public:
}
return true;
}
virtual int priority()
int priority() override
{
int p = 0;
Q_FOREACH (CssSelectorBase *s, m_selectors) {
......
......@@ -58,11 +58,11 @@ struct DerivedResource : public KoDerivedResourceConverter
{
DerivedResource(int key, int sourceKey) : KoDerivedResourceConverter(key, sourceKey) {}
QVariant fromSource(const QVariant &value) {
QVariant fromSource(const QVariant &value) override {
return value.toInt() + 10;
}
QVariant toSource(const QVariant &value, const QVariant &sourceValue) {
QVariant toSource(const QVariant &value, const QVariant &sourceValue) override {
Q_UNUSED(sourceValue);
return value.toInt() - 10;
}
......@@ -164,14 +164,14 @@ struct ComplexConverter : public KoDerivedResourceConverter
{
ComplexConverter(int key, int sourceKey) : KoDerivedResourceConverter(key, sourceKey) {}
QVariant fromSource(const QVariant &value) {
QVariant fromSource(const QVariant &value) override {
KIS_ASSERT(value.canConvert<ComplexResourceSP>());
ComplexResourceSP res = value.value<ComplexResourceSP>();
return res->m_resources[key()];
}
QVariant toSource(const QVariant &value, const QVariant &sourceValue) {
QVariant toSource(const QVariant &value, const QVariant &sourceValue) override {
KIS_ASSERT(sourceValue.canConvert<ComplexResourceSP>());
ComplexResourceSP res = sourceValue.value<ComplexResourceSP>();
......@@ -184,7 +184,7 @@ struct ComplexMediator : public KoResourceUpdateMediator
{
ComplexMediator(int key) : KoResourceUpdateMediator(key) {}
void connectResource(QVariant sourceResource) {
void connectResource(QVariant sourceResource) override {
m_res = sourceResource;
}
......
......@@ -138,7 +138,7 @@ void TestShapePainting::testPaintOrder()
class OrderedMockShape : public MockShape {
public:
OrderedMockShape(QList<MockShape*> &list) : order(list) {}
void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) {
void paint(QPainter &painter, const KoViewConverter &converter, KoShapePaintingContext &paintcontext) override {
order.append(this);
MockShape::paint(painter, converter, paintcontext);
}
......
......@@ -59,19 +59,19 @@ void KisImageSetResolutionCommand::redo()
class ResetShapesProcessingVisitor : public KisProcessingVisitor
{
public:
void visit(KisNode*, KisUndoAdapter*) {}
void visit(KisPaintLayer*, KisUndoAdapter*) {}
void visit(KisGroupLayer*, KisUndoAdapter*) {}
void visit(KisCloneLayer*, KisUndoAdapter*) {}
void visit(KisAdjustmentLayer *layer, KisUndoAdapter*) { layer->internalSelection()->updateProjection(); }
void visit(KisGeneratorLayer *layer, KisUndoAdapter*) { layer->internalSelection()->updateProjection(); }
void visit(KisExternalLayer *layer, KisUndoAdapter*) { layer->resetCache(); }
void visit(KisFilterMask *mask, KisUndoAdapter*) { mask->selection()->updateProjection(); }
void visit(KisTransformMask *mask, KisUndoAdapter*) { KIS_ASSERT_RECOVER_NOOP(!mask->selection()); }
void visit(KisTransparencyMask *mask, KisUndoAdapter*) { mask->selection()->updateProjection(); }
void visit(KisSelectionMask *mask, KisUndoAdapter*) { mask->selection()->updateProjection(); }
void visit(KisColorizeMask *, KisUndoAdapter*) {}
void visit(KisNode*, KisUndoAdapter*) override {}
void visit(KisPaintLayer*, KisUndoAdapter*) override {}
void visit(KisGroupLayer*, KisUndoAdapter*) override {}
void visit(KisCloneLayer*, KisUndoAdapter*) override {}
void visit(KisAdjustmentLayer *layer, KisUndoAdapter*) override { layer->internalSelection()->updateProjection(); }
void visit(KisGeneratorLayer *layer, KisUndoAdapter*) override { layer->internalSelection()->updateProjection(); }
void visit(KisExternalLayer *layer, KisUndoAdapter*) override { layer->resetCache(); }
void visit(KisFilterMask *mask, KisUndoAdapter*) override { mask->selection()->updateProjection(); }
void visit(KisTransformMask *mask, KisUndoAdapter*) override { KIS_ASSERT_RECOVER_NOOP(!mask->selection()); }
void visit(KisTransparencyMask *mask, KisUndoAdapter*) override { mask->selection()->updateProjection(); }
void visit(KisSelectionMask *mask, KisUndoAdapter*) override { mask->selection()->updateProjection(); }
void visit(KisColorizeMask *, KisUndoAdapter*) override {}
};
......
......@@ -68,13 +68,13 @@ public:
{
}
~KisUpdateOriginalVisitor() {
~KisUpdateOriginalVisitor() override {
}
public:
using KisNodeVisitor::visit;
bool visit(KisAdjustmentLayer* layer) {
bool visit(KisAdjustmentLayer* layer) override {
if (!layer->visible()) return true;
if (!m_projection) {
......@@ -132,23 +132,23 @@ public:
return true;
}
bool visit(KisExternalLayer*) {
bool visit(KisExternalLayer*) override {
return true;
}
bool visit(KisGeneratorLayer*) {
bool visit(KisGeneratorLayer*) override {
return true;
}
bool visit(KisPaintLayer*) {
bool visit(KisPaintLayer*) override {
return true;
}
bool visit(KisGroupLayer*) {
bool visit(KisGroupLayer*) override {
return true;
}
bool visit(KisCloneLayer *layer) {
bool visit(KisCloneLayer *layer) override {
QRect emptyRect;
KisRefreshSubtreeWalker walker(emptyRect);
KisAsyncMerger merger;
......@@ -177,22 +177,22 @@ public:
return true;
}
bool visit(KisNode*) {
bool visit(KisNode*) override {
return true;
}
bool visit(KisFilterMask*) {
bool visit(KisFilterMask*) override {
return true;
}
bool visit(KisTransformMask*) {
bool visit(KisTransformMask*) override {
return true;
}
bool visit(KisTransparencyMask*) {
bool visit(KisTransparencyMask*) override {
return true;
}
bool visit(KisSelectionMask*) {
bool visit(KisSelectionMask*) override {
return true;
}
bool visit(KisColorizeMask*) {
bool visit(KisColorizeMask*) override {
return true;
}
......
......@@ -30,11 +30,11 @@ class KisBaseProcessorConfigurationFactory : public KisSerializableConfiguration
{
public:
KisBaseProcessorConfigurationFactory(KisBaseProcessor* _generator) : m_generator(_generator) {}
virtual ~KisBaseProcessorConfigurationFactory() {}
virtual KisSerializableConfigurationSP createDefault() {
~KisBaseProcessorConfigurationFactory() override {}
KisSerializableConfigurationSP createDefault() override {
return m_generator->factoryConfiguration(0);
}
virtual KisSerializableConfigurationSP create(const QDomElement& e) {
KisSerializableConfigurationSP create(const QDomElement& e) override {
KisSerializableConfigurationSP config = m_generator->factoryConfiguration(0);
config->fromXML(e);
return config;
......
......@@ -59,9 +59,9 @@ public:
}
}
virtual ~CachedGradient() {}
~CachedGradient() override {}
KoAbstractGradient* clone() const {
KoAbstractGradient* clone() const override {
return new CachedGradient(m_subject, m_max + 1, m_colorSpace);
}
......@@ -69,7 +69,7 @@ public:
* Creates a QGradient from the gradient.
* The resulting QGradient might differ from original gradient
*/
virtual QGradient* toQGradient() const
QGradient* toQGradient() const override
{
return m_subject->toQGradient();
}
......@@ -90,7 +90,7 @@ public:
void setColorSpace(KoColorSpace* colorSpace) { m_colorSpace = colorSpace; }
const KoColorSpace * colorSpace() const { return m_colorSpace; }
virtual QByteArray generateMD5() const { return QByteArray(); }
QByteArray generateMD5() const override { return QByteArray(); }
private:
const KoAbstractGradient *m_subject;
......@@ -109,7 +109,7 @@ class LinearGradientStrategy : public KisGradientShapeStrategy
public:
LinearGradientStrategy(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd);
virtual double valueAt(double x, double y) const;
double valueAt(double x, double y) const override;
protected:
double m_normalisedVectorX;
......@@ -159,7 +159,7 @@ class BiLinearGradientStrategy : public LinearGradientStrategy
public:
BiLinearGradientStrategy(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd);
virtual double valueAt(double x, double y) const;
double valueAt(double x, double y) const override;
};
BiLinearGradientStrategy::BiLinearGradientStrategy(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd)
......@@ -186,7 +186,7 @@ class RadialGradientStrategy : public KisGradientShapeStrategy
public:
RadialGradientStrategy(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd);
virtual double valueAt(double x, double y) const;
double valueAt(double x, double y) const override;
protected:
double m_radius;
......@@ -226,7 +226,7 @@ class SquareGradientStrategy : public KisGradientShapeStrategy
public:
SquareGradientStrategy(const QPointF& gradientVectorStart, const QPointF& gradientVectorEnd);
virtual double valueAt(double x, double y) const;
double valueAt(double x, double y) const override;
protected:
double m_normalisedVectorX;
......@@ -286,7 +286,7 @@ class ConicalGradientStrategy : public KisGradientShapeStrategy