this->object->currentPoint = new NGQPoint(this->object,p,type,NULL);
this->object->guiWidget->rootContext()->setContextProperty("point",this->object->currentPoint);
}
+ void setNewPoint(struct coord* c,NGQPointTypes type) {
+ if (this->object->currentPoint!=NULL) {
+ delete this->object->currentPoint;
+ }
+ this->object->currentPoint = new NGQPoint(this->object,c,type,NULL);
+ this->object->guiWidget->rootContext()->setContextProperty("point",this->object->currentPoint);
+ }
void processCommand(QString function) {
this->function=function;
this->setPage("command.qml",true);
QString function;
};
+void __setNewPoint(struct gui_priv* this_,struct coord* c, NGQPointTypes type) {
+ this_->guiProxy->setNewPoint(c,type);
+}
+
#include "guiProxy.moc"
#endif /* NAVIT_GUI_QML_GUIPROXY_H */
#ifndef NAVIT_GUI_QML_NAVIT_H
#define NAVIT_GUI_QML_NAVIT_H
+void __setNewPoint(struct gui_priv* this_,struct coord* c, NGQPointTypes type);
+
class NGQProxyNavit : public NGQProxy {
Q_OBJECT;
return retId;
}
+ QString getDestination() {
+ struct attr attr;
+ struct coord c;
+
+ if (getAttrFunc(attr_destination, &attr, NULL) ) {
+ c.x=attr.u.pcoord->x;
+ c.y=attr.u.pcoord->y;
+ __setNewPoint(this->object,&c,MapPoint);
+ return this->object->currentPoint->pointName();
+ }
+ return QString();
+ }
void setDestination() {
navit_set_destination(this->object->nav,this->object->currentPoint->pc(),this->object->currentPoint->coordString().toStdString().c_str(),1);
}
+ QString getPosition() {
+ struct attr attr;
+ struct pcoord pc;
+ struct coord c;
+ struct transformation *trans;
+
+ trans=navit_get_trans(this->object->nav);
+
+ getAttrFunc(attr_vehicle, &attr, NULL);
+ this->object->currVehicle=attr.u.vehicle;
+
+ if (vehicle_get_attr(this->object->currVehicle, attr_position_coord_geo, &attr, NULL)) {
+ pc.pro=transform_get_projection(trans);
+ transform_from_geo(pc.pro, attr.u.coord_geo, &c);
+ __setNewPoint(this->object,&c,MapPoint);
+ return this->object->currentPoint->pointName();
+ }
+ return QString();
+ }
void setPosition() {
navit_set_position(this->object->nav,this->object->currentPoint->pc());
}
this->name=this->_coordName();
this->coord=this->_coordString();
}
+ NGQPoint(struct gui_priv* this_,struct coord* c,NGQPointTypes type=Bookmark,QObject *parent=NULL) : QObject(parent) {
+ this->object=this_;
+ this->co.x=c->x;
+ this->co.y=c->y;
+ transform_to_geo(transform_get_projection(navit_get_trans(this->object->nav)), &co, &g);
+ this->c.pro = transform_get_projection(navit_get_trans(this->object->nav));
+ this->c.x = c->x;
+ this->c.y = c->y;
+ this->type=type;
+
+ this->name=this->_coordName();
+ this->coord=this->_coordString();
+ }
+
NGQPoint(struct gui_priv* this_,struct coord* c,QString name,NGQPointTypes type=Bookmark,QObject *parent=NULL) : QObject(parent) {
this->object=this_;
this->co.x=c->x;
function pageOpen() {
page.opacity = 1;
+ if (navit.getDestination().length>0) {
+ btnPoi.opacity=0.8;
+ }
+
}
Component.onCompleted: pageOpen();
anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;
spacing: gui.width/12
ButtonIcon {
- id: btnQuit; text: "POIs"; icon: "attraction.svg"; onClicked: console.log("Implement me!");
+ id: btnPoi; text: "POIs near\nPosition"; icon: "attraction.svg"; onClicked: console.log("Implement me!");
+ opacity: 0;
}
ButtonIcon {
id: btnStop; text: "Stop"; icon: "gui_stop.svg"; onClicked: console.log("Implement me!");
\r
function pageOpen() {\r
page.opacity = 1;\r
+ if (navit.getPosition().length>0) {\r
+ btnPoi.opacity=0.8;\r
+ }\r
}\r
\r
Component.onCompleted: pageOpen(); \r
anchors.top: parent.verticalCenter; anchors.topMargin: gui.height/16;\r
spacing: gui.width/12\r
ButtonIcon {\r
- id: btnAbout; text: "Search"; icon: "gui_town.svg"; onClicked: gui.setPage("PageSearch.qml");\r
+ id: btnSearch; text: "Search"; icon: "gui_town.svg"; onClicked: gui.setPage("PageSearch.qml");\r
}\r
ButtonIcon {\r
- id: btnQuit; text: "POIs"; icon: "attraction.svg"; onClicked: console.log("Implement me!");\r
+ id: btnPoi; text: "POIs near\nDestination"; icon: "attraction.svg"; onClicked: console.log("Implement me!");\r
+ opacity: 0;\r
}\r
}\r
\r