From 55bd34e8a5735e0db5a9bba6b697d6ee3efb58ba Mon Sep 17 00:00:00 2001 From: grekiki Date: Thu, 10 Dec 2020 23:39:15 +0100 Subject: [PATCH] Dynamically colored alert widget. (#2717) blue background on update old-commit-hash: bffdfd5303879bd70416a2c998ca8a71f3bf674a --- selfdrive/ui/qt/home.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 0e4d9acc7c..bc402eec8c 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -99,7 +99,9 @@ void OffroadHome::refresh() { } alert_notification->setVisible(true); - alert_notification->setStyleSheet(QString(R"( + + // Red background for alerts, blue for update available + QString style = QString(R"( padding: 15px; padding-left: 30px; padding-right: 30px; @@ -108,7 +110,11 @@ void OffroadHome::refresh() { font-size: 40px; font-weight: bold; background-color: red; - )")); + )"); + if (alerts_widget->updateAvailable){ + style.replace("red", "blue"); + } + alert_notification->setStyleSheet(style); }