|
|
|
@ -17,15 +17,16 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q |
|
|
|
|
QObject::connect(device(), &Device::interactiveTimeout, [=]() { |
|
|
|
|
content_stack->setCurrentIndex(0); |
|
|
|
|
}); |
|
|
|
|
QObject::connect(map, &MapWindow::requestVisible, [=](bool visible) { |
|
|
|
|
// when we show the map for a new route, signal HomeWindow to hide the sidebar
|
|
|
|
|
if (visible) { emit mapPanelRequested(); } |
|
|
|
|
setVisible(visible); |
|
|
|
|
}); |
|
|
|
|
// QObject::connect(map, &MapWindow::requestSettings, this, &MapPanel::requestMapSettings);
|
|
|
|
|
QObject::connect(map, &MapWindow::requestSettings, [=](bool settings) { |
|
|
|
|
content_stack->setCurrentIndex(settings ? 1 : 0); |
|
|
|
|
}); |
|
|
|
|
QObject::connect(map, &MapWindow::requestVisible, this, &MapPanel::requestVisible); |
|
|
|
|
// QObject::connect(map, &MapWindow::requestVisible, [=](bool visible) {
|
|
|
|
|
// // when we show the map for a new route, signal HomeWindow to hide the sidebar
|
|
|
|
|
// if (visible) { emit mapPanelRequested(); }
|
|
|
|
|
// setVisible(visible);
|
|
|
|
|
// });
|
|
|
|
|
QObject::connect(map, &MapWindow::requestSettings, this, &MapPanel::requestMapSettings); |
|
|
|
|
// QObject::connect(map, &MapWindow::requestSettings, [=](bool settings) {
|
|
|
|
|
// content_stack->setCurrentIndex(settings ? 1 : 0);
|
|
|
|
|
// });
|
|
|
|
|
content_stack->addWidget(map); |
|
|
|
|
|
|
|
|
|
auto settings = new MapSettings(true, parent); |
|
|
|
@ -35,14 +36,30 @@ MapPanel::MapPanel(const QMapboxGLSettings &mapboxSettings, QWidget *parent) : Q |
|
|
|
|
content_stack->addWidget(settings); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MapPanel::requestVisible(bool visible) { |
|
|
|
|
if (visible != isVisible()) { |
|
|
|
|
// signal HomeWindow to hide the sidebar and switch to map window if showing
|
|
|
|
|
// TODO: perhaps showEvent is better
|
|
|
|
|
if (visible) { |
|
|
|
|
emit mapPanelRequested(); |
|
|
|
|
content_stack->setCurrentIndex(0); |
|
|
|
|
} |
|
|
|
|
setVisible(visible); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MapPanel::toggleMapSettings() { |
|
|
|
|
emit mapPanelRequested(); |
|
|
|
|
setVisible(true); |
|
|
|
|
requestVisible(true); |
|
|
|
|
// if (!isVisible()) {
|
|
|
|
|
// emit mapPanelRequested(); qDebug() << "emit mapPanelRequested()";
|
|
|
|
|
// setVisible(true);
|
|
|
|
|
// }
|
|
|
|
|
content_stack->setCurrentIndex((content_stack->currentIndex() + 1) % 2); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void MapPanel::requestMapSettings(bool settings) { // TODO rename requestMapSettings
|
|
|
|
|
emit mapPanelRequested(); |
|
|
|
|
setVisible(true); |
|
|
|
|
content_stack->setCurrentIndex(1); |
|
|
|
|
void MapPanel::requestMapSettings(bool settings) { |
|
|
|
|
content_stack->setCurrentIndex(settings ? 1 : 0); |
|
|
|
|
// emit mapPanelRequested();
|
|
|
|
|
// setVisible(true);
|
|
|
|
|
// content_stack->setCurrentIndex(1);
|
|
|
|
|
} |
|
|
|
|