From a1ac09f61581ac1698f1ddde5f816e53dfb9e68c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20T=C5=AFma?= Date: Sun, 28 Feb 2016 09:32:54 +0100 Subject: [PATCH] Refactoring --- gpxsee.pro | 8 ++++---- src/graphview.h | 4 ++-- src/{colorshop.cpp => palette.cpp} | 8 ++++---- src/{colorshop.h => palette.h} | 10 +++++----- src/trackview.h | 4 ++-- 5 files changed, 17 insertions(+), 17 deletions(-) rename src/{colorshop.cpp => palette.cpp} (90%) rename src/{colorshop.h => palette.h} (50%) diff --git a/gpxsee.pro b/gpxsee.pro index cf3a2bcf..a594cc3e 100644 --- a/gpxsee.pro +++ b/gpxsee.pro @@ -13,7 +13,6 @@ HEADERS += src/config.h \ src/rtree.h \ src/ll.h \ src/axisitem.h \ - src/colorshop.h \ src/keys.h \ src/slideritem.h \ src/markeritem.h \ @@ -33,7 +32,8 @@ HEADERS += src/config.h \ src/track.h \ src/graphview.h \ src/trackpoint.h \ - src/waypointitem.h + src/waypointitem.h \ + src/palette.h SOURCES += src/main.cpp \ src/gui.cpp \ src/gpx.cpp \ @@ -41,7 +41,6 @@ SOURCES += src/main.cpp \ src/poi.cpp \ src/ll.cpp \ src/axisitem.cpp \ - src/colorshop.cpp \ src/slideritem.cpp \ src/markeritem.cpp \ src/infoitem.cpp \ @@ -57,7 +56,8 @@ SOURCES += src/main.cpp \ src/trackview.cpp \ src/track.cpp \ src/graphview.cpp \ - src/waypointitem.cpp + src/waypointitem.cpp \ + src/palette.cpp RESOURCES += gpxsee.qrc TRANSLATIONS = lang/gpxsee_cs.ts macx:ICON = icons/gpxsee.icns diff --git a/src/graphview.h b/src/graphview.h index 9559aab4..523b6562 100644 --- a/src/graphview.h +++ b/src/graphview.h @@ -6,7 +6,7 @@ #include #include #include -#include "colorshop.h" +#include "palette.h" class AxisItem; @@ -84,7 +84,7 @@ private: QList _graphs; qreal _xMin, _xMax, _yMin, _yMax; - ColorShop _colorShop; + Palette _colorShop; }; #endif // GRAPHVIEW_H diff --git a/src/colorshop.cpp b/src/palette.cpp similarity index 90% rename from src/colorshop.cpp rename to src/palette.cpp index 5592ef6e..d04036f4 100644 --- a/src/colorshop.cpp +++ b/src/palette.cpp @@ -1,4 +1,4 @@ -#include "colorshop.h" +#include "palette.h" #define HUE_INIT 0.1f @@ -43,12 +43,12 @@ static unsigned hsv2rgb(float h, float s, float v) + (unsigned)(b * 256); } -ColorShop::ColorShop() +Palette::Palette() { _hueState = HUE_INIT; } -QColor ColorShop::color() +QColor Palette::color() { _hueState += HUE_INCREMENT; _hueState -= (int) _hueState; @@ -56,7 +56,7 @@ QColor ColorShop::color() return QColor(hsv2rgb(_hueState, SATURATION, VALUE)); } -void ColorShop::reset() +void Palette::reset() { _hueState = HUE_INIT; } diff --git a/src/colorshop.h b/src/palette.h similarity index 50% rename from src/colorshop.h rename to src/palette.h index b7421619..60e68206 100644 --- a/src/colorshop.h +++ b/src/palette.h @@ -1,12 +1,12 @@ -#ifndef COLORSHOP_H -#define COLORSHOP_H +#ifndef PALETTE_H +#define PALETTE_H #include -class ColorShop +class Palette { public: - ColorShop(); + Palette(); QColor color(); void reset(); @@ -14,4 +14,4 @@ private: float _hueState; }; -#endif // COLORSHOP_H +#endif // PALLETE_H diff --git a/src/trackview.h b/src/trackview.h index 612ab668..b6a60559 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -7,7 +7,7 @@ #include #include #include "units.h" -#include "colorshop.h" +#include "palette.h" #include "waypoint.h" class GPX; @@ -65,7 +65,7 @@ private: Map *_map; ScaleItem *_mapScale; - ColorShop _colorShop; + Palette _colorShop; qreal _maxLen; qreal _scale;