mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-21 16:13:47 +08:00
dcd56ae09a
* store/send mic audio with toggle * script to extract audio from logs * change description and add translation placeholders * microphone icon * apply toggle in loggerd * add legnth and counter * startFrameIdx counter * Revert "change description and add translation placeholders" This reverts commit 7baa1f6de99c6ebe9f9906193da7e83dad79511a. * send mic data first and then calc * restore changed description/icon after revert * adjust fft samples to keep old time window * remove extract_audio.py since audio is now stored in qcam isntead of rlog * qt microphone recording icon * Revert "remove extract_audio.py since audio is now stored in qcam isntead of rlog" This reverts commit 7a3a75bd8db5376d1e442a3ba931c67550b5f132. * move extract_audio script and output file by default * remove length field * recording indicator swaps sides based on lhd/rhd * use record icon from comma body * Update toggle description Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * update raylib toggle desc cause I did earlier * microphone --> soundPressure, audioData --> rawAudioData * cleanup unused var * update README * sidebar mic indicator instead of annotated camera * improve logic readability * remove startFrameIdx and sequenceNum * use Q_PROPERTY/setProperty so that update() is actually called on value change * specify old id for SoundPressure * fix typo --------- Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
67 lines
2.3 KiB
C++
67 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
|
|
#include <QFrame>
|
|
#include <QMap>
|
|
|
|
#include "selfdrive/ui/ui.h"
|
|
#include "selfdrive/ui/qt/network/networking.h"
|
|
|
|
typedef QPair<QPair<QString, QString>, QColor> ItemStatus;
|
|
Q_DECLARE_METATYPE(ItemStatus);
|
|
|
|
class Sidebar : public QFrame {
|
|
Q_OBJECT
|
|
Q_PROPERTY(ItemStatus connectStatus MEMBER connect_status NOTIFY valueChanged);
|
|
Q_PROPERTY(ItemStatus pandaStatus MEMBER panda_status NOTIFY valueChanged);
|
|
Q_PROPERTY(ItemStatus tempStatus MEMBER temp_status NOTIFY valueChanged);
|
|
Q_PROPERTY(QString netType MEMBER net_type NOTIFY valueChanged);
|
|
Q_PROPERTY(int netStrength MEMBER net_strength NOTIFY valueChanged);
|
|
Q_PROPERTY(bool recordingAudio MEMBER recording_audio NOTIFY valueChanged);
|
|
|
|
public:
|
|
explicit Sidebar(QWidget* parent = 0);
|
|
|
|
signals:
|
|
void openSettings(int index = 0, const QString ¶m = "");
|
|
void valueChanged();
|
|
|
|
public slots:
|
|
void offroadTransition(bool offroad);
|
|
void updateState(const UIState &s);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
void mousePressEvent(QMouseEvent *event) override;
|
|
void mouseReleaseEvent(QMouseEvent *event) override;
|
|
void drawMetric(QPainter &p, const QPair<QString, QString> &label, QColor c, int y);
|
|
|
|
QPixmap home_img, flag_img, settings_img, mic_img;
|
|
bool onroad, recording_audio, flag_pressed, settings_pressed, mic_indicator_pressed;
|
|
const QMap<cereal::DeviceState::NetworkType, QString> network_type = {
|
|
{cereal::DeviceState::NetworkType::NONE, tr("--")},
|
|
{cereal::DeviceState::NetworkType::WIFI, tr("Wi-Fi")},
|
|
{cereal::DeviceState::NetworkType::ETHERNET, tr("ETH")},
|
|
{cereal::DeviceState::NetworkType::CELL2_G, tr("2G")},
|
|
{cereal::DeviceState::NetworkType::CELL3_G, tr("3G")},
|
|
{cereal::DeviceState::NetworkType::CELL4_G, tr("LTE")},
|
|
{cereal::DeviceState::NetworkType::CELL5_G, tr("5G")}
|
|
};
|
|
|
|
const QRect home_btn = QRect(60, 860, 180, 180);
|
|
const QRect settings_btn = QRect(50, 35, 200, 117);
|
|
const QRect mic_indicator_btn = QRect(158, 252, 75, 40);
|
|
const QColor good_color = QColor(255, 255, 255);
|
|
const QColor warning_color = QColor(218, 202, 37);
|
|
const QColor danger_color = QColor(201, 34, 49);
|
|
|
|
ItemStatus connect_status, panda_status, temp_status;
|
|
QString net_type;
|
|
int net_strength = 0;
|
|
|
|
private:
|
|
std::unique_ptr<PubMaster> pm;
|
|
Networking *networking = nullptr;
|
|
};
|