nav: cleanup settings page (#21561)

pull/21567/head
Willem Melching 4 years ago committed by GitHub
parent dd128f5916
commit a148bcb3ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 27
      selfdrive/ui/qt/maps/map_settings.cc
  2. 8
      selfdrive/ui/qt/offroad/settings.cc

@ -14,11 +14,12 @@ static QString shorten(const QString &str, int max_len) {
MapPanel::MapPanel(QWidget* parent) : QWidget(parent) { MapPanel::MapPanel(QWidget* parent) : QWidget(parent) {
QVBoxLayout *main_layout = new QVBoxLayout(this); QVBoxLayout *main_layout = new QVBoxLayout(this);
const int icon_size = 200;
// Home // Home
QHBoxLayout *home_layout = new QHBoxLayout; QHBoxLayout *home_layout = new QHBoxLayout;
home_button = new QPushButton; home_button = new QPushButton;
home_button->setIconSize(QSize(200, 200)); home_button->setIconSize(QSize(icon_size, icon_size));
home_layout->addWidget(home_button); home_layout->addWidget(home_button);
home_address = new QLabel; home_address = new QLabel;
@ -30,7 +31,7 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) {
// Work // Work
QHBoxLayout *work_layout = new QHBoxLayout; QHBoxLayout *work_layout = new QHBoxLayout;
work_button = new QPushButton; work_button = new QPushButton;
work_button->setIconSize(QSize(200, 200)); work_button->setIconSize(QSize(icon_size, icon_size));
work_layout->addWidget(work_button); work_layout->addWidget(work_button);
work_address = new QLabel; work_address = new QLabel;
@ -46,32 +47,16 @@ MapPanel::MapPanel(QWidget* parent) : QWidget(parent) {
home_work_layout->addLayout(work_layout, 1); home_work_layout->addLayout(work_layout, 1);
main_layout->addLayout(home_work_layout); main_layout->addLayout(home_work_layout);
main_layout->addSpacing(50); main_layout->addSpacing(20);
main_layout->addWidget(horizontal_line()); main_layout->addWidget(horizontal_line());
main_layout->addSpacing(50);
// Recents
QLabel *recent = new QLabel("Recent");
recent->setStyleSheet(R"(font-size: 55px;)");
main_layout->addWidget(recent);
main_layout->addSpacing(20); main_layout->addSpacing(20);
// Recents
recent_layout = new QVBoxLayout; recent_layout = new QVBoxLayout;
QWidget *recent_widget = new LayoutWidget(recent_layout, this); QWidget *recent_widget = new LayoutWidget(recent_layout, this);
ScrollView *recent_scroller = new ScrollView(recent_widget, this); ScrollView *recent_scroller = new ScrollView(recent_widget, this);
main_layout->addWidget(recent_scroller, 1); main_layout->addWidget(recent_scroller, 1);
// Settings
main_layout->addSpacing(50);
main_layout->addWidget(horizontal_line());
main_layout->addWidget(new ParamControl("NavSettingTime24h",
"Show ETA in 24h format",
"Use 24h format instead of am/pm",
"",
this));
main_layout->addStretch();
clear(); clear();
std::string dongle_id = params.get("DongleId"); std::string dongle_id = params.get("DongleId");
@ -158,7 +143,7 @@ void MapPanel::parseResponse(const QString &response) {
} else { } else {
ClickableWidget *widget = new ClickableWidget; ClickableWidget *widget = new ClickableWidget;
QHBoxLayout *layout = new QHBoxLayout(widget); QHBoxLayout *layout = new QHBoxLayout(widget);
layout->setContentsMargins(15, 10, 40, 10); layout->setContentsMargins(15, 14, 40, 14);
QLabel *star = new QLabel(""); QLabel *star = new QLabel("");
auto sp = star->sizePolicy(); auto sp = star->sizePolicy();

@ -84,6 +84,14 @@ TogglesPanel::TogglesPanel(QWidget *parent) : QWidget(parent) {
}); });
} }
#ifdef ENABLE_MAPS
toggles.append(new ParamControl("NavSettingTime24h",
"Show ETA in 24h format",
"Use 24h format instead of am/pm",
"../assets/offroad/icon_metric.png",
this));
#endif
bool record_lock = Params().getBool("RecordFrontLock"); bool record_lock = Params().getBool("RecordFrontLock");
record_toggle->setEnabled(!record_lock); record_toggle->setEnabled(!record_lock);

Loading…
Cancel
Save