mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-11-03 00:53:44 +08:00
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:
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user