mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-22 22:42:05 +08:00
OffroadHome: merge stylesheets (#21312)
* merge stylesheet * css:target #alert_notification button * Update selfdrive/ui/qt/home.cc Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
+16
-19
@@ -92,16 +92,15 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
|
||||
QHBoxLayout* header_layout = new QHBoxLayout();
|
||||
|
||||
date = new QLabel();
|
||||
date->setStyleSheet(R"(font-size: 55px;)");
|
||||
header_layout->addWidget(date, 0, Qt::AlignHCenter | Qt::AlignLeft);
|
||||
|
||||
alert_notification = new QPushButton();
|
||||
alert_notification->setObjectName("alert_notification");
|
||||
alert_notification->setVisible(false);
|
||||
QObject::connect(alert_notification, &QPushButton::released, this, &OffroadHome::openAlerts);
|
||||
header_layout->addWidget(alert_notification, 0, Qt::AlignHCenter | Qt::AlignRight);
|
||||
|
||||
QLabel* version = new QLabel(getBrandVersion());
|
||||
version->setStyleSheet(R"(font-size: 55px;)");
|
||||
header_layout->addWidget(version, 0, Qt::AlignHCenter | Qt::AlignRight);
|
||||
|
||||
main_layout->addLayout(header_layout);
|
||||
@@ -138,11 +137,23 @@ OffroadHome::OffroadHome(QWidget* parent) : QFrame(parent) {
|
||||
timer->start(10 * 1000);
|
||||
|
||||
setStyleSheet(R"(
|
||||
* {
|
||||
color: white;
|
||||
}
|
||||
OffroadHome {
|
||||
background-color: black;
|
||||
}
|
||||
* {
|
||||
color: white;
|
||||
#alert_notification {
|
||||
padding: 15px;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
border: 1px solid;
|
||||
border-radius: 5px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
}
|
||||
OffroadHome>QLabel {
|
||||
font-size: 55px;
|
||||
}
|
||||
)");
|
||||
}
|
||||
@@ -187,20 +198,6 @@ void OffroadHome::refresh() {
|
||||
openAlerts();
|
||||
}
|
||||
alert_notification->setVisible(true);
|
||||
|
||||
// Red background for alerts, blue for update available
|
||||
QString style = QString(R"(
|
||||
padding: 15px;
|
||||
padding-left: 30px;
|
||||
padding-right: 30px;
|
||||
border: 1px solid;
|
||||
border-radius: 5px;
|
||||
font-size: 40px;
|
||||
font-weight: 500;
|
||||
background-color: #E22C2C;
|
||||
)");
|
||||
if (alerts_widget->updateAvailable) {
|
||||
style.replace("#E22C2C", "#364DEF");
|
||||
}
|
||||
alert_notification->setStyleSheet(style);
|
||||
alert_notification->setStyleSheet(alerts_widget->updateAvailable ? "background-color: #364DEF" : "background-color: #E22C2C");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user