| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -5,6 +5,7 @@ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "selfdrive/ui/qt/qt_window.h" | 
					 | 
					 | 
					 | 
					#include "selfdrive/ui/qt/qt_window.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					#include "selfdrive/hardware/hw.h" | 
					 | 
					 | 
					 | 
					#include "selfdrive/hardware/hw.h" | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					QDialogBase::QDialogBase(QWidget *parent) : QDialog(parent) { | 
					 | 
					 | 
					 | 
					QDialogBase::QDialogBase(QWidget *parent) : QDialog(parent) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  Q_ASSERT(parent != nullptr); | 
					 | 
					 | 
					 | 
					  Q_ASSERT(parent != nullptr); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  parent->installEventFilter(this); | 
					 | 
					 | 
					 | 
					  parent->installEventFilter(this); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -17,25 +18,32 @@ bool QDialogBase::eventFilter(QObject *o, QEvent *e) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  return QDialog::eventFilter(o, e); | 
					 | 
					 | 
					 | 
					  return QDialog::eventFilter(o, e); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialogBase(parent) { | 
					 | 
					 | 
					 | 
					InputDialog::InputDialog(const QString &title, QWidget *parent, const QString &subtitle, bool secret) : QDialogBase(parent) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout = new QVBoxLayout(this); | 
					 | 
					 | 
					 | 
					  main_layout = new QVBoxLayout(this); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->setContentsMargins(50, 50, 50, 50); | 
					 | 
					 | 
					 | 
					  main_layout->setContentsMargins(50, 55, 50, 50); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->setSpacing(20); | 
					 | 
					 | 
					 | 
					  main_layout->setSpacing(0); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // build header
 | 
					 | 
					 | 
					 | 
					  // build header
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QHBoxLayout *header_layout = new QHBoxLayout(); | 
					 | 
					 | 
					 | 
					  QHBoxLayout *header_layout = new QHBoxLayout(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  label = new QLabel(prompt_text, this); | 
					 | 
					 | 
					 | 
					  QVBoxLayout *vlayout = new QVBoxLayout; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  label->setStyleSheet(R"(font-size: 75px; font-weight: 500;)"); | 
					 | 
					 | 
					 | 
					  header_layout->addLayout(vlayout); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  header_layout->addWidget(label, 1, Qt::AlignLeft); | 
					 | 
					 | 
					 | 
					  label = new QLabel(title, this); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  label->setStyleSheet("font-size: 90px; font-weight: bold;"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  vlayout->addWidget(label, 1, Qt::AlignTop | Qt::AlignLeft); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if (!subtitle.isEmpty()) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    sublabel = new QLabel(subtitle, this); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    sublabel->setStyleSheet("font-size: 55px; font-weight: light; color: #BDBDBD;"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    vlayout->addWidget(sublabel, 1, Qt::AlignTop | Qt::AlignLeft); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QPushButton* cancel_btn = new QPushButton("Cancel"); | 
					 | 
					 | 
					 | 
					  QPushButton* cancel_btn = new QPushButton("Cancel"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  cancel_btn->setFixedSize(386, 125); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  cancel_btn->setStyleSheet(R"( | 
					 | 
					 | 
					 | 
					  cancel_btn->setStyleSheet(R"( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    padding: 30px; | 
					 | 
					 | 
					 | 
					    font-size: 48px; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    padding-right: 45px; | 
					 | 
					 | 
					 | 
					    border-radius: 10px; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    padding-left: 45px; | 
					 | 
					 | 
					 | 
					    color: #E4E4E4; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    border-radius: 7px; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    font-size: 45px; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    background-color: #444444; | 
					 | 
					 | 
					 | 
					    background-color: #444444; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  )"); | 
					 | 
					 | 
					 | 
					  )"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  header_layout->addWidget(cancel_btn, 0, Qt::AlignRight); | 
					 | 
					 | 
					 | 
					  header_layout->addWidget(cancel_btn, 0, Qt::AlignRight); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -45,17 +53,52 @@ InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialogB | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addLayout(header_layout); | 
					 | 
					 | 
					 | 
					  main_layout->addLayout(header_layout); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  // text box
 | 
					 | 
					 | 
					 | 
					  // text box
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addSpacing(20); | 
					 | 
					 | 
					 | 
					  main_layout->addStretch(2); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  line = new QLineEdit(); | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  line->setStyleSheet(R"( | 
					 | 
					 | 
					 | 
					  QWidget *textbox_widget = new QWidget; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  textbox_widget->setObjectName("textbox"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  QHBoxLayout *textbox_layout = new QHBoxLayout(textbox_widget); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  textbox_layout->setContentsMargins(50, 0, 50, 0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  textbox_widget->setStyleSheet(R"( | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    #textbox { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      margin-left: 50px; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      margin-right: 50px; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      border: none; | 
					 | 
					 | 
					 | 
					      border: none; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    background-color: #444444; | 
					 | 
					 | 
					 | 
					      border-radius: 0; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      border-bottom: 3px solid #BDBDBD; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    * { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      font-size: 80px; | 
					 | 
					 | 
					 | 
					      font-size: 80px; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    font-weight: 500; | 
					 | 
					 | 
					 | 
					      font-weight: light; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    padding: 10px; | 
					 | 
					 | 
					 | 
					      background-color: transparent; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  )"); | 
					 | 
					 | 
					 | 
					  )"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addWidget(line, 1, Qt::AlignTop); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  line = new QLineEdit(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  textbox_layout->addWidget(line, 1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  if (secret) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    eye_btn = new QPushButton(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    eye_btn->setCheckable(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    QObject::connect(eye_btn, &QPushButton::toggled, [=](bool checked) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      if (checked) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        eye_btn->setIcon(QIcon("../assets/img_eye_closed.svg")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        eye_btn->setIconSize(QSize(81, 54)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        line->setEchoMode(QLineEdit::PasswordEchoOnEdit); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        eye_btn->setIcon(QIcon("../assets/img_eye_open.svg")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        eye_btn->setIconSize(QSize(81, 44)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        line->setEchoMode(QLineEdit::Normal); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    eye_btn->setChecked(true); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    textbox_layout->addWidget(eye_btn); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  main_layout->addWidget(textbox_widget, 0, Qt::AlignBottom); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  main_layout->addSpacing(25); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  k = new Keyboard(this); | 
					 | 
					 | 
					 | 
					  k = new Keyboard(this); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  QObject::connect(k, &Keyboard::emitButton, this, &InputDialog::handleInput); | 
					 | 
					 | 
					 | 
					  QObject::connect(k, &Keyboard::emitButton, this, &InputDialog::handleInput); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  main_layout->addWidget(k, 2, Qt::AlignBottom); | 
					 | 
					 | 
					 | 
					  main_layout->addWidget(k, 2, Qt::AlignBottom); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -68,11 +111,11 @@ InputDialog::InputDialog(const QString &prompt_text, QWidget *parent) : QDialogB | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      background-color: black; | 
					 | 
					 | 
					 | 
					      background-color: black; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  )"); | 
					 | 
					 | 
					 | 
					  )"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					} | 
					 | 
					 | 
					 | 
					} | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					QString InputDialog::getText(const QString &prompt, QWidget *parent, int minLength, const QString &defaultText) { | 
					 | 
					 | 
					 | 
					QString InputDialog::getText(const QString &prompt, QWidget *parent, const QString &subtitle, | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  InputDialog d = InputDialog(prompt, parent); | 
					 | 
					 | 
					 | 
					                             bool secret, int minLength, const QString &defaultText) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					  InputDialog d = InputDialog(prompt, parent, subtitle, secret); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  d.line->setText(defaultText); | 
					 | 
					 | 
					 | 
					  d.line->setText(defaultText); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  d.setMinLength(minLength); | 
					 | 
					 | 
					 | 
					  d.setMinLength(minLength); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					  const int ret = d.exec(); | 
					 | 
					 | 
					 | 
					  const int ret = d.exec(); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |