Change QR code to url for pairing with both explorer and connect (#21314)

pull/21359/head
Joost Wooning 4 years ago committed by GitHub
parent 22b632f407
commit dd959412e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      selfdrive/ui/qt/widgets/setup.cc

@ -10,7 +10,6 @@
#include <QVBoxLayout>
#include <QrCode.hpp>
#include "selfdrive/common/params.h"
#include "selfdrive/ui/qt/request_repeater.h"
using qrcodegen::QrCode;
@ -31,19 +30,8 @@ void PairingQRWidget::showEvent(QShowEvent *event) {
}
void PairingQRWidget::refresh() {
Params params;
QString IMEI = QString::fromStdString(params.get("IMEI"));
QString serial = QString::fromStdString(params.get("HardwareSerial"));
if (std::min(IMEI.length(), serial.length()) <= 5) {
qrCode->setText("Error getting serial: contact support");
qrCode->setWordWrap(true);
qrCode->setStyleSheet(R"(font-size: 60px;)");
return;
}
QString pairToken = CommaApi::create_jwt({{"pair", true}});
QString qrString = IMEI + "--" + serial + "--" + pairToken;
QString qrString = "https://my.comma.ai/?pair=" + pairToken;
this->updateQrCode(qrString);
}
@ -189,7 +177,7 @@ SetupWidget::SetupWidget(QWidget* parent) : QFrame(parent) {
QVBoxLayout* qrLayout = new QVBoxLayout(q);
qrLayout->addSpacing(30);
QLabel* qrLabel = new QLabel("Scan with comma connect!");
QLabel* qrLabel = new QLabel("Scan QR code to pair!");
qrLabel->setWordWrap(true);
qrLabel->setAlignment(Qt::AlignHCenter);
qrLabel->setStyleSheet(R"(

Loading…
Cancel
Save