char* icon_src;
int radius;
int pitch;
+ int lazy; //When TRUE - menu state will not be changed during map/menu switches, FALSE - menu will be always reseted to main.qml
//Interface stuff
struct callback_list *cbl;
public:
NGQProxyGui(struct gui_priv* this_,QObject *parent) : NGQProxy(this_, parent) {
- this->source=QString("NoReturnTicket");
+ this->source=QString("");
}
public slots:
void setPage(QString page) {
+ dbg(0,"Page is: %s\n",page.toStdString().c_str());
+ this->source+="/"+page;
this->object->guiWidget->setUrl(QUrl::fromLocalFile(QString(this->object->source)+"/"+this->object->skin+"/"+page));
this->object->guiWidget->execute();
this->object->guiWidget->show();
- dbg(0,"Page is: %s\n",page.toStdString().c_str());
}
void backToMap() {
if (this->object->graphicsWidget) {
this->object->switcherWidget->setCurrentWidget(this->object->graphicsWidget);
}
}
+ void backToPrevPage() {
+ QStringList returnList=this->source.split(QString("/"), QString::SkipEmptyParts);
+ QString returnPage;
+ if (returnList.size()>1) {
+ returnList.takeLast();//Remove current element
+ returnPage=returnList.takeLast(); //Set previous element as return page and remove it from the list
+ }
+ this->source=returnList.join(QString("/"));
+ this->source.prepend(QString("/"));
+ this->setPage(returnPage);
+ }
//Properties
QString iconPath() {
}
if ( button == 1 && this_->menu_on_map_click ) {
+ if (!this_->lazy) {
+ this_->guiProxy->setReturnSource(QString(""));
+ this_->guiProxy->setPage("main.qml");
+ }
+ this_->switcherWidget->setCurrentWidget(this_->guiWidget);
+ }
+ /* There is a special 'popup' feature in navit, that makes all 'click-on-point' related stuff
+ but it looks VERY unflexible, so i'm not able to use it. I believe we need
+ to re-design the popup feature or remove it at all */
+ if ( button == 3 && this_->menu_on_map_click ) {
this_->switcherWidget->setCurrentWidget(this_->guiWidget);
}
}
{
struct window *win;
struct transformation *trans=navit_get_trans(this_->nav);
- struct QmlView *view;
this_->gra=gra;
this_->mainWindow->setCentralWidget(this_->switcherWidget);
//Create gui widget
- view = new QmlView(NULL);
- this_->guiWidget = view;
+ this_->guiWidget = new QmlView(NULL);
//Create proxy object and bind them to gui widget
this_->guiProxy = new NGQProxyGui(this_,this_->mainWindow);
- view->rootContext()->setContextProperty("gui",this_->guiProxy);
+ this_->guiWidget->rootContext()->setContextProperty("gui",this_->guiProxy);
this_->navitProxy = new NGQProxyNavit(this_,this_->mainWindow);
- view->rootContext()->setContextProperty("navit",this_->navitProxy);
+ this_->guiWidget->rootContext()->setContextProperty("navit",this_->navitProxy);
this_->vehicleProxy = new NGQProxyVehicle(this_,this_->mainWindow);
- view->rootContext()->setContextProperty("vehicle",this_->vehicleProxy);
+ this_->guiWidget->rootContext()->setContextProperty("vehicle",this_->vehicleProxy);
//Check, if we have compatible graphics
this_->graphicsWidget = (QWidget*)graphics_get_data(gra,"qt_widget");
this_->pitch = 20; //Default value
if( (attr=attr_search(attrs,NULL,attr_pitch)))
this_->pitch=attr->u.num;
+ this_->lazy = 1; //YES by default
+ if( (attr=attr_search(attrs,NULL,attr_lazy)))
+ this_->lazy=attr->u.num;
if( (attr=attr_search(attrs,NULL,attr_width)))
this_->w=attr->u.num;
if( (attr=attr_search(attrs,NULL,attr_height)))
Rectangle {
- function hideButtons() {
- if ( gui.returnSource=="main.qml" ) {
+ function hideButtons() {
+ if ( gui.returnSource.split('/').length < 4 ) {
btnBack.opacity=0;
}
- if ( gui.returnSource == "NoReturnTicket" ) {
+ if ( gui.returnSource == "/main.qml" ) {
btnHome.opacity=0;
btnBack.opacity=0;
}
}
ButtonIcon {
- id: btnHome; icon: "gui_home.svg"; text: "Home"; onClicked: gui.setPage("main.qml");
+ id: btnHome; icon: "gui_home.svg"; text: "Home"; onClicked: { gui.returnSource=""; gui.setPage("main.qml"); }
anchors.horizontalCenter: parent.horizontalCenter; anchors.leftMargin: 3
anchors.bottom: parent.bottom; anchors.bottomMargin: 3
}
ButtonIcon {
- id: btnBack; icon: "gui_arrow_left.svg"; text: "Back"; onClicked: gui.setPage(gui.returnSource);
+ id: btnBack; icon: "gui_arrow_left.svg"; text: "Back"; onClicked: gui.backToPrevPage();
anchors.right: parent.right; anchors.leftMargin: 3
anchors.bottom: parent.bottom; anchors.bottomMargin: 3
}
anchors.bottom: parent.verticalCenter; anchors.bottomMargin: 48;\r
spacing: 64\r
ButtonIcon {\r
- id: btnDisplay; text: "Display"; icon: "gui_display.svg"; onClicked: { gui.returnSource="PageSettings.qml"; gui.setPage("PageSettingsDisplay.qml") }\r
+ id: btnDisplay; text: "Display"; icon: "gui_display.svg"; onClicked: gui.setPage("PageSettingsDisplay.qml")
}\r
ButtonIcon {\r
- id: btnMap; text: "Map"; icon: "gui_maps.svg"; onClicked: console.log("Implement me!");\r
+ id: btnMap; text: "Map"; icon: "gui_maps.svg"; onClicked: console.log("Implement me!");
}\r
ButtonIcon {\r
- id: btnVehicle; text: "Vehicle"; icon: "gui_vehicle.svg"; onClicked: { gui.returnSource="PageSettings.qml"; gui.setPage("PageSettingsVehicle.qml") }
+ id: btnVehicle; text: "Vehicle"; icon: "gui_vehicle.svg"; onClicked: gui.setPage("PageSettingsVehicle.qml")
}\r
}\r
Grid {\r
anchors.top: parent.verticalCenter; anchors.topMargin: 48;\r
spacing: 64\r
ButtonIcon {\r
- id: btnRules; text: "Rules"; icon: "gui_rules.svg"; onClicked: { gui.returnSource="PageSettings.qml";gui.setPage("PageSettingsRules.qml") }\r
+ id: btnRules; text: "Rules"; icon: "gui_rules.svg"; onClicked: gui.setPage("PageSettingsRules.qml")
}\r
ButtonIcon {\r
- id: btnTools; text: "Tools"; icon: "gui_tools.svg"; onClicked: { gui.returnSource="PageSettings.qml";gui.setPage("PageSettingsTools.qml") }\r
+ id: btnTools; text: "Tools"; icon: "gui_tools.svg"; onClicked: gui.setPage("PageSettingsTools.qml")
}\r
}\r
\r
opacity: 0\r
\r
function pageOpen() {\r
- gui.returnSource="NoReturnTicket";\r
page.opacity = 1;\r
}\r
\r
anchors.bottom: parent.verticalCenter; anchors.bottomMargin: 48;\r
spacing: 64\r
ButtonIcon {\r
- id: btnRoute; text: "Route"; icon: "cursor.svg"; onClicked: { gui.returnSource="main.qml";gui.setPage("PageRoute.qml") }\r
+ id: btnRoute; text: "Route"; icon: "cursor.svg"; onClicked: gui.setPage("PageRoute.qml")\r
}\r
ButtonIcon {\r
- id: btnNavigation; text: "Navigation"; icon: "nav_destination_wh.svg"; onClicked: { gui.returnSource="main.qml";gui.setPage("PageNavigation.qml") }\r
+ id: btnNavigation; text: "Navigation"; icon: "nav_destination_wh.svg"; onClicked: gui.setPage("PageNavigation.qml")\r
}\r
ButtonIcon {\r
- id: btnSettings; text: "Settings"; icon: "gui_settings.svg"; onClicked: { gui.returnSource="main.qml";gui.setPage("PageSettings.qml") }\r
+ id: btnSettings; text: "Settings"; icon: "gui_settings.svg"; onClicked: gui.setPage("PageSettings.qml")\r
}\r
}\r
\r
anchors.top: parent.verticalCenter; anchors.topMargin: 48;\r
spacing: 64\r
ButtonIcon {\r
- id: btnAbout; text: "About"; icon: "gui_about.svg"; onClicked: { gui.returnSource="main.qml";gui.setPage("PageAbout.qml") }\r
+ id: btnAbout; text: "About"; icon: "gui_about.svg"; onClicked: gui.setPage("PageAbout.qml") \r
}\r
ButtonIcon {\r
id: btnQuit; text: "Quit"; icon: "gui_quit.svg"; onClicked: navit.quit();\r