Commit 9cf50760 authored by Sanjiban Bairagya's avatar Sanjiban Bairagya
Browse files

Separate the amenity and shop details in the Android version's placemark dialog

parent 0448670d
......@@ -101,6 +101,12 @@ Item {
text: placemark === null ? "" : placemark.amenity
}
IconText {
width: parent.width
visible: text.length > 0
text: placemark === null ? "" : placemark.shop
}
IconText {
width: parent.width
visible: text.length > 0 && (!condensed || name.text === "")
......
......@@ -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)
......
......@@ -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;
};
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment