From 118faa71e55bb708b239fd54485a467643c18fd4 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Thu, 22 Oct 2020 17:11:52 +0200 Subject: [PATCH] simplify settings a bit (#2384) --- .../offroad/circled-checkmark-empty.png | Bin 0 -> 1731 bytes selfdrive/ui/qt/settings.cc | 48 +++++++++++------- 2 files changed, 29 insertions(+), 19 deletions(-) create mode 100644 selfdrive/assets/offroad/circled-checkmark-empty.png diff --git a/selfdrive/assets/offroad/circled-checkmark-empty.png b/selfdrive/assets/offroad/circled-checkmark-empty.png new file mode 100644 index 0000000000000000000000000000000000000000..e6740f11056bf6be8c99f5c4d7577889478dc0ad GIT binary patch literal 1731 zcmV;!20ZzRP)v zK~#9!?VL?)RYerX|5IDQwzMS*Es-K53Tm-n0+a$VV9-QGOfaGw4FuMp822tQsFCA0jGW6ZfykJ*#}q&i6pB`ucJDd|B;<0G;; zE$J6Y`y^!~?J>q&(MThp5m*Ccfa}CheLxqm8fY8|fGq^J0#`|nt^l6_3(6I+os^#T z0MC>IVC}#+q>s9R8EFKp4tT@vHEE?Az$Ty}65kJXq1CWx$A zQY)!h(lkj^B~=&E*D*;i8e_gM)hsi>>ji4bbHEqCTD!b!BJ^8h+pM)b&K1!AbznVU zk_PQgJLsr`{R&tPjE-?Eqk-ov@2Ed z1Dgo^95|qU;6q?S3AT|5z(;lrA#@OE8P1s&3fg{Pb_%rpT;PWY;57}$o))q^Z&{UJ zqm&R(ZB3>Az-3z-r}hj{1ZROKQ*4|+9jJk~$D(bm$>F0vfSF}*vS|a32gvhk(Z+3n zithpLEu(Yv6yR`x>C{nZ2V;R_o(@iw6KI3LJL!?_C{SMr^LIRq{|4I1_{yt2V9(na zmFW!661`Ox*EN1QpR%&JE(Y48F!Y%o8%EIW^hS@YnNUWL2N<{2BM7(};DATw$3htG z_8g-+G{Oj&?J&6Bu9VppDD!klGS;c@Y@SLtCDj^ZZd4Fx0!At8Ns#YM zKCWs2!8~-N(m=EAu1osOQRV(BN%uG^^r&*_S4Y{TDrJ3c^U;|~n{7Gtm!oW~54cMe z3Yt%LFL0MDc&T1=lr>b9lOzewHZN6qX4TjV2F>NUd9lj3mMeIsIrsi*4{+n-5HzXf z6EofI0aeUiTW7dRUv zyVt?&;hpMx}0vV0uxIGUIL&M=5%8l``o-fE@nSV`E2{7U^g$zAmec?oR=hc z34u1JD91v}WQhm)1BHehr4+Op;75@x$8yail@( zP&N(Plp@&l>vkHnGs=2U4R}%2+i$$GZV6MA|FJlPj!JsL7_&bOD!;aj67QwPb#1U^ zo=G8SUBE--a31_WxoD99&Ih(cG!KfUUfXA<%AM@f<0@d6wd>-hYrxmQ%B1$NQl#vz zl{8;j$CiPV-BC{$rsetWordWrap(true); + vlayout->addSpacing(50); vlayout->addWidget(checkbox); vlayout->addWidget(label); + vlayout->addSpacing(50); hlayout->addLayout(vlayout); setLayout(hlayout); @@ -46,7 +48,19 @@ ParamsToggle::ParamsToggle(QString param, QString title, QString description, QS checkbox->setChecked(Params().read_db_bool(param.toStdString().c_str())); setStyleSheet(R"( - QCheckBox { font-size: 70px } + QCheckBox { + font-size: 70px; + } + QCheckBox::indicator { + width: 100px; + height: 100px; + } + QCheckBox::indicator:unchecked { + image: url(../assets/offroad/circled-checkmark-empty.png); + } + QCheckBox::indicator:checked { + image: url(../assets/offroad/circled-checkmark.png); + } QLabel { font-size: 40px } * { background-color: #114265; @@ -62,14 +76,15 @@ void ParamsToggle::checkboxClicked(int state){ } SettingsWindow::SettingsWindow(QWidget *parent) : QWidget(parent) { - QWidget *container = new QWidget(this); QVBoxLayout *settings_list = new QVBoxLayout(); + /* settings_list->addWidget(new ParamsToggle("OpenpilotEnabledToggle", "Enable Openpilot", "Use the openpilot system for adaptive cruise control and lane keep driver assistance. Your attention is required at all times to use this feature. Changing this setting takes effect when the car is powered off.", "../assets/offroad/icon_openpilot.png" )); + */ settings_list->addWidget(new ParamsToggle("LaneChangeEnabled", "Enable Lane Change Assist", "Perform assisted lane changes with openpilot by checking your surroundings for safety, activating the turn signal and gently nudging the steering wheel towards your desired lane. openpilot is not capable of checking if a lane change is safe. You must continuously observe your surroundings to use this feature.", @@ -80,6 +95,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QWidget(parent) { "Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line without a turn signal activated while driving over 31mph (50kph).", "../assets/offroad/icon_warning.png" )); + /* settings_list->addWidget(new ParamsToggle("RecordFront", "Record and Upload Driver Camera", "Upload data from the driver facing camera and help improve the driver monitoring algorithm.", @@ -90,6 +106,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QWidget(parent) { "Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat.", "../assets/offroad/icon_openpilot_mirrored.png" )); + */ settings_list->addWidget(new ParamsToggle("IsMetric", "Use Metric System", "Display speed in km/h instead of mp/h.", @@ -103,35 +120,28 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QWidget(parent) { settings_list->setSpacing(25); + QWidget *container = new QWidget(this); container->setLayout(settings_list); - container->setFixedWidth(1650); - - QScrollArea *scrollArea = new QScrollArea; - scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - scrollArea->setWidget(container); - - QScrollerProperties sp; - sp.setScrollMetric(QScrollerProperties::DecelerationFactor, 2.0); - - QScroller* qs = QScroller::scroller(scrollArea); - qs->setScrollerProperties(sp); + container->setFixedWidth(1900); QHBoxLayout *main_layout = new QHBoxLayout; main_layout->addSpacing(50); - main_layout->addWidget(scrollArea); + main_layout->addWidget(container); + + QVBoxLayout *button_layout = new QVBoxLayout; + QPushButton * button = new QPushButton("X"); + button_layout->addWidget(button); + button_layout->addSpacing(900); - QPushButton * button = new QPushButton("Close"); - main_layout->addWidget(button); + main_layout->addLayout(button_layout); main_layout->addSpacing(20); setLayout(main_layout); - QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture); QObject::connect(button, SIGNAL(clicked()), this, SIGNAL(closeSettings())); setStyleSheet(R"( - QPushButton { font-size: 40px } + QPushButton { font-size: 100px } * { color: white; background-color: #072339;