Refactor map helper includes for SunnyPilot

This update refactors the inclusion of map helper files in various source files for compatibility with SunnyPilot. This involves changes like replacing "#include selfdrive/ui/qt/maps/map_helpers.h" with "#include selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h". Added logging information in "sp_priv_onroad_home.cc" to debug the creation of map widgets. This refactoring is necessary to support map related functionalities in the SunnyPilot environment.
This commit is contained in:
DevTekVE
2024-07-23 09:54:30 +02:00
parent 09068fc34e
commit 223cfd2c34
7 changed files with 23 additions and 5 deletions
+4
View File
@@ -6,7 +6,11 @@
#include "common/util.h"
#include "selfdrive/ui/qt/util.h"
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h"
#else
#include "selfdrive/ui/qt/maps/map_helpers.h"
#endif
#include "selfdrive/navd/map_renderer.h"
#include "system/hardware/hw.h"
+2 -1
View File
@@ -6,11 +6,12 @@
#include <QDebug>
#include "common/swaglog.h"
#include "selfdrive/ui/qt/maps/map_helpers.h"
#include "selfdrive/ui/qt/util.h"
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/sp_priv_ui.h"
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h"
#else
#include "selfdrive/ui/qt/maps/map_helpers.h"
#include "selfdrive/ui/ui.h"
#endif
+2 -1
View File
@@ -3,11 +3,12 @@
#include <QDateTime>
#include <QPainter>
#include "selfdrive/ui/qt/maps/map_helpers.h"
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/sp_priv_ui.h"
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h"
#else
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/maps/map_helpers.h"
#endif
const float MANEUVER_TRANSITION_THRESHOLD = 10;
+4
View File
@@ -1,4 +1,8 @@
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h"
#else
#include "selfdrive/ui/qt/maps/map_helpers.h"
#endif
#include <algorithm>
#include <string>
+2 -1
View File
@@ -3,11 +3,12 @@
#include <QDir>
#include <QVBoxLayout>
#include "selfdrive/ui/qt/maps/map_helpers.h"
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/sp_priv_ui.h"
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h"
#else
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/maps/map_helpers.h"
#endif
const QString ICON_SUFFIX = ".png";
+2 -1
View File
@@ -3,13 +3,14 @@
#include <QHBoxLayout>
#include <QWidget>
#include "selfdrive/ui/qt/maps/map.h"
#include "selfdrive/ui/qt/maps/map_settings.h"
#include "selfdrive/ui/qt/util.h"
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/sp_priv_ui.h"
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map.h"
#else
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/maps/map.h"
#endif
MapPanel::MapPanel(const QMapLibre::Settings &mapboxSettings, QWidget *parent) : QFrame(parent) {
@@ -4,13 +4,15 @@
#include <QStackedLayout>
#ifdef ENABLE_MAPS
#include "selfdrive/ui/qt/maps/map_helpers.h"
#include "selfdrive/ui/sunnypilot/qt/maps/sp_priv_map_helpers.h"
#include "selfdrive/ui/qt/maps/map_panel.h"
#endif
#ifdef SUNNYPILOT
#include "selfdrive/ui/sunnypilot/qt/onroad/sp_priv_onroad_settings_panel.h"
#endif
#include <common/swaglog.h>
#include "selfdrive/ui/qt/util.h"
OnroadWindowSP::OnroadWindowSP(QWidget *parent) : OnroadWindow(parent) {
// QObject::disconnect(uiState(), &UIState::uiUpdate, this, &OnroadWindow::updateState);
@@ -64,6 +66,7 @@ void OnroadWindowSP::mousePressEvent(QMouseEvent* e) {
void OnroadWindowSP::createMapWidget() {
#ifdef ENABLE_MAPS
LOGD("Creating map widget");
auto m = new MapPanel(get_mapbox_settings());
map = m;
@@ -101,9 +104,12 @@ void OnroadWindowSP::offroadTransition(bool offroad) {
if (!offroad) {
#ifdef ENABLE_MAPS
LOGD("We'd like to create the map widget, the condition is map is [%s] and hasPrime is [%s] and MAPBOX_TOKEN is [%s]", map == nullptr ? "null" : "not null", uiStateSP()->hasPrime() ? "true" : "false", MAPBOX_TOKEN.isEmpty() ? "empty" : "not empty");
if (map == nullptr && (uiStateSP()->hasPrime() || !MAPBOX_TOKEN.isEmpty())) {
createMapWidget();
}
#else
LOGD("Maps are disabled");
#endif
if (onroad_settings == nullptr) {
createOnroadSettingsWidget();