From 9dabfe9a6487f6dc6ca44d5404e38b0bcf109f1f Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Tue, 27 Feb 2024 16:34:47 -0700 Subject: [PATCH] Cleaned up home screen UI Added back the date to the home screen and cleaned up the software version text for a more classic/cleaner look. --- selfdrive/ui/qt/home.cc | 6 +++++- selfdrive/ui/qt/home.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/selfdrive/ui/qt/home.cc b/selfdrive/ui/qt/home.cc index 56f318999..e95fb5e68 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); @@ -228,7 +231,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 b9f8e3752..13d97b004 100644 --- a/selfdrive/ui/qt/home.h +++ b/selfdrive/ui/qt/home.h @@ -41,6 +41,7 @@ private: QPushButton* update_notif; // FrogPilot variables + ElidedLabel* date; }; class HomeWindow : public QWidget {