mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 12:02:09 +08:00
more setup (#21628)
* fix up kb * blue continue * dashcam * clean up old-commit-hash: 62e63f0573a1d6d719fe3c4715d00b3893306c73
This commit is contained in:
@@ -15,11 +15,9 @@
|
||||
#include "selfdrive/ui/qt/offroad/networking.h"
|
||||
#include "selfdrive/ui/qt/widgets/input.h"
|
||||
|
||||
const char* USER_AGENT = "AGNOSSetup-0.1";
|
||||
const char* USER_AGENT = "AGNOSSetup-0.1";
|
||||
const QString DASHCAM_URL = "https://dashcam.comma.ai";
|
||||
|
||||
const QString TEST_URL = "https://api.commadotai.com/v1/me";
|
||||
|
||||
void Setup::download(QString url) {
|
||||
CURL *curl = curl_easy_init();
|
||||
if (!curl) {
|
||||
@@ -113,11 +111,12 @@ QWidget * Setup::network_setup() {
|
||||
|
||||
QPushButton *cont = new QPushButton();
|
||||
cont->setObjectName("navBtn");
|
||||
cont->setProperty("primary", true);
|
||||
QObject::connect(cont, &QPushButton::clicked, this, &Setup::nextPage);
|
||||
blayout->addWidget(cont);
|
||||
|
||||
// setup timer for testing internet connection
|
||||
HttpRequest *request = new HttpRequest(this, TEST_URL, false, 2500);
|
||||
HttpRequest *request = new HttpRequest(this, DASHCAM_URL, false, 2500);
|
||||
QObject::connect(request, &HttpRequest::requestDone, [=](bool success) {
|
||||
cont->setEnabled(success);
|
||||
cont->setText(success ? "Continue" : "Waiting for internet");
|
||||
@@ -126,7 +125,7 @@ QWidget * Setup::network_setup() {
|
||||
QTimer *timer = new QTimer(this);
|
||||
QObject::connect(timer, &QTimer::timeout, [=]() {
|
||||
if (!request->active() && cont->isVisible()) {
|
||||
request->sendRequest(TEST_URL);
|
||||
request->sendRequest(DASHCAM_URL);
|
||||
}
|
||||
});
|
||||
timer->start(1000);
|
||||
@@ -205,6 +204,7 @@ QWidget * Setup::software_selection() {
|
||||
QPushButton *cont = new QPushButton("Continue");
|
||||
cont->setObjectName("navBtn");
|
||||
cont->setEnabled(false);
|
||||
cont->setProperty("primary", true);
|
||||
blayout->addWidget(cont);
|
||||
|
||||
QObject::connect(cont, &QPushButton::clicked, [=]() {
|
||||
@@ -332,8 +332,9 @@ Setup::Setup(QWidget *parent) : QStackedWidget(parent) {
|
||||
border-radius: 10px;
|
||||
background-color: #333333;
|
||||
}
|
||||
QPushButton#navBtn:disabled {
|
||||
QPushButton#navBtn:disabled, QPushButton[primary='true']:disabled {
|
||||
color: #808080;
|
||||
background-color: #333333;
|
||||
}
|
||||
QPushButton#navBtn:pressed {
|
||||
background-color: #444444;
|
||||
|
||||
@@ -139,7 +139,7 @@ void InputDialog::show() {
|
||||
void InputDialog::handleInput(const QString &s) {
|
||||
if (!QString::compare(s,"⌫")) {
|
||||
line->backspace();
|
||||
} else if (!QString::compare(s,"⏎")) {
|
||||
} else if (!QString::compare(s,"→")) {
|
||||
if (line->text().length() >= minLength) {
|
||||
done(QDialog::Accepted);
|
||||
emitText(line->text());
|
||||
@@ -171,7 +171,7 @@ ConfirmationDialog::ConfirmationDialog(const QString &prompt_text, const QString
|
||||
prompt = new QLabel(prompt_text, this);
|
||||
prompt->setWordWrap(true);
|
||||
prompt->setAlignment(Qt::AlignHCenter);
|
||||
prompt->setStyleSheet(R"(font-size: 55px; font-weight: 400;)");
|
||||
prompt->setStyleSheet("font-size: 55px; font-weight: 400;");
|
||||
main_layout->addWidget(prompt, 1, Qt::AlignTop | Qt::AlignHCenter);
|
||||
|
||||
// cancel + confirm buttons
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
#include <QButtonGroup>
|
||||
#include <QHBoxLayout>
|
||||
#include <QMap>
|
||||
#include <QPushButton>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
const int DEFAULT_STRETCH = 1;
|
||||
const int SPACEBAR_STRETCH = 3;
|
||||
|
||||
const QString BACKSPACE_KEY = "⌫";
|
||||
const QString ENTER_KEY = "⏎";
|
||||
const QString ENTER_KEY = "→";
|
||||
|
||||
const QMap<QString, int> KEY_STRETCH = {{" ", 5}, {ENTER_KEY, 2}};
|
||||
|
||||
const QStringList CONTROL_BUTTONS = {"↑", "↓", "ABC", "#+=", "123"};
|
||||
|
||||
@@ -41,7 +41,7 @@ KeyboardLayout::KeyboardLayout(QWidget* parent, const std::vector<QVector<QStrin
|
||||
}
|
||||
btn->setFixedHeight(135 + key_spacing_vertical);
|
||||
btn_group->addButton(btn);
|
||||
hlayout->addWidget(btn, p == QString(" ") ? SPACEBAR_STRETCH : DEFAULT_STRETCH);
|
||||
hlayout->addWidget(btn, KEY_STRETCH.value(p, 1));
|
||||
}
|
||||
|
||||
if (main_layout->count() == 1) {
|
||||
|
||||
Reference in New Issue
Block a user