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

old-commit-hash: dd959412e3dd19a0523ab564fb298e05cc704b89
This commit is contained in:
Joost Wooning
2021-06-21 13:57:13 +02:00
committed by GitHub
parent 4f3ad7284c
commit 3590f9b56f
+2 -14
View File
@@ -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"(