Skip to content

Commit

Permalink
ui: sunnypilot Vehicles panel refactor (commaai#126)
Browse files Browse the repository at this point in the history
* take out toyota stock long for now

* remove scrollbar (use in other areas!)

* use ListWidget for toggles

* Revert "remove scrollbar (use in other areas!)"

This reverts commit 0b6bbc49e968598b204558060e04fb6f64ad1977.

* turn off scrollbar

* new fcr styling
  • Loading branch information
sunnyhaibin authored Jun 10, 2023
1 parent bf19c7d commit c566e87
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
29 changes: 18 additions & 11 deletions selfdrive/ui/qt/offroad/sunnypilot_settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -535,34 +535,41 @@ SPVehiclesPanel::SPVehiclesPanel(QWidget *parent) : QWidget(parent) {
home_widget->setObjectName("homeWidget");

ScrollView *scroller = new ScrollView(home_widget, this);
scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
scroller->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
fcr_layout->addWidget(scroller, 1);

main_layout->addWidget(home);

setStyleSheet(R"(
#setCarBtn {
border-radius: 50px;
font-size: 50px;
margin: 0px;
padding: 20px;
border-width: 0;
border-radius: 30px;
color: #dddddd;
background-color: #444444;
font-weight: 500;
height:100px;
padding: 0 35 0 35;
color: #E4E4E4;
background-color: #393939;
}
#setCarBtn:pressed {
background-color: #4a4a4a;
}
)");

toggle_layout->addWidget(horizontal_line());
toggle_layout->addWidget(new LabelControl(tr("Toyota/Lexus")));
auto toggle_panel = new SPVehiclesTogglesPanel(this);
toggle_layout->addWidget(toggle_panel);
}

SPVehiclesTogglesPanel::SPVehiclesTogglesPanel(SPVehiclesPanel *parent) : ListWidget(parent) {
setSpacing(50);
addItem(new LabelControl(tr("Toyota/Lexus")));
stockLongToyota = new ParamControl(
"StockLongToyota",
"Enable Stock Toyota Longitudinal Control",
"sunnypilot will <b>not</b> take over control of gas and brakes. Stock Toyota longitudinal control will be used.",
"../assets/offroad/icon_blank.png"
);
stockLongToyota->setConfirmation(true, false);
toggle_layout->addWidget(horizontal_line());
toggle_layout->addWidget(stockLongToyota);
addItem(stockLongToyota);
}

SPVisualsPanel::SPVisualsPanel(QWidget *parent) : QWidget(parent) {
Expand Down
9 changes: 9 additions & 0 deletions selfdrive/ui/qt/offroad/sunnypilot_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ class SPVehiclesPanel : public QWidget {
QWidget* home = nullptr;

QWidget* home_widget;
};

class SPVehiclesTogglesPanel : public ListWidget {
Q_OBJECT
public:
explicit SPVehiclesTogglesPanel(SPVehiclesPanel *parent);

private:
Params params;

ParamControl *stockLongToyota;
};
Expand Down

0 comments on commit c566e87

Please sign in to comment.