From 214b3d7cd3a86003c924f9c07aaaa40712e7fa9a Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Thu, 9 May 2024 22:13:44 -0700 Subject: [PATCH] FrogPilot features - Cleaned up home screen UI --- selfdrive/ui/qt/home.cc | 6 +++++- selfdrive/ui/qt/home.h | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 46a4933..80c0318 100644 --- a/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/qt/home.cc @@ -133,6 +133,9 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) { QObject::connect(alert_notif, &QPushButton::clicked, [=] { center_layout->setCurrentIndex(2); }); header_layout->addWidget(alert_notif, 0, Qt::AlignHCenter | Qt::AlignLeft); + date = new ElidedLabel(); + header_layout->addWidget(date, 0, Qt::AlignHCenter | Qt::AlignLeft); + version = new ElidedLabel(); header_layout->addWidget(version, 0, Qt::AlignHCenter | Qt::AlignRight); @@ -227,7 +230,8 @@ void OffroadHome::hideEvent(QHideEvent *event) { } void OffroadHome::refresh() { - version->setText(getBrand() + " " + QString::fromStdString(params.get("UpdaterCurrentDescription"))); + date->setText(QLocale(uiState()->language.mid(5)).toString(QDateTime::currentDateTime(), "dddd, MMMM d")); + version->setText(getBrand() + " v" + getVersion().left(14).trimmed()); bool updateAvailable = update_widget->refresh(); int alerts = alerts_widget->refresh(); diff --git a/selfdrive/ui/qt/home.h b/selfdrive/ui/qt/home.h index 0790f05..13d97b0 100644 --- a/selfdrive/ui/qt/home.h +++ b/selfdrive/ui/qt/home.h @@ -39,6 +39,9 @@ private: OffroadAlert* alerts_widget; QPushButton* alert_notif; QPushButton* update_notif; + + // FrogPilot variables + ElidedLabel* date; }; class HomeWindow : public QWidget {