onboarding: small cleanup (#21351)

pull/21357/head
Dean Lee 4 years ago committed by GitHub
parent 56d5db5766
commit 2433cb28bb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      selfdrive/ui/qt/offroad/onboarding.cc
  2. 5
      selfdrive/ui/qt/offroad/onboarding.h

@ -11,7 +11,6 @@
void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) { void TrainingGuide::mouseReleaseEvent(QMouseEvent *e) {
QPoint touch = QPoint(e->x(), e->y()) - imageCorner; QPoint touch = QPoint(e->x(), e->y()) - imageCorner;
//qDebug() << touch.x() << ", " << touch.y();
// Check for restart // Check for restart
if (currentIndex == (boundingBox.size() - 1) && 200 <= touch.x() && touch.x() <= 920 && if (currentIndex == (boundingBox.size() - 1) && 200 <= touch.x() && touch.x() <= 920 &&
@ -78,7 +77,7 @@ void TermsPage::showEvent(QShowEvent *event) {
QHBoxLayout* buttons = new QHBoxLayout; QHBoxLayout* buttons = new QHBoxLayout;
main_layout->addLayout(buttons); main_layout->addLayout(buttons);
decline_btn = new QPushButton("Decline"); QPushButton *decline_btn = new QPushButton("Decline");
buttons->addWidget(decline_btn); buttons->addWidget(decline_btn);
QObject::connect(decline_btn, &QPushButton::released, this, &TermsPage::declinedTerms); QObject::connect(decline_btn, &QPushButton::released, this, &TermsPage::declinedTerms);
@ -93,7 +92,6 @@ void TermsPage::showEvent(QShowEvent *event) {
void TermsPage::enableAccept() { void TermsPage::enableAccept() {
accept_btn->setText("Accept"); accept_btn->setText("Accept");
accept_btn->setEnabled(true); accept_btn->setEnabled(true);
return;
} }
void DeclinePage::showEvent(QShowEvent *event) { void DeclinePage::showEvent(QShowEvent *event) {
@ -113,13 +111,13 @@ void DeclinePage::showEvent(QShowEvent *event) {
QHBoxLayout* buttons = new QHBoxLayout; QHBoxLayout* buttons = new QHBoxLayout;
main_layout->addLayout(buttons); main_layout->addLayout(buttons);
back_btn = new QPushButton("Back"); QPushButton *back_btn = new QPushButton("Back");
buttons->addWidget(back_btn); buttons->addWidget(back_btn);
buttons->addSpacing(50); buttons->addSpacing(50);
QObject::connect(back_btn, &QPushButton::released, this, &DeclinePage::getBack); QObject::connect(back_btn, &QPushButton::released, this, &DeclinePage::getBack);
uninstall_btn = new QPushButton("Decline, uninstall openpilot"); QPushButton *uninstall_btn = new QPushButton("Decline, uninstall openpilot");
uninstall_btn->setStyleSheet("background-color: #E22C2C;"); uninstall_btn->setStyleSheet("background-color: #E22C2C;");
buttons->addWidget(uninstall_btn); buttons->addWidget(uninstall_btn);
@ -131,8 +129,8 @@ void DeclinePage::showEvent(QShowEvent *event) {
} }
void OnboardingWindow::updateActiveScreen() { void OnboardingWindow::updateActiveScreen() {
accepted_terms = params.get("HasAcceptedTerms") == current_terms_version; bool accepted_terms = params.get("HasAcceptedTerms") == current_terms_version;
training_done = params.get("CompletedTrainingVersion") == current_training_version; bool training_done = params.get("CompletedTrainingVersion") == current_training_version;
if (!accepted_terms) { if (!accepted_terms) {
setCurrentIndex(0); setCurrentIndex(0);
} else if (!training_done && !params.getBool("Passive")) { } else if (!training_done && !params.getBool("Passive")) {

@ -64,7 +64,6 @@ private:
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
QPushButton *accept_btn; QPushButton *accept_btn;
QPushButton *decline_btn;
signals: signals:
void acceptedTerms(); void acceptedTerms();
@ -79,8 +78,6 @@ public:
private: private:
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
QPushButton *back_btn;
QPushButton *uninstall_btn;
signals: signals:
void getBack(); void getBack();
@ -99,8 +96,6 @@ private:
Params params; Params params;
std::string current_terms_version; std::string current_terms_version;
std::string current_training_version; std::string current_training_version;
bool accepted_terms = false;
bool training_done = false;
signals: signals:
void onboardingDone(); void onboardingDone();

Loading…
Cancel
Save