Added missing comments.
[situare] / src / ui / locationlistitem.cpp
1 #include <QDebug>
2
3 #include "../common.h"
4 #include "listcommon.h"
5
6 #include "locationlistitem.h"
7
8 const int LOCATION_SUBITEM_TEXT_MAX_WIDTH = SUBITEM_TEXT_MAX_WIDTH + MARGIN + IMAGE_WIDTH;
9
10 LocationListItem::LocationListItem()
11 {
12     qDebug() << __PRETTY_FUNCTION__;
13
14     setSubitemTextWidth(LOCATION_SUBITEM_TEXT_MAX_WIDTH);
15 }
16
17 GeoCoordinate LocationListItem::coordinates()
18 {
19     qDebug() << __PRETTY_FUNCTION__;
20
21     return m_location.coordinates();
22 }
23
24 QString LocationListItem::id() const
25 {
26     qDebug() << __PRETTY_FUNCTION__;
27
28     return QString();
29 }
30
31 void LocationListItem::setLocationData(const Location &location)
32 {
33     qDebug() << __PRETTY_FUNCTION__;
34
35     m_location = location;
36
37     QStringList addressComponents = m_location.addressComponents();
38
39     if (addressComponents.count() > 0)
40         setName(shortenText(addressComponents.at(0), ITEM_WIDTH - 3*MARGIN,
41                             ListItem::TEXT_SIZE_NORMAL));
42
43     QString addressTail;
44
45     for (int i = 1; i < addressComponents.count(); ++i) {
46         addressTail.append(addressComponents.at(i));
47
48         if (i < (addressComponents.count() - 1))
49             addressTail.append(", ");
50     }
51
52     clearSubItems();
53     addSubItem(addressTail, QPixmap(":/res/images/compass.png"));
54
55 }
56
57 void LocationListItem::bounds(GeoCoordinate &swBound, GeoCoordinate &neBound)
58 {
59     qDebug() << __PRETTY_FUNCTION__;
60
61     m_location.bounds(swBound, neBound);
62 }
63
64 LocationListItem::~LocationListItem()
65 {
66     qDebug() << __PRETTY_FUNCTION__;
67 }