You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							89 lines
						
					
					
						
							2.3 KiB
						
					
					
				
			
		
		
	
	
							89 lines
						
					
					
						
							2.3 KiB
						
					
					
				| #pragma once
 | |
| 
 | |
| #include <map>
 | |
| #include <memory>
 | |
| #include <optional>
 | |
| #include <set>
 | |
| #include <utility>
 | |
| 
 | |
| #include <QHBoxLayout>
 | |
| #include <QFrame>
 | |
| #include <QSlider>
 | |
| #include <QTabBar>
 | |
| 
 | |
| #include "selfdrive/ui/qt/widgets/cameraview.h"
 | |
| #include "tools/cabana/utils/util.h"
 | |
| #include "tools/replay/logreader.h"
 | |
| 
 | |
| struct AlertInfo {
 | |
|   cereal::ControlsState::AlertStatus status;
 | |
|   QString text1;
 | |
|   QString text2;
 | |
| };
 | |
| 
 | |
| class InfoLabel : public QWidget {
 | |
| public:
 | |
|   InfoLabel(QWidget *parent);
 | |
|   void showPixmap(const QPoint &pt, const QString &sec, const QPixmap &pm, const AlertInfo &alert);
 | |
|   void showAlert(const AlertInfo &alert);
 | |
|   void paintEvent(QPaintEvent *event) override;
 | |
|   QPixmap pixmap;
 | |
|   QString second;
 | |
|   AlertInfo alert_info;
 | |
| };
 | |
| 
 | |
| class Slider : public QSlider {
 | |
|   Q_OBJECT
 | |
| 
 | |
| public:
 | |
|   Slider(QWidget *parent);
 | |
|   double currentSecond() const { return value() / factor; }
 | |
|   void setCurrentSecond(double sec) { setValue(sec * factor); }
 | |
|   void setTimeRange(double min, double max);
 | |
|   AlertInfo alertInfo(double sec);
 | |
|   QPixmap thumbnail(double sec);
 | |
|   void parseQLog(std::shared_ptr<LogReader> qlog);
 | |
| 
 | |
|   const double factor = 1000.0;
 | |
| 
 | |
| private:
 | |
|   void mousePressEvent(QMouseEvent *e) override;
 | |
|   void mouseMoveEvent(QMouseEvent *e) override;
 | |
|   bool event(QEvent *event) override;
 | |
|   void paintEvent(QPaintEvent *ev) override;
 | |
| 
 | |
|   QMap<uint64_t, QPixmap> thumbnails;
 | |
|   std::map<uint64_t, AlertInfo> alerts;
 | |
|   InfoLabel *thumbnail_label;
 | |
| };
 | |
| 
 | |
| class VideoWidget : public QFrame {
 | |
|   Q_OBJECT
 | |
| 
 | |
| public:
 | |
|   VideoWidget(QWidget *parnet = nullptr);
 | |
|   void setMaximumTime(double sec);
 | |
| 
 | |
| protected:
 | |
|   QString formatTime(double sec, bool include_milliseconds = false);
 | |
|   void timeRangeChanged(const std::optional<std::pair<double, double>> &time_range);
 | |
|   void updateState();
 | |
|   void updatePlayBtnState();
 | |
|   QWidget *createCameraWidget();
 | |
|   QHBoxLayout *createPlaybackController();
 | |
|   void loopPlaybackClicked();
 | |
|   void vipcAvailableStreamsUpdated(std::set<VisionStreamType> streams);
 | |
| 
 | |
|   CameraWidget *cam_widget;
 | |
|   double maximum_time = 0;
 | |
|   QToolButton *time_btn = nullptr;
 | |
|   ToolButton *seek_backward_btn = nullptr;
 | |
|   ToolButton *play_btn = nullptr;
 | |
|   ToolButton *seek_forward_btn = nullptr;
 | |
|   ToolButton *loop_btn = nullptr;
 | |
|   QToolButton *speed_btn = nullptr;
 | |
|   ToolButton *skip_to_end_btn = nullptr;
 | |
|   InfoLabel *alert_label = nullptr;
 | |
|   Slider *slider = nullptr;
 | |
|   QTabBar *camera_tab = nullptr;
 | |
| };
 | |
| 
 |