Files
dragonpilot/selfdrive/ui/qt/maps/map.h
Shane Smiskol 57d64279bd ui: re-generate JWT on valid system time (#32571)
* revert me

* Revert "revert me"

This reverts commit 17d815ddfc9a18f7fb9f39f89ec8b4481389b339.

* duh we have timed!

* clean up

* use clocks

* re-initialize map on SSL handshake failure (time)

* this is fine, takes some time to init

* fix

* log errors like map renderer

* more clean up

full message is "loading style failed: SSL handshake failed"

* MOAR

* we still can't swap the token live

* mbgl has its own retries that never work, don't reinit multiple times at once

* simpler

* more

* whoops

* this works

* fix from merge

* rm

* fix cmt

* only an issue calling the function inside itself
2024-05-30 02:08:31 -07:00

87 lines
2.0 KiB
C++

#pragma once
#include <optional>
#include <QGeoCoordinate>
#include <QGestureEvent>
#include <QLabel>
#include <QMap>
#include <QMapLibre/Map>
#include <QMapLibre/Settings>
#include <QMouseEvent>
#include <QOpenGLWidget>
#include <QPixmap>
#include <QPushButton>
#include <QScopedPointer>
#include <QString>
#include <QVBoxLayout>
#include <QWheelEvent>
#include "cereal/messaging/messaging.h"
#include "common/params.h"
#include "common/util.h"
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/maps/map_eta.h"
#include "selfdrive/ui/qt/maps/map_instructions.h"
class MapWindow : public QOpenGLWidget {
Q_OBJECT
public:
MapWindow(const QMapLibre::Settings &);
~MapWindow();
private:
void initializeGL() final;
void paintGL() final;
void resizeGL(int w, int h) override;
QMapLibre::Settings m_settings;
QScopedPointer<QMapLibre::Map> m_map;
void initLayers();
void mousePressEvent(QMouseEvent *ev) final;
void mouseDoubleClickEvent(QMouseEvent *ev) final;
void mouseMoveEvent(QMouseEvent *ev) final;
void wheelEvent(QWheelEvent *ev) final;
bool event(QEvent *event) final;
bool gestureEvent(QGestureEvent *event);
void pinchTriggered(QPinchGesture *gesture);
void setError(const QString &err_str);
bool loaded_once = false;
bool prev_time_valid = true;
// Panning
QPointF m_lastPos;
int interaction_counter = 0;
// Position
std::optional<QMapLibre::Coordinate> last_valid_nav_dest;
std::optional<QMapLibre::Coordinate> last_position;
std::optional<float> last_bearing;
FirstOrderFilter velocity_filter;
bool locationd_valid = false;
bool routing_problem = false;
QWidget *map_overlay;
QLabel *error;
MapInstructions* map_instructions;
MapETA* map_eta;
void clearRoute();
void updateDestinationMarker();
uint64_t route_rcv_frame = 0;
private slots:
void updateState(const UIState &s);
public slots:
void offroadTransition(bool offroad);
signals:
void requestVisible(bool visible);
void requestSettings(bool settings);
};