From 0b4ee95591e491657061561e8d5946742c475a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Wed, 25 Nov 2015 23:58:46 +0100 Subject: [PATCH] Code cleanup --- src/axisitem.cpp | 2 -- src/colorshop.cpp | 2 +- src/downloader.cpp | 3 --- src/elevationgraph.cpp | 1 + src/filebrowser.cpp | 2 -- src/gpx.cpp | 3 --- src/graph.cpp | 3 --- src/gui.cpp | 2 -- src/map.cpp | 2 -- src/maplist.cpp | 1 - src/markeritem.cpp | 1 + src/parser.cpp | 2 -- src/poi.cpp | 11 ++++++----- src/poiitem.cpp | 2 -- src/slideritem.cpp | 1 - src/speedgraph.cpp | 2 -- src/track.cpp | 4 ---- 17 files changed, 9 insertions(+), 35 deletions(-) diff --git a/src/axisitem.cpp b/src/axisitem.cpp index 42b1ef2b..25270b32 100644 --- a/src/axisitem.cpp +++ b/src/axisitem.cpp @@ -3,14 +3,12 @@ #include "config.h" #include "axisitem.h" -#include #define TICK 6 #define PADDING 6 #define XTICKS 15 #define YTICKS 10 - struct Label { double min; double max; diff --git a/src/colorshop.cpp b/src/colorshop.cpp index f5143dbd..5592ef6e 100644 --- a/src/colorshop.cpp +++ b/src/colorshop.cpp @@ -1,11 +1,11 @@ #include "colorshop.h" + #define HUE_INIT 0.1f #define HUE_INCREMENT 0.62f #define SATURATION 0.99f #define VALUE 0.99f - static unsigned hsv2rgb(float h, float s, float v) { unsigned hi; diff --git a/src/downloader.cpp b/src/downloader.cpp index 44c63b08..7a8372c6 100644 --- a/src/downloader.cpp +++ b/src/downloader.cpp @@ -3,8 +3,6 @@ #include "config.h" #include "downloader.h" -#include - #if defined(Q_OS_LINUX) #define PLATFORM_STR "Linux" @@ -18,7 +16,6 @@ #define USER_AGENT APP_NAME"/"APP_VERSION" ("PLATFORM_STR"; Qt "QT_VERSION_STR")" - Downloader::Downloader() { connect(&manager, SIGNAL(finished(QNetworkReply*)), diff --git a/src/elevationgraph.cpp b/src/elevationgraph.cpp index be0d7655..136ee379 100644 --- a/src/elevationgraph.cpp +++ b/src/elevationgraph.cpp @@ -2,6 +2,7 @@ #include "config.h" #include "elevationgraph.h" + ElevationGraph::ElevationGraph(QWidget *parent) : Graph(parent) { _ascent = 0; diff --git a/src/filebrowser.cpp b/src/filebrowser.cpp index 66363b12..f04b5f55 100644 --- a/src/filebrowser.cpp +++ b/src/filebrowser.cpp @@ -2,8 +2,6 @@ #include #include "filebrowser.h" -#include - FileBrowser::FileBrowser(QObject *parent) : QObject(parent) { diff --git a/src/gpx.cpp b/src/gpx.cpp index 7b43f471..40ce84b8 100644 --- a/src/gpx.cpp +++ b/src/gpx.cpp @@ -3,14 +3,11 @@ #include "ll.h" #include "gpx.h" -#include - #define WINDOW_EF 3 #define WINDOW_SE 11 #define WINDOW_SF 11 - static bool lt(const QPointF &p1, const QPointF &p2) { return p1.y() < p2.y(); diff --git a/src/graph.cpp b/src/graph.cpp index c32cad83..83cf6ab8 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -9,12 +9,9 @@ #include "config.h" #include "graph.h" -#include - #define MARGIN 10.0 - void Scene::mousePressEvent(QGraphicsSceneMouseEvent *e) { if (e->button() == Qt::LeftButton) diff --git a/src/gui.cpp b/src/gui.cpp index 84e04bea..0cc6f493 100644 --- a/src/gui.cpp +++ b/src/gui.cpp @@ -21,8 +21,6 @@ #include "filebrowser.h" #include "gui.h" -#include - static QString timeSpan(qreal time) { diff --git a/src/map.cpp b/src/map.cpp index b27251c8..1c7c4dd7 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -4,8 +4,6 @@ #include "ll.h" #include "map.h" -#include - Map::Map(const QString &name, const QString &url) { diff --git a/src/maplist.cpp b/src/maplist.cpp index 10d6d279..6edcd33e 100644 --- a/src/maplist.cpp +++ b/src/maplist.cpp @@ -1,7 +1,6 @@ #include #include "maplist.h" -#include QList MapList::load(const QString &fileName) { diff --git a/src/markeritem.cpp b/src/markeritem.cpp index df39746f..a1cedce9 100644 --- a/src/markeritem.cpp +++ b/src/markeritem.cpp @@ -1,6 +1,7 @@ #include #include "markeritem.h" + #define SIZE 8 MarkerItem::MarkerItem(QGraphicsItem *parent) : QGraphicsItem(parent) diff --git a/src/parser.cpp b/src/parser.cpp index a9bb4c4f..1ac6bdd1 100644 --- a/src/parser.cpp +++ b/src/parser.cpp @@ -1,7 +1,5 @@ #include "parser.h" -#include - void Parser::handleExtensionData(QVector &data, QStringRef element, const QString &value) diff --git a/src/poi.cpp b/src/poi.cpp index 13d2098a..12332ecd 100644 --- a/src/poi.cpp +++ b/src/poi.cpp @@ -5,6 +5,8 @@ #include "poi.h" +#define BOUNDING_RECT_SIZE 0.01 + bool POI::loadFile(const QString &fileName) { QFile file(fileName); @@ -64,7 +66,6 @@ static bool cb(const Entry* data, void* context) return true; } -#define RECT 0.01 QVector POI::points(const QVector &path) const { QVector ret; @@ -72,10 +73,10 @@ QVector POI::points(const QVector &path) const qreal min[2], max[2]; for (int i = 0; i < path.count(); i++) { - min[0] = path.at(i).x() - RECT; - min[1] = path.at(i).y() - RECT; - max[0] = path.at(i).x() + RECT; - max[1] = path.at(i).y() + RECT; + min[0] = path.at(i).x() - BOUNDING_RECT_SIZE; + min[1] = path.at(i).y() - BOUNDING_RECT_SIZE; + max[0] = path.at(i).x() + BOUNDING_RECT_SIZE; + max[1] = path.at(i).y() + BOUNDING_RECT_SIZE; _tree.Search(min, max, cb, &set); } diff --git a/src/poiitem.cpp b/src/poiitem.cpp index 03890aa2..db6a5c4c 100644 --- a/src/poiitem.cpp +++ b/src/poiitem.cpp @@ -2,11 +2,9 @@ #include "config.h" #include "poiitem.h" -#include #define POINT_SIZE 8 - POIItem::POIItem(const Entry &entry, QGraphicsItem *parent) : QGraphicsItem(parent) { diff --git a/src/slideritem.cpp b/src/slideritem.cpp index 8edfc9f4..104066ec 100644 --- a/src/slideritem.cpp +++ b/src/slideritem.cpp @@ -1,7 +1,6 @@ #include #include "slideritem.h" -#include #define SIZE 10 diff --git a/src/speedgraph.cpp b/src/speedgraph.cpp index d23b97f1..b2488108 100644 --- a/src/speedgraph.cpp +++ b/src/speedgraph.cpp @@ -1,8 +1,6 @@ #include "config.h" #include "speedgraph.h" -#include - SpeedGraph::SpeedGraph(QWidget *parent) : Graph(parent) { diff --git a/src/track.cpp b/src/track.cpp index 3146ad89..c7b543c7 100644 --- a/src/track.cpp +++ b/src/track.cpp @@ -3,19 +3,15 @@ #include #include #include -#include #include "poiitem.h" #include "markeritem.h" #include "ll.h" #include "track.h" -#include - #define MARGIN 10.0 #define TRACK_WIDTH 3 - Track::Track(QWidget *parent) : QGraphicsView(parent) {