Files
sunnypilot/selfdrive/ui/qt/maps/map.h
Shane Smiskol 0dd1dcc7d0 ui: new nav settings button (#29068)
* add image

* remove extra spacing

* add images

* use nav-settings-square-smaller.png

* draft

* clean up

* kinda works!

* nop need to update state

* can just use clicked

* MORE

* remove old button

* slightly smaller (todo change image))

* this works but is ugly

* remove old settings button

* draft

* no it's not

* draft 2.0

* clean up

* clean up

* let's make map_settings_btn public

* since we don't have map, use enabled

* fix image size

* can do clean up in another PR

show

* add line

* rename

* useless spacing

* use old nav icon

* handle DM icon (and test)

* clean up

* no reason

* remove old image

* don't use setCurrentIndex

* Revert "don't use setCurrentIndex"

This reverts commit 6fde765a3cd3a9ee39205614587a23fbfbc60950.

* also can use a ternary

* seems cleanest

This reverts commit f9287230704b94f46b6bb5376d9a17075a20caf7.
2023-07-24 22:27:01 -07:00

91 lines
2.1 KiB
C++

#pragma once
#include <optional>
#include <QGeoCoordinate>
#include <QGestureEvent>
#include <QLabel>
#include <QMap>
#include <QMapboxGL>
#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 QMapboxGLSettings &);
~MapWindow();
private:
void initializeGL() final;
void paintGL() final;
void resizeGL(int w, int h) override;
QMapboxGLSettings m_settings;
QScopedPointer<QMapboxGL> 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 allow_open = true;
// Panning
QPointF m_lastPos;
int pan_counter = 0;
int zoom_counter = 0;
// Position
std::optional<QMapbox::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;
// Blue with normal nav, green when nav is input into the model
QColor getNavPathColor(bool nav_enabled) {
return nav_enabled ? QColor("#31ee73") : QColor("#31a1ee");
}
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);
};