summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanjiban Bairagya <sanjiban22393@gmail.com>2016-08-07 00:10:43 (GMT)
committerSanjiban Bairagya <sanjiban22393@gmail.com>2016-08-07 00:10:43 (GMT)
commit9cf50760efcea2c3ecb75a81b868424b91782f62 (patch)
tree8466decb9c6c7bd24d42e2f38b0cc36bd1f34c03
parent0448670d4325ab96cc24ae24b5b3fea1d90328e4 (diff)
Separate the amenity and shop details in the Android version's placemark dialog
-rw-r--r--src/apps/marble-maps/PlacemarkDialog.qml6
-rw-r--r--src/lib/marble/declarative/Placemark.cpp31
-rw-r--r--src/lib/marble/declarative/Placemark.h4
3 files changed, 33 insertions, 8 deletions
diff --git a/src/apps/marble-maps/PlacemarkDialog.qml b/src/apps/marble-maps/PlacemarkDialog.qml
index 4295bd4..e7f75b4 100644
--- a/src/apps/marble-maps/PlacemarkDialog.qml
+++ b/src/apps/marble-maps/PlacemarkDialog.qml
@@ -103,6 +103,12 @@ Item {
IconText {
width: parent.width
+ visible: text.length > 0
+ text: placemark === null ? "" : placemark.shop
+ }
+
+ 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 2221354..4f2939e 100644
--- a/src/lib/marble/declarative/Placemark.cpp
+++ b/src/lib/marble/declarative/Placemark.cpp
@@ -38,6 +38,7 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
m_openingHours = QString();
m_elevation = QString();
m_amenity = QString();
+ m_shop = QString();
emit coordinatesChanged();
emit nameChanged();
emit descriptionChanged();
@@ -47,6 +48,7 @@ void Placemark::setGeoDataPlacemark( const Marble::GeoDataPlacemark &placemark )
emit openingHoursChanged();
emit elevationChanged();
emit amenityChanged();
+ emit shopChanged();
if (m_placemark.visualCategory() == GeoDataFeature::TransportFuel) {
emit fuelDetailsChanged();
}
@@ -195,27 +197,40 @@ QString Placemark::amenity() const
OsmPlacemarkData data = m_placemark.osmData();
+ if (data.containsTagKey("amenity") && !data.tagValue("amenity").isEmpty()){
+ QString amenity = data.tagValue("amenity");
+ amenity[0] = amenity[0].toUpper();
+ m_amenity = amenity;
+ }
+
+ return m_amenity;
+}
+
+QString Placemark::shop() const
+{
+ if (!m_shop.isEmpty()){
+ return m_shop;
+ }
+
+ 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 + ")";
+ m_shop = "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 + ")";
+ m_shop = "Shop : " + shop + " (" + designation + ")";
} else {
- m_amenity = "Shop : " + shop;
+ m_shop = "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;
+ return m_shop;
}
void Placemark::setName(const QString & name)
diff --git a/src/lib/marble/declarative/Placemark.h b/src/lib/marble/declarative/Placemark.h
index 79efbfc..97236ff 100644
--- a/src/lib/marble/declarative/Placemark.h
+++ b/src/lib/marble/declarative/Placemark.h
@@ -38,6 +38,7 @@ class Placemark : public QObject
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(QString shop READ shop NOTIFY shopChanged)
Q_PROPERTY(double longitude READ longitude NOTIFY coordinatesChanged)
Q_PROPERTY(double latitude READ latitude NOTIFY coordinatesChanged)
@@ -60,6 +61,7 @@ public:
QString coordinates() const;
QString elevation() const;
QString amenity() const;
+ QString shop() const;
double longitude() const;
double latitude() const;
@@ -77,6 +79,7 @@ Q_SIGNALS:
void openingHoursChanged();
void elevationChanged();
void amenityChanged();
+ void shopChanged();
private:
void addTagValue(QString &target, const QString &key) const;
@@ -93,6 +96,7 @@ private:
mutable QString m_openingHours;
mutable QString m_elevation;
mutable QString m_amenity;
+ mutable QString m_shop;
};
}