4 #include "listcommon.h"
6 #include "locationlistitem.h"
8 const int LOCATION_SUBITEM_TEXT_MAX_WIDTH = SUBITEM_TEXT_MAX_WIDTH + MARGIN + IMAGE_WIDTH;
10 LocationListItem::LocationListItem()
12 qDebug() << __PRETTY_FUNCTION__;
14 setSubitemTextWidth(LOCATION_SUBITEM_TEXT_MAX_WIDTH);
17 GeoCoordinate LocationListItem::coordinates()
19 qDebug() << __PRETTY_FUNCTION__;
21 return m_location.coordinates();
24 QString LocationListItem::id() const
26 qDebug() << __PRETTY_FUNCTION__;
31 void LocationListItem::setLocationData(const Location &location)
33 qDebug() << __PRETTY_FUNCTION__;
35 m_location = location;
37 QStringList addressComponents = m_location.addressComponents();
39 if (addressComponents.count() > 0)
40 setName(shortenText(addressComponents.at(0), ITEM_WIDTH - 3*MARGIN,
41 ListItem::TEXT_SIZE_NORMAL));
45 for (int i = 1; i < addressComponents.count(); ++i) {
46 addressTail.append(addressComponents.at(i));
48 if (i < (addressComponents.count() - 1))
49 addressTail.append(", ");
53 addSubItem(addressTail, QPixmap(":/res/images/compass.png"));
57 void LocationListItem::bounds(GeoCoordinate &swBound, GeoCoordinate &neBound)
59 qDebug() << __PRETTY_FUNCTION__;
61 m_location.bounds(swBound, neBound);
64 LocationListItem::~LocationListItem()
66 qDebug() << __PRETTY_FUNCTION__;