mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-23 06:52:07 +08:00
fix sidebar network type and signal
This commit is contained in:
@@ -54,8 +54,8 @@ void Sidebar::updateState(const UIState &s) {
|
||||
auto &sm = *(s.sm);
|
||||
|
||||
auto deviceState = sm["deviceState"].getDeviceState();
|
||||
setProperty("netType", (int)deviceState.getNetworkType());
|
||||
setProperty("netStrength", (int)deviceState.getNetworkStrength());
|
||||
setProperty("netType", network_type[deviceState.getNetworkType()]);
|
||||
setProperty("netStrength", signal_imgs[deviceState.getNetworkStrength()]);
|
||||
|
||||
auto last_ping = deviceState.getLastAthenaPingTime();
|
||||
if (last_ping == 0) {
|
||||
@@ -102,11 +102,11 @@ void Sidebar::paintEvent(QPaintEvent *event) {
|
||||
p.drawImage(60, 1080 - 180 - 40, home_img);
|
||||
|
||||
// network
|
||||
p.drawImage(58, 196, signal_imgs[net_strength]);
|
||||
p.drawImage(58, 196, net_strength);
|
||||
configFont(p, "Open Sans", 35, "Regular");
|
||||
p.setPen(QColor(0xff, 0xff, 0xff));
|
||||
const QRect r = QRect(50, 247, 100, 50);
|
||||
p.drawText(r, Qt::AlignCenter, network_type[net_type]);
|
||||
p.drawText(r, Qt::AlignCenter, net_type);
|
||||
|
||||
// metrics
|
||||
drawMetric(p, "TEMP", QString("%1°C").arg(temp_val), temp_status, 338);
|
||||
|
||||
@@ -12,8 +12,8 @@ class Sidebar : public QFrame {
|
||||
Q_PROPERTY(QColor pandaStatus MEMBER panda_status NOTIFY valueChanged);
|
||||
Q_PROPERTY(int tempVal MEMBER temp_val NOTIFY valueChanged);
|
||||
Q_PROPERTY(QColor tempStatus MEMBER temp_status NOTIFY valueChanged);
|
||||
Q_PROPERTY(cereal::DeviceState::NetworkType netType MEMBER net_type NOTIFY valueChanged);
|
||||
Q_PROPERTY(cereal::DeviceState::NetworkStrength netStrength MEMBER net_strength NOTIFY valueChanged);
|
||||
Q_PROPERTY(QString netType MEMBER net_type NOTIFY valueChanged);
|
||||
Q_PROPERTY(QImage netStrength MEMBER net_strength NOTIFY valueChanged);
|
||||
|
||||
public:
|
||||
explicit Sidebar(QWidget* parent = 0);
|
||||
@@ -60,6 +60,6 @@ private:
|
||||
QColor panda_status = warning_color;
|
||||
int temp_val = 0;
|
||||
QColor temp_status = warning_color;
|
||||
cereal::DeviceState::NetworkType net_type;
|
||||
cereal::DeviceState::NetworkStrength net_strength;
|
||||
QString net_type;
|
||||
QImage net_strength;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user