Skip to content

Commit 88e5937

Browse files
committed
TemplateTrack: Clear warnings
1 parent 5ee7353 commit 88e5937

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

src/templates/template_track.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2012, 2013 Thomas Schöps
3-
* Copyright 2013-2019 Kai Pastor
3+
* Copyright 2013-2020 Kai Pastor
44
*
55
* This file is part of OpenOrienteering.
66
*
@@ -145,7 +145,7 @@ bool TemplateTrack::loadTypeSpecificTemplateConfiguration(QXmlStreamReader& xml)
145145
else if (xml.name() == QLatin1String("georeferencing"))
146146
{
147147
// Preserve explicit georeferencing from OgrTemplate.
148-
preserved_georef.reset(new Georeferencing());
148+
preserved_georef = std::make_unique<Georeferencing>();
149149
preserved_georef->load(xml, false);
150150
}
151151
else
@@ -329,8 +329,8 @@ void TemplateTrack::drawWaypoints(QPainter* painter) const
329329
{
330330
painter->setPen(qRgb(255, 0, 0));
331331
int width = painter->fontMetrics().width(point_name);
332-
painter->drawText(QRect(point.map_coord.x() - 0.5*width,
333-
point.map_coord.y() - height,
332+
painter->drawText(QRect(qRound(point.map_coord.x() - 0.5*width),
333+
qRound(point.map_coord.y() - height),
334334
width,
335335
height),
336336
Qt::AlignCenter,
@@ -389,7 +389,7 @@ bool TemplateTrack::hasAlpha() const
389389

390390
PathObject* TemplateTrack::importPathStart()
391391
{
392-
PathObject* path = new PathObject();
392+
auto* path = new PathObject();
393393
path->setSymbol(map->getUndefinedLine(), true);
394394
return path;
395395
}
@@ -402,7 +402,7 @@ void TemplateTrack::importPathEnd(PathObject* path)
402402

403403
PointObject* TemplateTrack::importWaypoint(const MapCoordF& position, const QString& name)
404404
{
405-
PointObject* point = new PointObject(map->getUndefinedPoint());
405+
auto* point = new PointObject(map->getUndefinedPoint());
406406
point->setPosition(position);
407407
point->setTag(QStringLiteral("name"), name);
408408
map->addObject(point);
@@ -418,7 +418,7 @@ bool TemplateTrack::import(QWidget* dialog_parent)
418418
return false;
419419
}
420420

421-
DeleteObjectsUndoStep* undo_step = new DeleteObjectsUndoStep(map);
421+
auto* undo_step = new DeleteObjectsUndoStep(map);
422422
MapPart* part = map->getCurrentPart();
423423
std::vector< Object* > result;
424424
// clazy:excludeall=reserve-candidates

src/templates/template_track.h

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright 2012-2014 Thomas Schöps
3-
* Copyright 2013-2019 Kai Pastor
3+
* Copyright 2013-2020 Kai Pastor
44
*
55
* This file is part of OpenOrienteering.
66
*
@@ -63,7 +63,13 @@ Q_OBJECT
6363
protected:
6464
TemplateTrack(const TemplateTrack& proto);
6565
public:
66-
~TemplateTrack() override;
66+
TemplateTrack() = delete;
67+
TemplateTrack(TemplateTrack&&) = delete;
68+
69+
~TemplateTrack() override;
70+
71+
TemplateTrack& operator=(const TemplateTrack&) = delete;
72+
TemplateTrack& operator=(TemplateTrack&&) = delete;
6773

6874
TemplateTrack* duplicate() const override;
6975

@@ -76,10 +82,10 @@ Q_OBJECT
7682
bool postLoadConfiguration(QWidget* dialog_parent, bool& out_center_in_view) override;
7783
void unloadTemplateFileImpl() override;
7884

79-
void drawTemplate(QPainter* painter, const QRectF& clip_rect, double scale, bool on_screen, qreal opacity) const override;
85+
void drawTemplate(QPainter* painter, const QRectF& clip_rect, double scale, bool on_screen, qreal opacity) const override;
8086
QRectF getTemplateExtent() const override;
81-
QRectF calculateTemplateBoundingBox() const override;
82-
int getTemplateBoundingBoxPixelBorder() override;
87+
QRectF calculateTemplateBoundingBox() const override;
88+
int getTemplateBoundingBoxPixelBorder() override;
8389

8490
bool hasAlpha() const override;
8591

@@ -104,8 +110,8 @@ public slots:
104110
void updateGeoreferencing();
105111

106112
protected:
107-
void saveTypeSpecificTemplateConfiguration(QXmlStreamWriter& xml) const override;
108-
bool loadTypeSpecificTemplateConfiguration(QXmlStreamReader& xml) override;
113+
void saveTypeSpecificTemplateConfiguration(QXmlStreamWriter& xml) const override;
114+
bool loadTypeSpecificTemplateConfiguration(QXmlStreamReader& xml) override;
109115

110116
/// Projects the track in non-georeferenced mode
111117
QString calculateLocalGeoreferencing() const;
@@ -116,7 +122,7 @@ public slots:
116122
void importPathEnd(PathObject* path);
117123
PointObject* importWaypoint(const MapCoordF& position, const QString &name = QString());
118124

119-
125+
private:
120126
Track track;
121127
QString track_crs_spec;
122128
QString projected_crs_spec;

0 commit comments

Comments
 (0)