|
|
|
@ -1,11 +1,9 @@ |
|
|
|
|
#include "selfdrive/ui/qt/home.h" |
|
|
|
|
|
|
|
|
|
#include <QDateTime> |
|
|
|
|
#include <QHBoxLayout> |
|
|
|
|
#include <QMouseEvent> |
|
|
|
|
#include <QVBoxLayout> |
|
|
|
|
|
|
|
|
|
#include "common/params.h" |
|
|
|
|
#include "selfdrive/ui/qt/util.h" |
|
|
|
|
#include "selfdrive/ui/qt/widgets/drive_stats.h" |
|
|
|
|
#include "selfdrive/ui/qt/widgets/prime.h" |
|
|
|
@ -109,22 +107,20 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) { |
|
|
|
|
header_layout->setContentsMargins(15, 15, 15, 0); |
|
|
|
|
header_layout->setSpacing(16); |
|
|
|
|
|
|
|
|
|
date = new QLabel(); |
|
|
|
|
header_layout->addWidget(date, 1, Qt::AlignHCenter | Qt::AlignLeft); |
|
|
|
|
|
|
|
|
|
update_notif = new QPushButton(tr("UPDATE")); |
|
|
|
|
update_notif->setVisible(false); |
|
|
|
|
update_notif->setStyleSheet("background-color: #364DEF;"); |
|
|
|
|
QObject::connect(update_notif, &QPushButton::clicked, [=]() { center_layout->setCurrentIndex(1); }); |
|
|
|
|
header_layout->addWidget(update_notif, 0, Qt::AlignHCenter | Qt::AlignRight); |
|
|
|
|
header_layout->addWidget(update_notif, 0, Qt::AlignHCenter | Qt::AlignLeft); |
|
|
|
|
|
|
|
|
|
alert_notif = new QPushButton(); |
|
|
|
|
alert_notif->setVisible(false); |
|
|
|
|
alert_notif->setStyleSheet("background-color: #E22C2C;"); |
|
|
|
|
QObject::connect(alert_notif, &QPushButton::clicked, [=] { center_layout->setCurrentIndex(2); }); |
|
|
|
|
header_layout->addWidget(alert_notif, 0, Qt::AlignHCenter | Qt::AlignRight); |
|
|
|
|
header_layout->addWidget(alert_notif, 0, Qt::AlignHCenter | Qt::AlignLeft); |
|
|
|
|
|
|
|
|
|
header_layout->addWidget(new QLabel(getBrandVersion()), 0, Qt::AlignHCenter | Qt::AlignRight); |
|
|
|
|
version = new ElidedLabel(); |
|
|
|
|
header_layout->addWidget(version, 0, Qt::AlignHCenter | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
main_layout->addLayout(header_layout); |
|
|
|
|
|
|
|
|
@ -184,9 +180,7 @@ void OffroadHome::hideEvent(QHideEvent *event) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void OffroadHome::refresh() { |
|
|
|
|
QString locale_name = QString(uiState()->language).replace("main_", ""); |
|
|
|
|
QString dateString = QLocale(locale_name).toString(QDateTime::currentDateTime(), "dddd, MMMM d"); |
|
|
|
|
date->setText(dateString); |
|
|
|
|
version->setText(getBrand() + " " + QString::fromStdString(params.get("UpdaterCurrentDescription"))); |
|
|
|
|
|
|
|
|
|
bool updateAvailable = update_widget->refresh(); |
|
|
|
|
int alerts = alerts_widget->refresh(); |
|
|
|
|