1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-30 22:51:16 +01:00

Nicer multiple links display

This commit is contained in:
Martin Tůma 2019-10-22 22:27:12 +02:00
parent 9905de67bd
commit c29ed0a2ca
3 changed files with 30 additions and 13 deletions

View File

@ -17,10 +17,16 @@ QString RouteItem::info() const
tt.insert(tr("Description"), _desc);
tt.insert(tr("Distance"), Format::distance(path().last().last().distance(),
_units));
for (int i = 0; i < _links.size(); i++) {
const Link &link = _links.at(i);
tt.insert(tr("Link"), QString("<a href=\"%0\">%1</a>").arg(
link.URL(), link.text().isEmpty() ? link.URL() : link.text()));
if (!_links.isEmpty()) {
QString links;
for (int i = 0; i < _links.size(); i++) {
const Link &link = _links.at(i);
links.append(QString("<a href=\"%0\">%1</a>").arg(link.URL(),
link.text().isEmpty() ? link.URL() : link.text()));
if (i != _links.size() - 1)
links.append("<br/>");
}
tt.insert(tr("Links"), links);
}
return tt.toString();

View File

@ -21,10 +21,16 @@ QString TrackItem::info() const
tt.insert(tr("Moving time"), Format::timeSpan(_movingTime));
if (!_date.isNull())
tt.insert(tr("Date"), _date.toString(Qt::SystemLocaleShortDate));
for (int i = 0; i < _links.size(); i++) {
const Link &link = _links.at(i);
tt.insert(tr("Link"), QString("<a href=\"%0\">%1</a>").arg(
link.URL(), link.text().isEmpty() ? link.URL() : link.text()));
if (!_links.isEmpty()) {
QString links;
for (int i = 0; i < _links.size(); i++) {
const Link &link = _links.at(i);
links.append(QString("<a href=\"%0\">%1</a>").arg(link.URL(),
link.text().isEmpty() ? link.URL() : link.text()));
if (i != _links.size() - 1)
links.append("<br/>");
}
tt.insert(tr("Links"), links);
}
return tt.toString();

View File

@ -30,11 +30,16 @@ QString WaypointItem::info() const
if (!_waypoint.description().isEmpty())
tt.insert(qApp->translate("WaypointItem", "Description"),
_waypoint.description());
for (int i = 0; i < _waypoint.links().size(); i++) {
const Link &link = _waypoint.links().at(i);
tt.insert(qApp->translate("WaypointItem", "Link"),
QString("<a href=\"%0\">%1</a>").arg(link.URL(),
link.text().isEmpty() ? link.URL() : link.text()));
if (!_waypoint.links().isEmpty()) {
QString links;
for (int i = 0; i < _waypoint.links().size(); i++) {
const Link &link = _waypoint.links().at(i);
links.append(QString("<a href=\"%0\">%1</a>").arg(link.URL(),
link.text().isEmpty() ? link.URL() : link.text()));
if (i != _waypoint.links().size() - 1)
links.append("<br/>");
}
tt.insert(qApp->translate("WaypointItem", "Links"), links);
}
tt.setImage(_waypoint.image());