From: akashihi Date: Sat, 3 Apr 2010 12:55:19 +0000 (+0000) Subject: Add:gui/qml:Added xml based poi filter X-Git-Tag: navit-0.5.0.5194svn~2072 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=11b10b1154748ffce3cb66d857a7784ffed2a860;p=profile%2Fivi%2Fnavit.git Add:gui/qml:Added xml based poi filter git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@3119 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- diff --git a/navit/configure.in b/navit/configure.in index 6d4c2a6..4a03814 100644 --- a/navit/configure.in +++ b/navit/configure.in @@ -787,7 +787,7 @@ AM_CONDITIONAL(GUI_WIN32, test "x${gui_win32}" = "xyes") AM_CONDITIONAL(QT_DECLARATIVE_NEWAPI,test "x${gui_qml}" = "xoldapi") AC_ARG_ENABLE(gui-qml, [ --disable-gui-qml disable gui type QML], gui_qml=$enableval;gui_qml_reason="configure parameter") if test "x${gui_qml}" = "xyes" -a "x${QT_GUI_CFLAGS}" = "x" -a "x${QT_GUI_LIBS}" = "x"; then - PKG_CHECK_MODULES(QT_GUI, [QtGui QtCore], ,gui_qml=no;gui_qml_reason="Packages QtGui and/or QtCore missing") + PKG_CHECK_MODULES(QT_GUI, [QtGui QtCore QtXml], ,gui_qml=no;gui_qml_reason="Packages QtGui and/or QtCore missing") fi if test "x${gui_qml}" = "xyes" -a "x${QT_DECLARATIVE_CFLAGS}" = "x" -a "x${QT_DECLARATIVE_LIBS}" = "x"; then PKG_CHECK_MODULES(QT_DECLARATIVE, [QtDeclarative >= 4.6.0 ], ,gui_qml=no;gui_qml_reason="Packages QtDeclarative missing") diff --git a/navit/navit/gui/qml/gui_qml.cpp b/navit/navit/gui/qml/gui_qml.cpp index 515593f..4d02aa0 100644 --- a/navit/navit/gui/qml/gui_qml.cpp +++ b/navit/navit/gui/qml/gui_qml.cpp @@ -2,6 +2,7 @@ #include #include #include +#include #ifdef HAVE_API_WIN32_BASE #include #endif diff --git a/navit/navit/gui/qml/ngqpoint.h b/navit/navit/gui/qml/ngqpoint.h index 67c222f..6cdb485 100644 --- a/navit/navit/gui/qml/ngqpoint.h +++ b/navit/navit/gui/qml/ngqpoint.h @@ -1,7 +1,7 @@ #ifndef NAVIT_GUI_QML_POINT_H #define NAVIT_GUI_QML_POINT_H -enum NGQPointTypes {MapPoint,Bookmark}; +enum NGQPointTypes {MapPoint,Bookmark,Position,Destination}; class NGQPoint : public QObject { Q_OBJECT; @@ -66,6 +66,10 @@ public slots: return QString("MapPoint"); case Bookmark: return QString("Bookmark"); + case Position: + return QString("Position"); + case Destination: + return QString("Destination"); } return QString(""); } @@ -78,7 +82,8 @@ public slots: struct map *m; int idist,dist; struct coord center; - QString retXml; + QDomDocument retDoc(attr_name); + QDomElement entries; if (!gui_get_attr(this->object->gui,attr_radius,&attr,NULL)) { return QString(); @@ -91,7 +96,8 @@ public slots: center.y=this->c.y; h=mapset_open(navit_get_mapset(this->object->nav)); - retXml=QString("<%1>").arg(attr_name); + entries=retDoc.createElement(attr_name); + retDoc.appendChild(entries); while ((m=mapset_next(h, 1))) { selm=map_selection_dup_pro(sel, this->c.pro, map_projection(m)); @@ -99,7 +105,7 @@ public slots: if (mr) { while ((item=map_rect_get_item(mr))) { struct coord c; - if ( item_coord_get_pro(item, &c, 1, this->c.pro) && coord_rect_contains(&sel->u.c_rect, &c) && (idist=transform_distance(this->c.pro, ¢er, &c)) < dist ) { + if ( item_coord_get_pro(item, &c, 1, this->c.pro) && coord_rect_contains(&sel->u.c_rect, &c) && (idist=transform_distance(this->c.pro, ¢er, &c)) < dist && item->typetype); if (rs.length()>0) { - QString pointXml=""; - pointXml+=""+rs+""; - pointXml+=""+QString(item_to_name(item->type))+""; - pointXml+=""; - - retXml+=pointXml; + QDomElement entry=retDoc.createElement("point"); + QDomElement nameTag=retDoc.createElement("name"); + QDomElement typeTag=retDoc.createElement("type"); + QDomText nameT=retDoc.createTextNode(rs); + QDomText typeT=retDoc.createTextNode(QString(item_to_name(item->type))); + nameTag.appendChild(nameT); + typeTag.appendChild(typeT); + entry.appendChild(nameTag); + entry.appendChild(typeTag); + entries.appendChild(entry); } } } @@ -137,9 +147,7 @@ public slots: map_selection_destroy(sel); mapset_close(h); - retXml+=QString("").arg(attr_name); - dbg(0,"Reulsting xml: %s\n",retXml.toLocal8Bit().constData()); - return retXml; + return retDoc.toString(); } protected: QString _coordString() { diff --git a/navit/navit/gui/qml/skins/navit/PagePoi.qml b/navit/navit/gui/qml/skins/navit/PagePoi.qml index 6c49020..b66a952 100644 --- a/navit/navit/gui/qml/skins/navit/PagePoi.qml +++ b/navit/navit/gui/qml/skins/navit/PagePoi.qml @@ -118,7 +118,7 @@ Rectangle { XmlRole { name: "itemName"; query: "name/string()" } XmlRole { name: "itemType"; query: "type/string()" } } - ListSelectorXml { + ListSelector { id:layoutList; text: ""; itemId: point.getAttrList("points"); onChanged: console.log("Poi clicked"); anchors.top: distanceSlider.bottom; anchors.left: parent.left; anchors.leftMargin: 3