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("Description"), _desc);
tt.insert(tr("Distance"), Format::distance(path().last().last().distance(), tt.insert(tr("Distance"), Format::distance(path().last().last().distance(),
_units)); _units));
for (int i = 0; i < _links.size(); i++) { if (!_links.isEmpty()) {
const Link &link = _links.at(i); QString links;
tt.insert(tr("Link"), QString("<a href=\"%0\">%1</a>").arg( for (int i = 0; i < _links.size(); i++) {
link.URL(), link.text().isEmpty() ? link.URL() : link.text())); 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(); return tt.toString();

View File

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

View File

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