diff --git a/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/qt/sidebar.cc index 57cf40f..1d02904 100755 --- a/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/qt/sidebar.cc @@ -28,7 +28,7 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed( home_img = loadPixmap("../assets/images/button_home.png", home_btn.size()); flag_img = loadPixmap("../assets/images/button_flag.png", home_btn.size()); settings_img = loadPixmap("../assets/images/button_settings.png", settings_btn.size(), Qt::IgnoreAspectRatio); - currentColors = QColor(255, 255, 255); + currentColor = QColor(255, 255, 255); connect(this, &Sidebar::valueChanged, [=] { update(); }); @@ -129,7 +129,7 @@ void Sidebar::mouseReleaseEvent(QMouseEvent *event) { } else if (settings_btn.contains(event->pos())) { emit openSettings(); - + } } @@ -148,19 +148,6 @@ void Sidebar::updateState(const UIState &s) { int strength = (int)deviceState.getNetworkStrength(); setProperty("netStrength", strength > 0 ? strength + 1 : 0); - // FrogPilot properties - if (scene.current_holiday_theme != 0) { - home_img = holiday_home_imgs[scene.current_holiday_theme]; - flag_img = holiday_flag_imgs[scene.current_holiday_theme]; - settings_img = holiday_settings_imgs[scene.current_holiday_theme]; - currentColors = holidayThemeConfiguration[scene.current_holiday_theme].second; - } else { - home_img = home_imgs[scene.custom_icons]; - flag_img = flag_imgs[scene.custom_icons]; - settings_img = settings_imgs[scene.custom_icons]; - currentColors = themeConfiguration[scene.custom_colors].second; - } - auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState(); bool isNumericalTemp = scene.numerical_temp; @@ -180,7 +167,7 @@ void Sidebar::updateState(const UIState &s) { QString metric = isGPU ? gpu : cpu; int usage = isGPU ? gpu_usage : cpu_usage; - ItemStatus cpuStatus = {{isGPU ? tr("GPU") : tr("CPU"), metric}, currentColors[0]}; + ItemStatus cpuStatus = {{isGPU ? tr("GPU") : tr("CPU"), metric}, currentColor}; if (usage >= 85) { cpuStatus = {{isGPU ? tr("GPU") : tr("CPU"), metric}, danger_color}; } else if (usage >= 70) { @@ -198,7 +185,7 @@ void Sidebar::updateState(const UIState &s) { QString storage = QString::number(isStorageLeft ? storage_left : storage_used) + tr(" GB"); if (isMemoryUsage) { - ItemStatus memoryStatus = {{tr("MEMORY"), memory}, currentColors[0]}; + ItemStatus memoryStatus = {{tr("MEMORY"), memory}, currentColor}; if (memory_usage >= 85) { memoryStatus = {{tr("MEMORY"), memory}, danger_color}; } else if (memory_usage >= 70) { @@ -206,7 +193,7 @@ void Sidebar::updateState(const UIState &s) { } setProperty("memoryStatus", QVariant::fromValue(memoryStatus)); } else { - ItemStatus storageStatus = {{isStorageLeft ? tr("LEFT") : tr("USED"), storage}, currentColors[0]}; + ItemStatus storageStatus = {{isStorageLeft ? tr("LEFT") : tr("USED"), storage}, currentColor}; if (25 > storage_left && storage_left >= 10) { storageStatus = {{isStorageLeft ? tr("LEFT") : tr("USED"), storage}, warning_color}; } else if (10 > storage_left) { @@ -222,7 +209,7 @@ void Sidebar::updateState(const UIState &s) { connectStatus = ItemStatus{{tr("CONNECT"), tr("OFFLINE")}, warning_color}; } else { connectStatus = nanos_since_boot() - last_ping < 80e9 - ? ItemStatus{{tr("CONNECT"), tr("ONLINE")}, currentColors[0]} + ? ItemStatus{{tr("CONNECT"), tr("ONLINE")}, currentColor} : ItemStatus{{tr("CONNECT"), tr("ERROR")}, danger_color}; } setProperty("connectStatus", QVariant::fromValue(connectStatus)); @@ -230,13 +217,13 @@ void Sidebar::updateState(const UIState &s) { ItemStatus tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("HIGH")}, danger_color}; auto ts = deviceState.getThermalStatus(); if (ts == cereal::DeviceState::ThermalStatus::GREEN) { - tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("GOOD")}, currentColors[0]}; + tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("GOOD")}, currentColor}; } else if (ts == cereal::DeviceState::ThermalStatus::YELLOW) { tempStatus = {{tr("TEMP"), isNumericalTemp ? max_temp : tr("OK")}, warning_color}; } setProperty("tempStatus", QVariant::fromValue(tempStatus)); - ItemStatus pandaStatus = {{tr("VEHICLE"), tr("ONLINE")}, currentColors[0]}; + ItemStatus pandaStatus = {{tr("VEHICLE"), tr("ONLINE")}, currentColor}; if (s.scene.pandaType == cereal::PandaState::PandaType::UNKNOWN) { pandaStatus = {{tr("NO"), tr("PANDA")}, danger_color}; } else if (s.scene.started && !sm["liveLocationKalman"].getLiveLocationKalman().getGpsOK()) { diff --git a/selfdrive/ui/qt/sidebar.h b/selfdrive/ui/qt/sidebar.h index 3cb5110..cb3498e 100755 --- a/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/qt/sidebar.h @@ -89,5 +89,5 @@ private: std::unordered_map holiday_home_imgs; std::unordered_map holiday_settings_imgs; - std::vector currentColors; + QColor currentColor; };