@ -29,45 +29,45 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
std : : vector < std : : tuple < QString , QString , QString , QString > > toggles {
std : : vector < std : : tuple < QString , QString , QString , QString > > toggles {
{
{
" OpenpilotEnabledToggle " ,
" OpenpilotEnabledToggle " ,
" Enable openpilot " ,
tr ( " 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. " ,
tr ( " 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 " ,
} ,
} ,
{
{
" IsLdwEnabled " ,
" IsLdwEnabled " ,
" Enable Lane Departure Warnings " ,
tr ( " 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 31 mph (50 km/h). " ,
tr ( " 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 31 mph (50 km/h). " ) ,
" ../assets/offroad/icon_warning.png " ,
" ../assets/offroad/icon_warning.png " ,
} ,
} ,
{
{
" IsRHD " ,
" IsRHD " ,
" Enable Right-Hand Drive " ,
tr ( " Enable Right-Hand Drive " ) ,
" Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat. " ,
tr ( " 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 " ,
} ,
} ,
{
{
" IsMetric " ,
" IsMetric " ,
" Use Metric System " ,
tr ( " Use Metric System " ) ,
" Display speed in km/h instead of mph. " ,
tr ( " Display speed in km/h instead of mph. " ) ,
" ../assets/offroad/icon_metric.png " ,
" ../assets/offroad/icon_metric.png " ,
} ,
} ,
{
{
" RecordFront " ,
" RecordFront " ,
" Record and Upload Driver Camera " ,
tr ( " Record and Upload Driver Camera " ) ,
" Upload data from the driver facing camera and help improve the driver monitoring algorithm. " ,
tr ( " Upload data from the driver facing camera and help improve the driver monitoring algorithm. " ) ,
" ../assets/offroad/icon_monitoring.png " ,
" ../assets/offroad/icon_monitoring.png " ,
} ,
} ,
{
{
" DisengageOnAccelerator " ,
" DisengageOnAccelerator " ,
" Disengage On Accelerator Pedal " ,
tr ( " Disengage On Accelerator Pedal " ) ,
" When enabled, pressing the accelerator pedal will disengage openpilot. " ,
tr ( " When enabled, pressing the accelerator pedal will disengage openpilot. " ) ,
" ../assets/offroad/icon_disengage_on_accelerator.svg " ,
" ../assets/offroad/icon_disengage_on_accelerator.svg " ,
} ,
} ,
# ifdef ENABLE_MAPS
# ifdef ENABLE_MAPS
{
{
" NavSettingTime24h " ,
" NavSettingTime24h " ,
" Show ETA in 24h format " ,
tr ( " Show ETA in 24h format " ) ,
" Use 24h format instead of am/pm " ,
tr ( " Use 24h format instead of am/pm " ) ,
" ../assets/offroad/icon_metric.png " ,
" ../assets/offroad/icon_metric.png " ,
} ,
} ,
# endif
# endif
@ -79,8 +79,8 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
if ( params . getBool ( " DisableRadar_Allow " ) ) {
if ( params . getBool ( " DisableRadar_Allow " ) ) {
toggles . push_back ( {
toggles . push_back ( {
" DisableRadar " ,
" DisableRadar " ,
" openpilot Longitudinal Control " ,
tr ( " openpilot Longitudinal Control " ) ,
" openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB! " ,
tr ( " openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB! " ) ,
" ../assets/offroad/icon_speed_limit.png " ,
" ../assets/offroad/icon_speed_limit.png " ,
} ) ;
} ) ;
}
}
@ -95,29 +95,29 @@ TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
DevicePanel : : DevicePanel ( SettingsWindow * parent ) : ListWidget ( parent ) {
DevicePanel : : DevicePanel ( SettingsWindow * parent ) : ListWidget ( parent ) {
setSpacing ( 50 ) ;
setSpacing ( 50 ) ;
addItem ( new LabelControl ( " Dongle ID " , getDongleId ( ) . value_or ( " N/A " ) ) ) ;
addItem ( new LabelControl ( tr ( " Dongle ID " ) , getDongleId ( ) . value_or ( tr ( " N/A " ) ) ) ) ;
addItem ( new LabelControl ( " Serial " , params . get ( " HardwareSerial " ) . c_str ( ) ) ) ;
addItem ( new LabelControl ( tr ( " Serial " ) , params . get ( " HardwareSerial " ) . c_str ( ) ) ) ;
// offroad-only buttons
// offroad-only buttons
auto dcamBtn = new ButtonControl ( " Driver Camera " , " PREVIEW " ,
auto dcamBtn = new ButtonControl ( tr ( " Driver Camera " ) , tr ( " PREVIEW " ) ,
" Preview the driver facing camera to help optimize device mounting position for best driver monitoring experience. (vehicle must be off) " ) ;
tr ( " Preview the driver facing camera to help optimize device mounting position for best driver monitoring experience. (vehicle must be off) " ) ) ;
connect ( dcamBtn , & ButtonControl : : clicked , [ = ] ( ) { emit showDriverView ( ) ; } ) ;
connect ( dcamBtn , & ButtonControl : : clicked , [ = ] ( ) { emit showDriverView ( ) ; } ) ;
addItem ( dcamBtn ) ;
addItem ( dcamBtn ) ;
auto resetCalibBtn = new ButtonControl ( " Reset Calibration " , " RESET " , " " ) ;
auto resetCalibBtn = new ButtonControl ( tr ( " Reset Calibration " ) , tr ( " RESET " ) , " " ) ;
connect ( resetCalibBtn , & ButtonControl : : showDescription , this , & DevicePanel : : updateCalibDescription ) ;
connect ( resetCalibBtn , & ButtonControl : : showDescription , this , & DevicePanel : : updateCalibDescription ) ;
connect ( resetCalibBtn , & ButtonControl : : clicked , [ & ] ( ) {
connect ( resetCalibBtn , & ButtonControl : : clicked , [ & ] ( ) {
if ( ConfirmationDialog : : confirm ( " Are you sure you want to reset calibration? " , this ) ) {
if ( ConfirmationDialog : : confirm ( tr ( " Are you sure you want to reset calibration? " ) , this ) ) {
params . remove ( " CalibrationParams " ) ;
params . remove ( " CalibrationParams " ) ;
}
}
} ) ;
} ) ;
addItem ( resetCalibBtn ) ;
addItem ( resetCalibBtn ) ;
if ( ! params . getBool ( " Passive " ) ) {
if ( ! params . getBool ( " Passive " ) ) {
auto retrainingBtn = new ButtonControl ( " Review Training Guide " , " REVIEW " , " Review the rules, features, and limitations of openpilot " ) ;
auto retrainingBtn = new ButtonControl ( tr ( " Review Training Guide " ) , tr ( " REVIEW " ) , tr ( " Review the rules, features, and limitations of openpilot " ) ) ;
connect ( retrainingBtn , & ButtonControl : : clicked , [ = ] ( ) {
connect ( retrainingBtn , & ButtonControl : : clicked , [ = ] ( ) {
if ( ConfirmationDialog : : confirm ( " Are you sure you want to review the training guide? " , this ) ) {
if ( ConfirmationDialog : : confirm ( tr ( " Are you sure you want to review the training guide? " ) , this ) ) {
emit reviewTrainingGuide ( ) ;
emit reviewTrainingGuide ( ) ;
}
}
} ) ;
} ) ;
@ -125,7 +125,7 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
}
}
if ( Hardware : : TICI ( ) ) {
if ( Hardware : : TICI ( ) ) {
auto regulatoryBtn = new ButtonControl ( " Regulatory " , " VIEW " , " " ) ;
auto regulatoryBtn = new ButtonControl ( tr ( " Regulatory " ) , tr ( " VIEW " ) , " " ) ;
connect ( regulatoryBtn , & ButtonControl : : clicked , [ = ] ( ) {
connect ( regulatoryBtn , & ButtonControl : : clicked , [ = ] ( ) {
const std : : string txt = util : : read_file ( " ../assets/offroad/fcc.html " ) ;
const std : : string txt = util : : read_file ( " ../assets/offroad/fcc.html " ) ;
RichTextDialog : : alert ( QString : : fromStdString ( txt ) , this ) ;
RichTextDialog : : alert ( QString : : fromStdString ( txt ) , this ) ;
@ -143,12 +143,12 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
QHBoxLayout * power_layout = new QHBoxLayout ( ) ;
QHBoxLayout * power_layout = new QHBoxLayout ( ) ;
power_layout - > setSpacing ( 30 ) ;
power_layout - > setSpacing ( 30 ) ;
QPushButton * reboot_btn = new QPushButton ( " Reboot " ) ;
QPushButton * reboot_btn = new QPushButton ( tr ( " Reboot " ) ) ;
reboot_btn - > setObjectName ( " reboot_btn " ) ;
reboot_btn - > setObjectName ( " reboot_btn " ) ;
power_layout - > addWidget ( reboot_btn ) ;
power_layout - > addWidget ( reboot_btn ) ;
QObject : : connect ( reboot_btn , & QPushButton : : clicked , this , & DevicePanel : : reboot ) ;
QObject : : connect ( reboot_btn , & QPushButton : : clicked , this , & DevicePanel : : reboot ) ;
QPushButton * poweroff_btn = new QPushButton ( " Power Off " ) ;
QPushButton * poweroff_btn = new QPushButton ( tr ( " Power Off " ) ) ;
poweroff_btn - > setObjectName ( " poweroff_btn " ) ;
poweroff_btn - > setObjectName ( " poweroff_btn " ) ;
power_layout - > addWidget ( poweroff_btn ) ;
power_layout - > addWidget ( poweroff_btn ) ;
QObject : : connect ( poweroff_btn , & QPushButton : : clicked , this , & DevicePanel : : poweroff ) ;
QObject : : connect ( poweroff_btn , & QPushButton : : clicked , this , & DevicePanel : : poweroff ) ;
@ -168,8 +168,8 @@ DevicePanel::DevicePanel(SettingsWindow *parent) : ListWidget(parent) {
void DevicePanel : : updateCalibDescription ( ) {
void DevicePanel : : updateCalibDescription ( ) {
QString desc =
QString desc =
" openpilot requires the device to be mounted within 4° left or right and "
tr ( " openpilot requires the device to be mounted within 4° left or right and "
" within 5° up or 8° down. openpilot is continuously calibrating, resetting is rarely required. " ;
" within 5° up or 8° down. openpilot is continuously calibrating, resetting is rarely required. " ) ;
std : : string calib_bytes = Params ( ) . get ( " CalibrationParams " ) ;
std : : string calib_bytes = Params ( ) . get ( " CalibrationParams " ) ;
if ( ! calib_bytes . empty ( ) ) {
if ( ! calib_bytes . empty ( ) ) {
try {
try {
@ -179,9 +179,9 @@ void DevicePanel::updateCalibDescription() {
if ( calib . getCalStatus ( ) ! = 0 ) {
if ( calib . getCalStatus ( ) ! = 0 ) {
double pitch = calib . getRpyCalib ( ) [ 1 ] * ( 180 / M_PI ) ;
double pitch = calib . getRpyCalib ( ) [ 1 ] * ( 180 / M_PI ) ;
double yaw = calib . getRpyCalib ( ) [ 2 ] * ( 180 / M_PI ) ;
double yaw = calib . getRpyCalib ( ) [ 2 ] * ( 180 / M_PI ) ;
desc + = QString ( " Your device is pointed %1° %2 and %3° %4. " )
desc + = QString ( tr ( " Your device is pointed %1° %2 and %3° %4. " ) )
. arg ( QString : : number ( std : : abs ( pitch ) , ' g ' , 1 ) , pitch > 0 ? " down " : " up " ,
. arg ( QString : : number ( std : : abs ( pitch ) , ' g ' , 1 ) , pitch > 0 ? tr ( " down " ) : tr ( " up " ) ,
QString : : number ( std : : abs ( yaw ) , ' g ' , 1 ) , yaw > 0 ? " left " : " right " ) ;
QString : : number ( std : : abs ( yaw ) , ' g ' , 1 ) , yaw > 0 ? tr ( " left " ) : tr ( " right " ) ) ;
}
}
} catch ( kj : : Exception ) {
} catch ( kj : : Exception ) {
qInfo ( ) < < " invalid CalibrationParams " ;
qInfo ( ) < < " invalid CalibrationParams " ;
@ -192,51 +192,51 @@ void DevicePanel::updateCalibDescription() {
void DevicePanel : : reboot ( ) {
void DevicePanel : : reboot ( ) {
if ( ! uiState ( ) - > engaged ( ) ) {
if ( ! uiState ( ) - > engaged ( ) ) {
if ( ConfirmationDialog : : confirm ( " Are you sure you want to reboot? " , this ) ) {
if ( ConfirmationDialog : : confirm ( tr ( " Are you sure you want to reboot? " ) , this ) ) {
// Check engaged again in case it changed while the dialog was open
// Check engaged again in case it changed while the dialog was open
if ( ! uiState ( ) - > engaged ( ) ) {
if ( ! uiState ( ) - > engaged ( ) ) {
Params ( ) . putBool ( " DoReboot " , true ) ;
Params ( ) . putBool ( " DoReboot " , true ) ;
}
}
}
}
} else {
} else {
ConfirmationDialog : : alert ( " Disengage to Reboot " , this ) ;
ConfirmationDialog : : alert ( tr ( " Disengage to Reboot " ) , this ) ;
}
}
}
}
void DevicePanel : : poweroff ( ) {
void DevicePanel : : poweroff ( ) {
if ( ! uiState ( ) - > engaged ( ) ) {
if ( ! uiState ( ) - > engaged ( ) ) {
if ( ConfirmationDialog : : confirm ( " Are you sure you want to power off? " , this ) ) {
if ( ConfirmationDialog : : confirm ( tr ( " Are you sure you want to power off? " ) , this ) ) {
// Check engaged again in case it changed while the dialog was open
// Check engaged again in case it changed while the dialog was open
if ( ! uiState ( ) - > engaged ( ) ) {
if ( ! uiState ( ) - > engaged ( ) ) {
Params ( ) . putBool ( " DoShutdown " , true ) ;
Params ( ) . putBool ( " DoShutdown " , true ) ;
}
}
}
}
} else {
} else {
ConfirmationDialog : : alert ( " Disengage to Power Off " , this ) ;
ConfirmationDialog : : alert ( tr ( " Disengage to Power Off " ) , this ) ;
}
}
}
}
SoftwarePanel : : SoftwarePanel ( QWidget * parent ) : ListWidget ( parent ) {
SoftwarePanel : : SoftwarePanel ( QWidget * parent ) : ListWidget ( parent ) {
gitBranchLbl = new LabelControl ( " Git Branch " ) ;
gitBranchLbl = new LabelControl ( tr ( " Git Branch " ) ) ;
gitCommitLbl = new LabelControl ( " Git Commit " ) ;
gitCommitLbl = new LabelControl ( tr ( " Git Commit " ) ) ;
osVersionLbl = new LabelControl ( " OS Version " ) ;
osVersionLbl = new LabelControl ( tr ( " OS Version " ) ) ;
versionLbl = new LabelControl ( " Version " , " " , QString : : fromStdString ( params . get ( " ReleaseNotes " ) ) . trimmed ( ) ) ;
versionLbl = new LabelControl ( tr ( " Version " ) , " " , QString : : fromStdString ( params . get ( " ReleaseNotes " ) ) . trimmed ( ) ) ;
lastUpdateLbl = new LabelControl ( " Last Update Check " , " " , " The last time openpilot successfully checked for an update. The updater only runs while the car is off. " ) ;
lastUpdateLbl = new LabelControl ( tr ( " Last Update Check " ) , " " , tr ( " The last time openpilot successfully checked for an update. The updater only runs while the car is off. " ) ) ;
updateBtn = new ButtonControl ( " Check for Update " , " " ) ;
updateBtn = new ButtonControl ( tr ( " Check for Update " ) , " " ) ;
connect ( updateBtn , & ButtonControl : : clicked , [ = ] ( ) {
connect ( updateBtn , & ButtonControl : : clicked , [ = ] ( ) {
if ( params . getBool ( " IsOffroad " ) ) {
if ( params . getBool ( " IsOffroad " ) ) {
fs_watch - > addPath ( QString : : fromStdString ( params . getParamPath ( " LastUpdateTime " ) ) ) ;
fs_watch - > addPath ( QString : : fromStdString ( params . getParamPath ( " LastUpdateTime " ) ) ) ;
fs_watch - > addPath ( QString : : fromStdString ( params . getParamPath ( " UpdateFailedCount " ) ) ) ;
fs_watch - > addPath ( QString : : fromStdString ( params . getParamPath ( " UpdateFailedCount " ) ) ) ;
updateBtn - > setText ( " CHECKING " ) ;
updateBtn - > setText ( tr ( " CHECKING " ) ) ;
updateBtn - > setEnabled ( false ) ;
updateBtn - > setEnabled ( false ) ;
}
}
std : : system ( " pkill -1 -f selfdrive.updated " ) ;
std : : system ( " pkill -1 -f selfdrive.updated " ) ;
} ) ;
} ) ;
auto uninstallBtn = new ButtonControl ( " Uninstall " + getBrand ( ) , " UNINSTALL " ) ;
auto uninstallBtn = new ButtonControl ( tr ( " Uninstall " ) + getBrand ( ) , tr ( " UNINSTALL " ) ) ;
connect ( uninstallBtn , & ButtonControl : : clicked , [ & ] ( ) {
connect ( uninstallBtn , & ButtonControl : : clicked , [ & ] ( ) {
if ( ConfirmationDialog : : confirm ( " Are you sure you want to uninstall? " , this ) ) {
if ( ConfirmationDialog : : confirm ( tr ( " Are you sure you want to uninstall? " ) , this ) ) {
params . putBool ( " DoUninstall " , true ) ;
params . putBool ( " DoUninstall " , true ) ;
}
}
} ) ;
} ) ;
@ -250,8 +250,8 @@ SoftwarePanel::SoftwarePanel(QWidget* parent) : ListWidget(parent) {
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 ) {
if ( path . contains ( " UpdateFailedCount " ) & & std : : atoi ( params . get ( " UpdateFailedCount " ) . c_str ( ) ) > 0 ) {
if ( path . contains ( " UpdateFailedCount " ) & & std : : atoi ( params . get ( " UpdateFailedCount " ) . c_str ( ) ) > 0 ) {
lastUpdateLbl - > setText ( " failed to fetch update " ) ;
lastUpdateLbl - > setText ( tr ( " failed to fetch update " ) ) ;
updateBtn - > setText ( " CHECK " ) ;
updateBtn - > setText ( tr ( " CHECK " ) ) ;
updateBtn - > setEnabled ( true ) ;
updateBtn - > setEnabled ( true ) ;
} else if ( path . contains ( " LastUpdateTime " ) ) {
} else if ( path . contains ( " LastUpdateTime " ) ) {
updateLabels ( ) ;
updateLabels ( ) ;
@ -272,7 +272,7 @@ void SoftwarePanel::updateLabels() {
versionLbl - > setText ( getBrandVersion ( ) ) ;
versionLbl - > setText ( getBrandVersion ( ) ) ;
lastUpdateLbl - > setText ( lastUpdate ) ;
lastUpdateLbl - > setText ( lastUpdate ) ;
updateBtn - > setText ( " CHECK " ) ;
updateBtn - > setText ( tr ( " CHECK " ) ) ;
updateBtn - > setEnabled ( true ) ;
updateBtn - > setEnabled ( true ) ;
gitBranchLbl - > setText ( QString : : fromStdString ( params . get ( " GitBranch " ) ) ) ;
gitBranchLbl - > setText ( QString : : fromStdString ( params . get ( " GitBranch " ) ) ) ;
gitCommitLbl - > setText ( QString : : fromStdString ( params . get ( " GitCommit " ) ) . left ( 10 ) ) ;
gitCommitLbl - > setText ( QString : : fromStdString ( params . get ( " GitCommit " ) ) . left ( 10 ) ) ;
@ -301,7 +301,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
) " );
) " );
// close button
// close button
QPushButton * close_btn = new QPushButton ( " × " ) ;
QPushButton * close_btn = new QPushButton ( tr ( " × " ) ) ;
close_btn - > setStyleSheet ( R " (
close_btn - > setStyleSheet ( R " (
QPushButton {
QPushButton {
font - size : 140 px ;
font - size : 140 px ;
@ -327,15 +327,15 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
QObject : : connect ( device , & DevicePanel : : showDriverView , this , & SettingsWindow : : showDriverView ) ;
QObject : : connect ( device , & DevicePanel : : showDriverView , this , & SettingsWindow : : showDriverView ) ;
QList < QPair < QString , QWidget * > > panels = {
QList < QPair < QString , QWidget * > > panels = {
{ " Device " , device } ,
{ tr ( " Device " ) , device } ,
{ " Network " , network_panel ( this ) } ,
{ tr ( " Network " ) , network_panel ( this ) } ,
{ " Toggles " , new TogglesPanel ( this ) } ,
{ tr ( " Toggles " ) , new TogglesPanel ( this ) } ,
{ " Software " , new SoftwarePanel ( this ) } ,
{ tr ( " Software " ) , new SoftwarePanel ( this ) } ,
} ;
} ;
# ifdef ENABLE_MAPS
# ifdef ENABLE_MAPS
auto map_panel = new MapPanel ( this ) ;
auto map_panel = new MapPanel ( this ) ;
panels . push_back ( { " Navigation " , map_panel } ) ;
panels . push_back ( { tr ( " Navigation " ) , map_panel } ) ;
QObject : : connect ( map_panel , & MapPanel : : closeSettings , this , & SettingsWindow : : closeSettings ) ;
QObject : : connect ( map_panel , & MapPanel : : closeSettings , this , & SettingsWindow : : closeSettings ) ;
# endif
# endif
@ -367,7 +367,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
nav_btns - > addButton ( btn ) ;
nav_btns - > addButton ( btn ) ;
sidebar_layout - > addWidget ( btn , 0 , Qt : : AlignRight ) ;
sidebar_layout - > addWidget ( btn , 0 , Qt : : AlignRight ) ;
const int lr_margin = name ! = " Network " ? 50 : 0 ; // Network panel handles its own margins
const int lr_margin = name ! = tr ( " Network " ) ? 50 : 0 ; // Network panel handles its own margins
panel - > setContentsMargins ( lr_margin , 25 , lr_margin , 25 ) ;
panel - > setContentsMargins ( lr_margin , 25 , lr_margin , 25 ) ;
ScrollView * panel_frame = new ScrollView ( panel , this ) ;
ScrollView * panel_frame = new ScrollView ( panel , this ) ;