summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-04-03 13:43:10 +0000
committerakashihi <akashihi@ffa7fe5e-494d-0410-b361-a75ebd5db220>2010-04-03 13:43:10 +0000
commitf68a385b4a3f2b5040c540548cd1f81ab78c3dc9 (patch)
treeb555fc9e112034bc2d110e0e547ec48e06519c53
parentba3e1c975892dadaac80d55ba12e111ea1a3f306 (diff)
downloadnavit-svn-f68a385b4a3f2b5040c540548cd1f81ab78c3dc9.tar.gz
Add:gui/qml:Added sitance/direction to POI viewer and additional fields
into ListSelector git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit/navit@3121 ffa7fe5e-494d-0410-b361-a75ebd5db220
-rw-r--r--gui/qml/ngqpoint.h40
-rw-r--r--gui/qml/skins/navit/ListSelector.qml4
-rw-r--r--gui/qml/skins/navit/PagePoi.qml2
3 files changed, 44 insertions, 2 deletions
diff --git a/gui/qml/ngqpoint.h b/gui/qml/ngqpoint.h
index 6cdb4851..afeb2e27 100644
--- a/gui/qml/ngqpoint.h
+++ b/gui/qml/ngqpoint.h
@@ -1,6 +1,34 @@
#ifndef NAVIT_GUI_QML_POINT_H
#define NAVIT_GUI_QML_POINT_H
+static void
+get_direction(char *buffer, int angle, int mode)
+{
+ angle=angle%360;
+ switch (mode) {
+ case 0:
+ sprintf(buffer,"%d",angle);
+ break;
+ case 1:
+ if (angle < 69 || angle > 291)
+ *buffer++='N';
+ if (angle > 111 && angle < 249)
+ *buffer++='S';
+ if (angle > 22 && angle < 158)
+ *buffer++='E';
+ if (angle > 202 && angle < 338)
+ *buffer++='W';
+ *buffer++='\0';
+ break;
+ case 2:
+ angle=(angle+15)/30;
+ if (! angle)
+ angle=12;
+ sprintf(buffer,"%d H", angle);
+ break;
+ }
+}
+
enum NGQPointTypes {MapPoint,Bookmark,Position,Destination};
class NGQPoint : public QObject {
@@ -84,6 +112,7 @@ public slots:
struct coord center;
QDomDocument retDoc(attr_name);
QDomElement entries;
+ char dirbuf[32];
if (!gui_get_attr(this->object->gui,attr_radius,&attr,NULL)) {
return QString();
@@ -127,16 +156,25 @@ public slots:
map_convert_free(label);
} else
rs=item_to_name(item->type);
+ get_direction(dirbuf, transform_get_angle_delta(&center, &c, 0), 1);
if (rs.length()>0) {
QDomElement entry=retDoc.createElement("point");
QDomElement nameTag=retDoc.createElement("name");
QDomElement typeTag=retDoc.createElement("type");
+ QDomElement distTag=retDoc.createElement("distance");
+ QDomElement directTag=retDoc.createElement("direction");
QDomText nameT=retDoc.createTextNode(rs);
QDomText typeT=retDoc.createTextNode(QString(item_to_name(item->type)));
+ QDomText distT=retDoc.createTextNode(QString::number(idist/1000));
+ QDomText directT=retDoc.createTextNode(dirbuf);
nameTag.appendChild(nameT);
typeTag.appendChild(typeT);
+ distTag.appendChild(distT);
+ directTag.appendChild(directT);
entry.appendChild(nameTag);
entry.appendChild(typeTag);
+ entry.appendChild(distTag);
+ entry.appendChild(directTag);
entries.appendChild(entry);
}
}
@@ -146,7 +184,7 @@ public slots:
}
map_selection_destroy(sel);
mapset_close(h);
-
+ dbg(2,"%s\n",retDoc.toString().toLocal8Bit().constData());
return retDoc.toString();
}
protected:
diff --git a/gui/qml/skins/navit/ListSelector.qml b/gui/qml/skins/navit/ListSelector.qml
index bc354a9e..f3cba971 100644
--- a/gui/qml/skins/navit/ListSelector.qml
+++ b/gui/qml/skins/navit/ListSelector.qml
@@ -24,7 +24,9 @@ Rectangle {
width: list.width; height: 20
Column {
x: 5; y: 5
- Text { text: itemName; color: "White" }
+ Text { id: txtItemName; text: itemName; color: "White" }
+ Text { id: txtItemDist; text: itemDistance; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemName.right;anchors.top: txtItemName.top }
+ Text { id: txtItemDirect; text: itemDirection; color: "White"; anchors.leftMargin: 5; anchors.left: txtItemDist.right;anchors.top: txtItemDist.top }
}
MouseRegion {
id:delegateMouse
diff --git a/gui/qml/skins/navit/PagePoi.qml b/gui/qml/skins/navit/PagePoi.qml
index b66a9521..f608e499 100644
--- a/gui/qml/skins/navit/PagePoi.qml
+++ b/gui/qml/skins/navit/PagePoi.qml
@@ -117,6 +117,8 @@ Rectangle {
query: "/points/point"
XmlRole { name: "itemName"; query: "name/string()" }
XmlRole { name: "itemType"; query: "type/string()" }
+ XmlRole { name: "itemDistance"; query: "distance/string()" }
+ XmlRole { name: "itemDirection"; query: "direction/string()" }
}
ListSelector {
id:layoutList; text: ""; itemId: point.getAttrList("points"); onChanged: console.log("Poi clicked");