|
|
@ -79,19 +79,20 @@ OffroadHome::OffroadHome(QWidget* parent) : QWidget(parent) { |
|
|
|
|
|
|
|
|
|
|
|
date = new QLabel(); |
|
|
|
date = new QLabel(); |
|
|
|
date->setStyleSheet(R"(font-size: 55px;)"); |
|
|
|
date->setStyleSheet(R"(font-size: 55px;)"); |
|
|
|
header_layout->addWidget(date, 0, Qt::AlignTop | Qt::AlignLeft); |
|
|
|
header_layout->addWidget(date, 0, Qt::AlignHCenter | Qt::AlignLeft); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alert_notification = new QPushButton(); |
|
|
|
|
|
|
|
alert_notification->setVisible(false); |
|
|
|
|
|
|
|
QObject::connect(alert_notification, SIGNAL(released()), this, SLOT(openAlerts())); |
|
|
|
|
|
|
|
header_layout->addWidget(alert_notification, 0, Qt::AlignHCenter | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
|
|
std::string brand = Params().read_db_bool("Passive") ? "dashcam" : "openpilot"; |
|
|
|
std::string brand = Params().read_db_bool("Passive") ? "dashcam" : "openpilot"; |
|
|
|
QLabel* version = new QLabel(QString::fromStdString(brand + " v" + Params().get("Version"))); |
|
|
|
QLabel* version = new QLabel(QString::fromStdString(brand + " v" + Params().get("Version"))); |
|
|
|
version->setStyleSheet(R"(font-size: 55px;)"); |
|
|
|
version->setStyleSheet(R"(font-size: 55px;)"); |
|
|
|
header_layout->addWidget(version, 0, Qt::AlignTop | Qt::AlignRight); |
|
|
|
header_layout->addWidget(version, 0, Qt::AlignHCenter | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
|
|
main_layout->addLayout(header_layout); |
|
|
|
main_layout->addLayout(header_layout); |
|
|
|
|
|
|
|
|
|
|
|
alert_notification = new QPushButton(); |
|
|
|
|
|
|
|
QObject::connect(alert_notification, SIGNAL(released()), this, SLOT(openAlerts())); |
|
|
|
|
|
|
|
main_layout->addWidget(alert_notification, 0, Qt::AlignTop | Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// main content
|
|
|
|
// main content
|
|
|
|
main_layout->addSpacing(25); |
|
|
|
main_layout->addSpacing(25); |
|
|
|
center_layout = new QStackedLayout(); |
|
|
|
center_layout = new QStackedLayout(); |
|
|
@ -152,6 +153,7 @@ void OffroadHome::refresh() { |
|
|
|
|
|
|
|
|
|
|
|
alerts_widget->refresh(); |
|
|
|
alerts_widget->refresh(); |
|
|
|
if (!alerts_widget->alerts.size() && !alerts_widget->updateAvailable) { |
|
|
|
if (!alerts_widget->alerts.size() && !alerts_widget->updateAvailable) { |
|
|
|
|
|
|
|
emit closeAlerts(); |
|
|
|
alert_notification->setVisible(false); |
|
|
|
alert_notification->setVisible(false); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
@ -163,6 +165,9 @@ void OffroadHome::refresh() { |
|
|
|
alert_notification->setText(QString::number(alerts) + " ALERT" + (alerts == 1 ? "" : "S")); |
|
|
|
alert_notification->setText(QString::number(alerts) + " ALERT" + (alerts == 1 ? "" : "S")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!alert_notification->isVisible() && !first_refresh) { |
|
|
|
|
|
|
|
emit openAlerts(); |
|
|
|
|
|
|
|
} |
|
|
|
alert_notification->setVisible(true); |
|
|
|
alert_notification->setVisible(true); |
|
|
|
|
|
|
|
|
|
|
|
// Red background for alerts, blue for update available
|
|
|
|
// Red background for alerts, blue for update available
|
|
|
|