diff --git a/gpxsee.pro b/gpxsee.pro
index 915248e8..d5d7541e 100644
--- a/gpxsee.pro
+++ b/gpxsee.pro
@@ -85,6 +85,7 @@ HEADERS += src/common/config.h \
src/GUI/mapview.h \
src/GUI/font.h \
src/GUI/areaitem.h \
+ src/data/link.h \
src/map/IMG/bitmapline.h \
src/map/IMG/textpathitem.h \
src/map/IMG/textpointitem.h \
diff --git a/src/GUI/waypointitem.cpp b/src/GUI/waypointitem.cpp
index 30f3b726..50f7a0fa 100644
--- a/src/GUI/waypointitem.cpp
+++ b/src/GUI/waypointitem.cpp
@@ -30,6 +30,11 @@ ToolTip WaypointItem::toolTip(Units units, CoordinatesFormat format)
if (!_waypoint.description().isEmpty())
tt.insert(qApp->translate("WaypointItem", "Description"),
_waypoint.description());
+ if (!_waypoint.link().URL().isEmpty())
+ tt.insert(qApp->translate("WaypointItem", "Link"),
+ QString("%1").arg(_waypoint.link().URL(),
+ _waypoint.link().text().isEmpty() ? _waypoint.link().URL()
+ : _waypoint.link().text()));
tt.setImage(_waypoint.image());
return tt;
diff --git a/src/data/gpxparser.cpp b/src/data/gpxparser.cpp
index 5b4b8145..d57ffc86 100644
--- a/src/data/gpxparser.cpp
+++ b/src/data/gpxparser.cpp
@@ -23,6 +23,21 @@ QDateTime GPXParser::time()
return d;
}
+Link GPXParser::link()
+{
+ QString URL = _reader.attributes().value("href").toString();
+ QString text;
+
+ while (_reader.readNextStartElement()) {
+ if (_reader.name() == QLatin1String("text"))
+ text = _reader.readElementText();
+ else
+ _reader.skipCurrentElement();
+ }
+
+ return Link(URL, text);
+}
+
Coordinates GPXParser::coordinates()
{
bool res;
@@ -146,6 +161,8 @@ void GPXParser::waypointData(Waypoint &waypoint, SegmentData *autoRoute)
gh = number();
else if (_reader.name() == QLatin1String("time"))
waypoint.setTimestamp(time());
+ else if (_reader.name() == QLatin1String("link"))
+ waypoint.setLink(link());
else if (autoRoute && _reader.name() == QLatin1String("extensions"))
rteptExtensions(autoRoute);
else
diff --git a/src/data/gpxparser.h b/src/data/gpxparser.h
index d94cfff6..2a5e25df 100644
--- a/src/data/gpxparser.h
+++ b/src/data/gpxparser.h
@@ -4,7 +4,6 @@
#include
#include "parser.h"
-
class GPXParser : public Parser
{
public:
@@ -30,6 +29,7 @@ private:
qreal number();
QDateTime time();
Coordinates coordinates();
+ Link link();
QXmlStreamReader _reader;
};
diff --git a/src/data/link.h b/src/data/link.h
new file mode 100644
index 00000000..20d5edf1
--- /dev/null
+++ b/src/data/link.h
@@ -0,0 +1,20 @@
+#ifndef LINK_H
+#define LINK_H
+
+#include
+
+class Link {
+public:
+ Link() {}
+ Link(const QString &URL, const QString &text = QString())
+ : _URL(URL), _text(text) {}
+
+ const QString &URL() const {return _URL;}
+ const QString &text() const {return _text;}
+
+private:
+ QString _URL;
+ QString _text;
+};
+
+#endif // LINK_H
diff --git a/src/data/locparser.cpp b/src/data/locparser.cpp
index 5831f341..aeaf3c65 100644
--- a/src/data/locparser.cpp
+++ b/src/data/locparser.cpp
@@ -38,6 +38,10 @@ void LOCParser::waypoint(Waypoint &waypoint)
} else if (_reader.name() == QLatin1String("coord")) {
waypoint.setCoordinates(coordinates());
_reader.skipCurrentElement();
+ } else if (_reader.name() == QLatin1String("link")) {
+ const QXmlStreamAttributes &attr = _reader.attributes();
+ waypoint.setLink(Link(_reader.readElementText(),
+ attr.value("text").toString()));
} else
_reader.skipCurrentElement();
}
diff --git a/src/data/waypoint.h b/src/data/waypoint.h
index 84e964be..02602b90 100644
--- a/src/data/waypoint.h
+++ b/src/data/waypoint.h
@@ -7,6 +7,7 @@
#include
#include "common/coordinates.h"
#include "imageinfo.h"
+#include "link.h"
class Waypoint
{
@@ -19,6 +20,7 @@ public:
const QString &name() const {return _name;}
const QString &description() const {return _description;}
const ImageInfo &image() const {return _image;}
+ const Link &link() const {return _link;}
const QDateTime ×tamp() const {return _timestamp;}
qreal elevation() const {return _elevation;}
@@ -30,6 +32,7 @@ public:
void setTimestamp(const QDateTime ×tamp) {_timestamp = timestamp;}
void setElevation(qreal elevation) {_elevation = elevation;}
void setImage(const ImageInfo &image) {_image = image;}
+ void setLink(const Link &link) {_link = link;}
bool hasElevation() const {return !std::isnan(_elevation);}
@@ -42,6 +45,7 @@ private:
QString _name;
QString _description;
ImageInfo _image;
+ Link _link;
QDateTime _timestamp;
qreal _elevation;
};