summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjiban Bairagya <sanjiban22393@gmail.com>2016-08-06 12:07:55 (GMT)
committerSanjiban Bairagya <sanjiban@magicpin.in>2016-08-06 12:08:22 (GMT)
commit5752f751d64fa31515610115951c1127377a9a6f (patch)
treee0d1cc69764f8106aeddc7884466b6ef92cddc51
parentdb22e5607162da786e29146d2e690c79850d5359 (diff)
Show Shop info, or if not present, amenity info, in the placemark dialog
in the Android version
-rw-r--r--src/apps/marble-maps/PlacemarkDialog.qml8
-rw-r--r--src/lib/marble/declarative/Placemark.cpp33
-rw-r--r--src/lib/marble/declarative/Placemark.h4
3 files changed, 44 insertions, 1 deletions
diff --git a/src/apps/marble-maps/PlacemarkDialog.qml b/src/apps/marble-maps/PlacemarkDialog.qml
index 24bf4b0..4295bd4 100644
--- a/src/apps/marble-maps/PlacemarkDialog.qml
+++ b/src/apps/marble-maps/PlacemarkDialog.qml
@@ -91,12 +91,18 @@ Item {
IconText {
width: parent.width
- visible: placemark != null && placemark.elevation != ""
+ visible: placemark !== null && placemark.elevation !== ""
text: placemark === null ? "" : ("Elevation : " + placemark.elevation + " m")
}
IconText {
width: parent.width
+ visible: text.length > 0
+ text: placemark === null ? "" : placemark.amenity
+ }
+
+ IconText {
+ width: parent.width
visible: text.length > 0 && (!condensed || name.text === "")
text: placemark === null ? "" : placemark.address
maximumLineCount: 4
diff --git a/src/lib/marble/declarative/Placemark.cpp b/src/lib/marble/declarative/Placemark.cpp
index 73a4924..2221354 100644
--- a/src/lib/marble/declarative/Placemark.cpp
+++ b/src/lib/marble/declarative/Placemark.cpp
@@ -37,6 +37,7 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
m_fuelDetails = QString();
m_openingHours = QString();
m_elevation = QString();
+ m_amenity = QString();
emit coordinatesChanged();
emit nameChanged();
emit descriptionChanged();
@@ -45,6 +46,7 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
emit wikipediaChanged();
emit openingHoursChanged();
emit elevationChanged();
+ emit amenityChanged();
if (m_placemark.visualCategory() == GeoDataFeature::TransportFuel) {
emit fuelDetailsChanged();
}
@@ -185,6 +187,37 @@ QString Placemark::elevation() const
return m_elevation;
}
+QString Placemark::amenity() const
+{
+ if (!m_amenity.isEmpty()){
+ return m_amenity;
+ }
+
+ OsmPlacemarkData data = m_placemark.osmData();
+
+ if (data.containsTagKey("shop") && !data.tagValue("shop").isEmpty()){
+ QString shop = data.tagValue("shop");
+ shop[0] = shop[0].toUpper();
+ if (shop == "Clothes" && data.containsTagKey("clothes") && !data.tagValue("clothes").isEmpty()){
+ QString clothes = data.tagValue("clothes");
+ clothes[0] = clothes[0].toUpper();
+ m_amenity = "Shop : " + shop + " (" + clothes + ")";
+ } else if (shop == "Clothes" && data.containsTagKey("designation") && !data.tagValue("designation").isEmpty()){
+ QString designation = data.tagValue("designation");
+ designation[0] = designation[0].toUpper();
+ m_amenity = "Shop : " + shop + " (" + designation + ")";
+ } else {
+ m_amenity = "Shop : " + shop;
+ }
+ } else if (data.containsTagKey("amenity") && !data.tagValue("amenity").isEmpty()){
+ QString amenity = data.tagValue("amenity");
+ amenity[0] = amenity[0].toUpper();
+ m_amenity = amenity;
+ }
+
+ return m_amenity;
+}
+
void Placemark::setName(const QString & name)
{
if (m_placemark.name() == name) {
diff --git a/src/lib/marble/declarative/Placemark.h b/src/lib/marble/declarative/Placemark.h
index d988ee8..79efbfc 100644
--- a/src/lib/marble/declarative/Placemark.h
+++ b/src/lib/marble/declarative/Placemark.h
@@ -37,6 +37,7 @@ class Placemark : public QObject
Q_PROPERTY(QString openingHours READ openingHours NOTIFY openingHoursChanged)
Q_PROPERTY(QString coordinates READ coordinates NOTIFY coordinatesChanged)
Q_PROPERTY(QString elevation READ elevation NOTIFY elevationChanged)
+ Q_PROPERTY(QString amenity READ amenity NOTIFY amenityChanged)
Q_PROPERTY(double longitude READ longitude NOTIFY coordinatesChanged)
Q_PROPERTY(double latitude READ latitude NOTIFY coordinatesChanged)
@@ -58,6 +59,7 @@ public:
QString openingHours() const;
QString coordinates() const;
QString elevation() const;
+ QString amenity() const;
double longitude() const;
double latitude() const;
@@ -74,6 +76,7 @@ Q_SIGNALS:
void fuelDetailsChanged();
void openingHoursChanged();
void elevationChanged();
+ void amenityChanged();
private:
void addTagValue(QString &target, const QString &key) const;
@@ -89,6 +92,7 @@ private:
mutable QString m_wikipedia;
mutable QString m_openingHours;
mutable QString m_elevation;
+ mutable QString m_amenity;
};
}