@ -25,38 +25,34 @@
# include "selfdrive/ui/qt/util.h"
# include "selfdrive/ui/qt/qt_window.h"
TogglesPanel : : TogglesPanel ( QWidget * parent ) : QWidget ( parent ) {
QVBoxLayout * main_layout = new QVBoxLayout ( this ) ;
QList < ParamControl * > toggles ;
toggles . append ( new ParamControl ( " OpenpilotEnabledToggle " ,
TogglesPanel : : TogglesPanel ( QWidget * parent ) : ListWidget ( parent ) {
addItem ( new ParamControl ( " 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 " ,
this ) ) ;
toggles . append ( new ParamControl ( " IsLdwEnabled " ,
addItem ( new ParamControl ( " IsLdwEnabled " ,
" Enable Lane Departure Warnings " ,
" 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 " ,
this ) ) ;
toggles . append ( new ParamControl ( " IsRHD " ,
addItem ( new ParamControl ( " IsRHD " ,
" Enable Right-Hand Drive " ,
" Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. " ,
" ../assets/offroad/icon_openpilot_mirrored.png " ,
this ) ) ;
toggles . append ( new ParamControl ( " IsMetric " ,
addItem ( new ParamControl ( " IsMetric " ,
" Use Metric System " ,
" Display speed in km/h instead of mp/h. " ,
" ../assets/offroad/icon_metric.png " ,
this ) ) ;
toggles . append ( new ParamControl ( " CommunityFeaturesToggle " ,
addItem ( new ParamControl ( " CommunityFeaturesToggle " ,
" Enable Community Features " ,
" Use features from the open source community that are not maintained or supported by comma.ai and have not been confirmed to meet the standard safety model. These features include community supported cars and community supported hardware. Be extra cautious when using these features " ,
" ../assets/offroad/icon_shell.png " ,
this ) ) ;
toggles . append ( new ParamControl ( " UploadRaw " ,
addItem ( new ParamControl ( " UploadRaw " ,
" Upload Raw Logs " ,
" Upload full logs and full resolution video by default while on WiFi. If not enabled, individual logs can be marked for upload at my.comma.ai/useradmin. " ,
" ../assets/offroad/icon_network.png " ,
@ -67,15 +63,15 @@ TogglesPanel::TogglesPanel(QWidget *parent) : QWidget(parent) {
" Upload data from the driver facing camera and help improve the driver monitoring algorithm. " ,
" ../assets/offroad/icon_monitoring.png " ,
this ) ;
toggles . append ( record_toggle ) ;
toggles . append ( new ParamControl ( " EndToEndToggle " ,
addItem ( record_toggle ) ;
addItem ( new ParamControl ( " EndToEndToggle " ,
" \U0001f96c Disable use of lanelines (Alpha) \U0001f96c " ,
" In this mode openpilot will ignore lanelines and just drive how it thinks a human would. " ,
" ../assets/offroad/icon_road.png " ,
this ) ) ;
# ifdef ENABLE_MAPS
toggles . append ( new ParamControl ( " NavSettingTime24h " ,
addItem ( new ParamControl ( " NavSettingTime24h " ,
" Show ETA in 24h format " ,
" Use 24h format instead of am/pm " ,
" ../assets/offroad/icon_metric.png " ,
@ -84,23 +80,15 @@ TogglesPanel::TogglesPanel(QWidget *parent) : QWidget(parent) {
bool record_lock = Params ( ) . getBool ( " RecordFrontLock " ) ;
record_toggle - > setEnabled ( ! record_lock ) ;
for ( ParamControl * toggle : toggles ) {
if ( main_layout - > count ( ) ! = 0 ) {
main_layout - > addWidget ( horizontal_line ( ) ) ;
}
main_layout - > addWidget ( toggle ) ;
}
}
DevicePanel : : DevicePanel ( QWidget * parent ) : Q Widget( parent ) {
QVBoxLayout * main_layout = new QVBoxLayout ( this ) ;
DevicePanel : : DevicePanel ( QWidget * parent ) : ListWidget ( parent ) {
setSpacing ( 50 ) ;
Params params = Params ( ) ;
main_layout - > addWidget ( new LabelControl ( " Dongle ID " , getDongleId ( ) . value_or ( " N/A " ) ) ) ;
main_layout - > addWidget ( horizontal_line ( ) ) ;
addItem ( new LabelControl ( " Dongle ID " , getDongleId ( ) . value_or ( " N/A " ) ) ) ;
QString serial = QString : : fromStdString ( params . get ( " HardwareSerial " , false ) ) ;
main_layout - > addWidget ( new LabelControl ( " Serial " , serial ) ) ;
addItem ( new LabelControl ( " Serial " , serial ) ) ;
// offroad-only buttons
@ -158,9 +146,8 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
for ( auto btn : { dcamBtn , resetCalibBtn , retrainingBtn , regulatoryBtn } ) {
if ( btn ) {
main_layout - > addWidget ( horizontal_line ( ) ) ;
connect ( parent , SIGNAL ( offroadTransition ( bool ) ) , btn , SLOT ( setEnabled ( bool ) ) ) ;
main_layout - > addWidget ( btn ) ;
addItem ( btn ) ;
}
}
@ -196,10 +183,10 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
# poweroff_btn { background-color: #E22C2C; }
# poweroff_btn:pressed { background-color: #FF2424; }
) " );
main_layout - > addLayout ( power_layout ) ;
addItem ( power_layout ) ;
}
SoftwarePanel : : SoftwarePanel ( QWidget * parent ) : Q Widget( parent ) {
SoftwarePanel : : SoftwarePanel ( QWidget * parent ) : List Widget( parent ) {
gitBranchLbl = new LabelControl ( " Git Branch " ) ;
gitCommitLbl = new LabelControl ( " Git Commit " ) ;
osVersionLbl = new LabelControl ( " OS Version " ) ;
@ -216,12 +203,6 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {
std : : system ( " pkill -1 -f selfdrive.updated " ) ;
} ) ;
QVBoxLayout * main_layout = new QVBoxLayout ( this ) ;
QWidget * widgets [ ] = { versionLbl , lastUpdateLbl , updateBtn , gitBranchLbl , gitCommitLbl , osVersionLbl } ;
for ( int i = 0 ; i < std : : size ( widgets ) ; + + i ) {
main_layout - > addWidget ( widgets [ i ] ) ;
main_layout - > addWidget ( horizontal_line ( ) ) ;
}
auto uninstallBtn = new ButtonControl ( " Uninstall " + getBrand ( ) , " UNINSTALL " ) ;
connect ( uninstallBtn , & ButtonControl : : clicked , [ = ] ( ) {
@ -230,7 +211,11 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {
}
} ) ;
connect ( parent , SIGNAL ( offroadTransition ( bool ) ) , uninstallBtn , SLOT ( setEnabled ( bool ) ) ) ;
main_layout - > addWidget ( uninstallBtn ) ;
QWidget * widgets [ ] = { versionLbl , lastUpdateLbl , updateBtn , gitBranchLbl , gitCommitLbl , osVersionLbl , uninstallBtn } ;
for ( QWidget * w : widgets ) {
addItem ( w ) ;
}
fs_watch = new QFileSystemWatcher ( this ) ;
QObject : : connect ( fs_watch , & QFileSystemWatcher : : fileChanged , [ = ] ( const QString path ) {
@ -269,24 +254,24 @@ QWidget * network_panel(QWidget * parent) {
# ifdef QCOM
QWidget * w = new QWidget ( parent ) ;
QVBoxLayout * layout = new QVBoxLayout ( w ) ;
layout - > setSpacing ( 3 0 ) ;
layout - > setContentsMargins ( 50 , 0 , 50 , 0 ) ;
ListWidget * list = new ListWidget ( ) ;
list - > setSpacing ( 30 ) ;
// wifi + tethering buttons
auto wifiBtn = new ButtonControl ( " WiFi Settings " , " OPEN " ) ;
QObject : : connect ( wifiBtn , & ButtonControl : : clicked , [ = ] ( ) { HardwareEon : : launch_wifi ( ) ; } ) ;
layout - > addWidget ( wifiBtn ) ;
layout - > addWidget ( horizontal_line ( ) ) ;
list - > addItem ( wifiBtn ) ;
auto tetheringBtn = new ButtonControl ( " Tethering Settings " , " OPEN " ) ;
QObject : : connect ( tetheringBtn , & ButtonControl : : clicked , [ = ] ( ) { HardwareEon : : launch_tethering ( ) ; } ) ;
layout - > addWidget ( tetheringBtn ) ;
layout - > addWidget ( horizontal_line ( ) ) ;
list - > addItem ( tetheringBtn ) ;
// SSH key management
layout - > addWidget ( new SshToggle ( ) ) ;
layout - > addWidget ( horizontal_line ( ) ) ;
layout - > addWidget ( new SshControl ( ) ) ;
list - > addItem ( new SshToggle ( ) ) ;
list - > addItem ( new SshControl ( ) ) ;
layout - > addWidget ( list ) ;
layout - > addStretch ( 1 ) ;
# else
Networking * w = new Networking ( parent ) ;