}
return QString("");
}
+ QString getAttrList(const QString &attr_name) {
+ NGQStandardItemModel* ret=new NGQStandardItemModel(this);
+ struct attr attr;
+ struct item* item;
+ struct mapset_handle *h;
+ struct map_selection *sel,*selm;
+ struct map_rect *mr;
+ struct map *m;
+ int idist,dist;
+ struct coord center;
+ QString retXml;
+
+ if (!gui_get_attr(this->object->gui,attr_radius,&attr,NULL)) {
+ return QString();
+ }
+
+ dist=attr.u.num*1000;
+
+ sel=map_selection_rect_new(&this->c, dist, 18);
+ center.x=this->c.x;
+ center.y=this->c.y;
+ h=mapset_open(navit_get_mapset(this->object->nav));
+
+ retXml=QString("<%1>").arg(attr_name);
+
+ while ((m=mapset_next(h, 1))) {
+ selm=map_selection_dup_pro(sel, this->c.pro, map_projection(m));
+ mr=map_rect_new(m, selm);
+ 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 ) {
+ char* label;
+ QString rs;
+ QString pointXml="<point>";
+ if (item_attr_get(item, attr_label, &attr)) {
+ label=map_convert_string(m, attr.u.str);
+ if (QString(item_to_name(item->type)).startsWith(QString("poi_"))) {
+ rs=QString::fromLocal8Bit(item_to_name(item->type));
+ rs=rs.remove(QString("poi_"));
+ rs+=QString(" ")+QString::fromLocal8Bit(label);
+
+ } else if (QString(item_to_name(item->type)).startsWith(QString("poly_"))) {
+ rs=QString::fromLocal8Bit(item_to_name(item->type));
+ rs=rs.remove(QString("poly_"));
+ rs+=QString(" ")+QString::fromLocal8Bit(label);
+
+ } else if (QString(item_to_name(item->type)).startsWith(QString("street_"))) {
+ rs="Street ";
+ rs+=QString::fromLocal8Bit(label);
+ }
+ map_convert_free(label);
+ } else
+ rs=item_to_name(item->type);
+ pointXml+="<name>"+rs+"</name>";
+ pointXml+="<type>"+QString(item_to_name(item->type))+"</type>";
+ pointXml+="</point>";
+
+ retXml+=pointXml;
+ }
+ }
+ }
+ map_selection_destroy(selm);
+ }
+ map_selection_destroy(sel);
+ mapset_close(h);
+
+ this->object->guiWidget->rootContext()->setContextProperty("listModel",static_cast<QObject*>(ret));
+
+ retXml+=QString("</%1>").arg(attr_name);
+ dbg(0,"Reulsting xml: %s\n",retXml.toLocal8Bit().constData());
+ return retXml;
+ }
protected:
QString _coordString() {
char latc='N',lngc='E';
transitions: Transition {\r
NumberAnimation { matchProperties: "scale"; easing: "easeOutExpo"; duration: 200 }\r
NumberAnimation { matchProperties: "opacity"; easing: "easeInQuad"; duration: 200 }\r
-\r
}\r
\r
}\r
--- /dev/null
+
+import Qt 4.6
+
+Rectangle {
+ id: listselector
+ width: parent.width; height: parent.height
+ color: "Black"
+
+
+ property string text: "ListSelector"
+ property string value: ""
+ property string itemId: "0"
+ signal changed
+
+ function startup() {
+ console.log("model is: "+listModel);
+ }
+ Component.onCompleted: startup();
+
+ Component {
+ id: delegate
+ Item {
+ id: wrapper
+ width: list.width; height: 20
+ Column {
+ x: 5; y: 5
+ Text { text: itemName; color: "White" }
+ }
+ MouseRegion {
+ id:delegateMouse
+ anchors.fill: parent
+ onClicked: { list.currentIndex=itemId; listselector.value=itemName; listselector.changed() }
+ }
+ }
+ }
+
+ Component {
+ id: highlight
+ Rectangle {
+ color: "lightsteelblue"
+ radius: 5
+ }
+ }
+
+ Text {
+ id: labelTxt; text: listselector.text; color: "White"; font.pointSize: 14;
+ anchors.horizontalCenter: list.horizontalCenter
+ anchors.verticalCenter: listselector.top
+ }
+
+ ListView {
+ id: list;
+ width: listselector.width*0.8; height: listselector.height
+ anchors.top: labelTxt.bottom;
+ anchors.left: listselector.left
+ model: listModel
+ delegate: delegate
+ highlight: highlight
+ focus: true
+ clip: true
+ highlightFollowsCurrentItem: true
+ keyNavigationWraps: true
+ overShoot: false
+ currentIndex: listselector.itemId;
+ }
+ Rectangle {
+ id: listScroller
+ opacity: 0.5; anchors.left: list.right; anchors.leftMargin: 4; width: 6
+ y: (list.visibleArea.yPosition * list.height)+(list.visibleArea.heightRatio * list.height/4)
+ height: list.visibleArea.heightRatio * list.height
+ }
+}
qmldir=$(skinsdir)/$(SKIN)
-qml_DATA = ButtonIcon.qml ToggleSwitch.qml ToggleButton.qml ListSelector.qml Slider.qml Cellar.qml main.qml point.qml command.qml PageAbout.qml PageBookmarksAdd.qml PageBookmarks.qml PageNavigation.qml PageRoute.qml PageSearch.qml PageSearchSelector.qml PageSettingsDisplay.qml PageSettingsLocale.qml PageSettings.qml PageSettingsRules.qml PageSettingsTools.qml PageSettingsVehicle.qml PagePoi.qml
+qml_DATA = ButtonIcon.qml ToggleSwitch.qml ToggleButton.qml ListSelector.qml ListSelectorXml.qml Slider.qml Cellar.qml main.qml point.qml command.qml PageAbout.qml PageBookmarksAdd.qml PageBookmarks.qml PageNavigation.qml PageRoute.qml PageSearch.qml PageSearchSelector.qml PageSettingsDisplay.qml PageSettingsLocale.qml PageSettings.qml PageSettingsRules.qml PageSettingsTools.qml PageSettingsVehicle.qml PagePoi.qml
qml_DATA += background.svg knob.svg
do_button_subst = sed -e 's,matchProperties,properties,g' \
anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
spacing: gui.width/12
ButtonIcon {
- id: btnPoi; text: "POIs near\nPosition"; icon: "attraction.svg"; onClicked: console.log("Implement me!");
+ id: btnPoi; text: "POIs near\nPosition"; icon: "attraction.svg"; onClicked: gui.setPage("PagePoi.qml");
opacity: 0;
}
ButtonIcon {
--- /dev/null
+import Qt 4.6
+
+Rectangle {
+ id: page
+
+ width: gui.width; height: gui.height
+ color: "Black"
+ opacity: 0
+
+ function bookmarkClick(itemId,itemIcon,itemName,itemPath) {
+ if ( itemIcon=="yes" ) {
+ bookmarks.currentPath=itemPath;
+ bookmarks.getAttrList("");
+ } else {
+ bookmarks.setPoint(itemId);
+ gui.setPage("point.qml");
+ }
+ }
+
+ function pageOpen() {
+ page.opacity = 1;
+ }
+
+ Component.onCompleted: pageOpen();
+
+ opacity: Behavior {
+ NumberAnimation { id: opacityAnimation; duration: 300; alwaysRunToEnd: true }
+ }
+
+ Text {
+ id: labelTxt; text: "Points of interest"; color: "White"; font.pointSize: 14;
+ anchors.horizontalCenter: page.horizontalCenter
+ anchors.top: page.top
+ }
+
+ VisualItemModel {
+ id: selectorsModel
+
+ ToggleButton { id: bankBtn; text: "Bank"; icon: "bank.svg";stOn: "true"; }
+ ToggleButton { id: fuelBtn; text: "Fuel"; icon: "fuel.svg";stOn: "true"; }
+ ToggleButton { id: hotelBtn; text: "Hotel"; icon: "bar.svg";stOn: "true"; }
+ ToggleButton { id: foodBtn; text: "Food"; icon: "fastfood.svg";stOn: "true"; }
+ ToggleButton { id: shopBtn; text: "Shop"; icon: "shopping.svg";stOn: "true"; }
+ ToggleButton { id: serviceBtn; text: "Service"; icon: "hospital.svg";stOn: "true"; }
+ ToggleButton { id: parkingBtn; text: "Parking"; icon: "police.svg";stOn: "true"; }
+ ToggleButton { id: landBtn; text: "Land features"; icon: "peak.svg";stOn: "true"; }
+ }
+
+ ListView {
+ id: selectorsList; model: selectorsModel
+ focus: true; clip: true; orientation: Qt.Horizontal
+ anchors.horizontalCenter: page.horizontalCenter; anchors.top: labelTxt.bottom
+ width: page.width; height: bankBtn.height*2
+ }
+
+ Slider {
+ id: distanceSlider; minValue: 1; maxValue: 250; value: gui.getAttr("radius"); text: "Distance"; onChanged: { gui.setAttr("radius",distanceSlider.value); point.getAttrList("points"); }
+ anchors.top: selectorsList.bottom; anchors.horizontalCenter: page.horizontalCenter;
+ }
+
+ ListSelector {
+ id:layoutList; text: ""; itemId: point.getAttrList("points"); onChanged: console.log("Poi clicked");
+ anchors.top: distanceSlider.bottom;
+ anchors.left: parent.left; anchors.leftMargin: 3
+ anchors.topMargin: gui.height/16; anchors.leftMargin: gui.width/32
+ width: page.width; height: page.height*0.25
+ }
+
+ Cellar {id: cellar; anchors.bottom: page.bottom; anchors.horizontalCenter: page.horizontalCenter; width: page.width }
+}
id: btnSearch; text: "Search"; icon: "gui_town.svg"; onClicked: gui.setPage("PageSearch.qml");\r
}\r
ButtonIcon {\r
- id: btnPoi; text: "POIs near\nDestination"; icon: "attraction.svg"; onClicked: console.log("Implement me!");\r
+ id: btnPoi; text: "POIs near\nDestination"; icon: "attraction.svg"; onClicked: gui.setPage("PagePoi.qml");\r
opacity: 0;\r
}\r
}\r
anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
spacing: gui.width/12
ButtonIcon {
- id: btnQuit; text: "Nearest\nPOIs"; icon: "attraction.svg"; onClicked: console.log("Implement me!");
+ id: btnQuit; text: "Nearest\nPOIs"; icon: "attraction.svg"; onClicked: gui.setPage("PagePoi.qml");
}
ButtonIcon {
id: btnBookmark; text: "Add as\na Bookmark"; icon: "gui_bookmark.svg"; onClicked: gui.setPage("PageBookmarksAdd.qml")