@ -25,38 +25,34 @@
# include "selfdrive/ui/qt/util.h"
# include "selfdrive/ui/qt/util.h"
# include "selfdrive/ui/qt/qt_window.h"
# include "selfdrive/ui/qt/qt_window.h"
TogglesPanel : : TogglesPanel ( QWidget * parent ) : QWidget ( parent ) {
TogglesPanel : : TogglesPanel ( QWidget * parent ) : ListWidget ( parent ) {
QVBoxLayout * main_layout = new QVBoxLayout ( this ) ;
addItem ( new ParamControl ( " OpenpilotEnabledToggle " ,
QList < ParamControl * > toggles ;
toggles . append ( new ParamControl ( " OpenpilotEnabledToggle " ,
" Enable openpilot " ,
" 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. " ,
" 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 " ,
" ../assets/offroad/icon_openpilot.png " ,
this ) ) ;
this ) ) ;
toggles . append ( new ParamControl ( " IsLdwEnabled " ,
addItem ( new ParamControl ( " IsLdwEnabled " ,
" Enable Lane Departure Warnings " ,
" 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). " ,
" 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 " ,
" ../assets/offroad/icon_warning.png " ,
this ) ) ;
this ) ) ;
toggles . append ( new ParamControl ( " IsRHD " ,
addItem ( new ParamControl ( " IsRHD " ,
" Enable Right-Hand Drive " ,
" Enable Right-Hand Drive " ,
" Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. " ,
" Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. " ,
" ../assets/offroad/icon_openpilot_mirrored.png " ,
" ../assets/offroad/icon_openpilot_mirrored.png " ,
this ) ) ;
this ) ) ;
toggles . append ( new ParamControl ( " IsMetric " ,
addItem ( new ParamControl ( " IsMetric " ,
" Use Metric System " ,
" Use Metric System " ,
" Display speed in km/h instead of mp/h. " ,
" Display speed in km/h instead of mp/h. " ,
" ../assets/offroad/icon_metric.png " ,
" ../assets/offroad/icon_metric.png " ,
this ) ) ;
this ) ) ;
toggles . append ( new ParamControl ( " CommunityFeaturesToggle " ,
addItem ( new ParamControl ( " CommunityFeaturesToggle " ,
" Enable Community Features " ,
" 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 " ,
" 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 " ,
" ../assets/offroad/icon_shell.png " ,
this ) ) ;
this ) ) ;
toggles . append ( new ParamControl ( " UploadRaw " ,
addItem ( new ParamControl ( " UploadRaw " ,
" Upload Raw Logs " ,
" 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. " ,
" 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 " ,
" ../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. " ,
" Upload data from the driver facing camera and help improve the driver monitoring algorithm. " ,
" ../assets/offroad/icon_monitoring.png " ,
" ../assets/offroad/icon_monitoring.png " ,
this ) ;
this ) ;
toggles . append ( record_toggle ) ;
addItem ( record_toggle ) ;
toggles . append ( new ParamControl ( " EndToEndToggle " ,
addItem ( new ParamControl ( " EndToEndToggle " ,
" \U0001f96c Disable use of lanelines (Alpha) \U0001f96c " ,
" \U0001f96c Disable use of lanelines (Alpha) \U0001f96c " ,
" In this mode openpilot will ignore lanelines and just drive how it thinks a human would. " ,
" In this mode openpilot will ignore lanelines and just drive how it thinks a human would. " ,
" ../assets/offroad/icon_road.png " ,
" ../assets/offroad/icon_road.png " ,
this ) ) ;
this ) ) ;
# ifdef ENABLE_MAPS
# ifdef ENABLE_MAPS
toggles . append ( new ParamControl ( " NavSettingTime24h " ,
addItem ( new ParamControl ( " NavSettingTime24h " ,
" Show ETA in 24h format " ,
" Show ETA in 24h format " ,
" Use 24h format instead of am/pm " ,
" Use 24h format instead of am/pm " ,
" ../assets/offroad/icon_metric.png " ,
" ../assets/offroad/icon_metric.png " ,
@ -84,23 +80,15 @@ TogglesPanel::TogglesPanel(QWidget *parent) : QWidget(parent) {
bool record_lock = Params ( ) . getBool ( " RecordFrontLock " ) ;
bool record_lock = Params ( ) . getBool ( " RecordFrontLock " ) ;
record_toggle - > setEnabled ( ! record_lock ) ;
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 ) {
DevicePanel : : DevicePanel ( QWidget * parent ) : ListWidget ( parent ) {
QVBoxLayout * main_layout = new QVBoxLayout ( this ) ;
setSpacing ( 50 ) ;
Params params = Params ( ) ;
Params params = Params ( ) ;
main_layout - > addWidget ( new LabelControl ( " Dongle ID " , getDongleId ( ) . value_or ( " N/A " ) ) ) ;
addItem ( new LabelControl ( " Dongle ID " , getDongleId ( ) . value_or ( " N/A " ) ) ) ;
main_layout - > addWidget ( horizontal_line ( ) ) ;
QString serial = QString : : fromStdString ( params . get ( " HardwareSerial " , false ) ) ;
QString serial = QString : : fromStdString ( params . get ( " HardwareSerial " , false ) ) ;
main_layout - > addWidget ( new LabelControl ( " Serial " , serial ) ) ;
addItem ( new LabelControl ( " Serial " , serial ) ) ;
// offroad-only buttons
// offroad-only buttons
@ -158,9 +146,8 @@ DevicePanel::DevicePanel(QWidget* parent) : QWidget(parent) {
for ( auto btn : { dcamBtn , resetCalibBtn , retrainingBtn , regulatoryBtn } ) {
for ( auto btn : { dcamBtn , resetCalibBtn , retrainingBtn , regulatoryBtn } ) {
if ( btn ) {
if ( btn ) {
main_layout - > addWidget ( horizontal_line ( ) ) ;
connect ( parent , SIGNAL ( offroadTransition ( bool ) ) , btn , SLOT ( setEnabled ( bool ) ) ) ;
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 { background-color: #E22C2C; }
# poweroff_btn:pressed { background-color: #FF2424; }
# 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 " ) ;
gitBranchLbl = new LabelControl ( " Git Branch " ) ;
gitCommitLbl = new LabelControl ( " Git Commit " ) ;
gitCommitLbl = new LabelControl ( " Git Commit " ) ;
osVersionLbl = new LabelControl ( " OS Version " ) ;
osVersionLbl = new LabelControl ( " OS Version " ) ;
@ -216,12 +203,6 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {
std : : system ( " pkill -1 -f selfdrive.updated " ) ;
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 " ) ;
auto uninstallBtn = new ButtonControl ( " Uninstall " + getBrand ( ) , " UNINSTALL " ) ;
connect ( uninstallBtn , & ButtonControl : : clicked , [ = ] ( ) {
connect ( uninstallBtn , & ButtonControl : : clicked , [ = ] ( ) {
@ -230,7 +211,11 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : QWidget(parent) {
}
}
} ) ;
} ) ;
connect ( parent , SIGNAL ( offroadTransition ( bool ) ) , uninstallBtn , SLOT ( setEnabled ( bool ) ) ) ;
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 ) ;
fs_watch = new QFileSystemWatcher ( this ) ;
QObject : : connect ( fs_watch , & QFileSystemWatcher : : fileChanged , [ = ] ( const QString path ) {
QObject : : connect ( fs_watch , & QFileSystemWatcher : : fileChanged , [ = ] ( const QString path ) {
@ -269,24 +254,24 @@ QWidget * network_panel(QWidget * parent) {
# ifdef QCOM
# ifdef QCOM
QWidget * w = new QWidget ( parent ) ;
QWidget * w = new QWidget ( parent ) ;
QVBoxLayout * layout = new QVBoxLayout ( w ) ;
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
// wifi + tethering buttons
auto wifiBtn = new ButtonControl ( " WiFi Settings " , " OPEN " ) ;
auto wifiBtn = new ButtonControl ( " WiFi Settings " , " OPEN " ) ;
QObject : : connect ( wifiBtn , & ButtonControl : : clicked , [ = ] ( ) { HardwareEon : : launch_wifi ( ) ; } ) ;
QObject : : connect ( wifiBtn , & ButtonControl : : clicked , [ = ] ( ) { HardwareEon : : launch_wifi ( ) ; } ) ;
layout - > addWidget ( wifiBtn ) ;
list - > addItem ( wifiBtn ) ;
layout - > addWidget ( horizontal_line ( ) ) ;
auto tetheringBtn = new ButtonControl ( " Tethering Settings " , " OPEN " ) ;
auto tetheringBtn = new ButtonControl ( " Tethering Settings " , " OPEN " ) ;
QObject : : connect ( tetheringBtn , & ButtonControl : : clicked , [ = ] ( ) { HardwareEon : : launch_tethering ( ) ; } ) ;
QObject : : connect ( tetheringBtn , & ButtonControl : : clicked , [ = ] ( ) { HardwareEon : : launch_tethering ( ) ; } ) ;
layout - > addWidget ( tetheringBtn ) ;
list - > addItem ( tetheringBtn ) ;
layout - > addWidget ( horizontal_line ( ) ) ;
// SSH key management
// SSH key management
layout - > addWidget ( new SshToggle ( ) ) ;
list - > addItem ( new SshToggle ( ) ) ;
layout - > addWidget ( horizontal_line ( ) ) ;
list - > addItem ( new SshControl ( ) ) ;
layout - > addWidget ( new SshControl ( ) ) ;
layout - > addWidget ( list ) ;
layout - > addStretch ( 1 ) ;
layout - > addStretch ( 1 ) ;
# else
# else
Networking * w = new Networking ( parent ) ;
Networking * w = new Networking ( parent ) ;