setup: warning for custom software (#35556)

* custom warn

* Update SConscript

* bump
pull/35558/head
Maxime Desroches 4 days ago committed by GitHub
parent 2a9e35609b
commit 762f11c620
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      selfdrive/ui/SConscript
  2. 74
      selfdrive/ui/qt/setup/setup.cc
  3. 3
      selfdrive/ui/qt/setup/setup.h

@ -105,7 +105,7 @@ if GetOption('extras'):
obj = raylib_env.Object(f"installer/installers/installer_{name}.o", ["installer/installer.cc"], CPPDEFINES=d) obj = raylib_env.Object(f"installer/installers/installer_{name}.o", ["installer/installer.cc"], CPPDEFINES=d)
f = raylib_env.Program(f"installer/installers/installer_{name}", [obj, cont, inter], LIBS=raylib_libs) f = raylib_env.Program(f"installer/installers/installer_{name}", [obj, cont, inter], LIBS=raylib_libs)
# keep installers small # keep installers small
assert f[0].get_size() < 1300*1e3, f[0].get_size() assert f[0].get_size() < 1900*1e3, f[0].get_size()
# build watch3 # build watch3
if arch in ['x86_64', 'aarch64', 'Darwin'] or GetOption('extras'): if arch in ['x86_64', 'aarch64', 'Darwin'] or GetOption('extras'):

@ -136,6 +136,59 @@ QWidget * Setup::low_voltage() {
return widget; return widget;
} }
QWidget * Setup::custom_software_warning() {
QWidget *widget = new QWidget();
QVBoxLayout *main_layout = new QVBoxLayout(widget);
main_layout->setContentsMargins(55, 0, 55, 55);
main_layout->setSpacing(0);
QVBoxLayout *inner_layout = new QVBoxLayout();
inner_layout->setContentsMargins(110, 110, 300, 0);
main_layout->addLayout(inner_layout);
QLabel *title = new QLabel(tr("WARNING: Custom Software"));
title->setStyleSheet("font-size: 90px; font-weight: 500; color: #FF594F;");
inner_layout->addWidget(title, 0, Qt::AlignTop | Qt::AlignLeft);
inner_layout->addSpacing(25);
QLabel *body = new QLabel(tr("Use caution when installing third-party software. Third-party software has not been tested by comma, and may cause damage to your device and/or vehicle.\n\nIf you'd like to proceed, use https://flash.comma.ai to restore your device to a factory state later."));
body->setWordWrap(true);
body->setAlignment(Qt::AlignTop | Qt::AlignLeft);
body->setStyleSheet("font-size: 65px; font-weight: 300;");
inner_layout->addWidget(body);
inner_layout->addStretch();
QHBoxLayout *blayout = new QHBoxLayout();
blayout->setSpacing(50);
main_layout->addLayout(blayout, 0);
QPushButton *back = new QPushButton(tr("Back"));
back->setObjectName("navBtn");
blayout->addWidget(back);
QObject::connect(back, &QPushButton::clicked, this, &Setup::prevPage);
QPushButton *cont = new QPushButton(tr("Continue"));
cont->setObjectName("navBtn");
blayout->addWidget(cont);
QObject::connect(cont, &QPushButton::clicked, this, [=]() {
QTimer::singleShot(0, [=]() {
setCurrentWidget(downloading_widget);
});
QString url = InputDialog::getText(tr("Enter URL"), this, tr("for Custom Software"));
if (!url.isEmpty()) {
QTimer::singleShot(1000, this, [=]() {
download(url);
});
} else {
setCurrentWidget(software_selection_widget);
}
});
return widget;
}
QWidget * Setup::getting_started() { QWidget * Setup::getting_started() {
QWidget *widget = new QWidget(); QWidget *widget = new QWidget();
@ -305,20 +358,17 @@ QWidget * Setup::software_selection() {
blayout->addWidget(cont); blayout->addWidget(cont);
QObject::connect(cont, &QPushButton::clicked, [=]() { QObject::connect(cont, &QPushButton::clicked, [=]() {
auto w = currentWidget(); if (group->checkedButton() != openpilot) {
QTimer::singleShot(0, [=]() {
setCurrentWidget(custom_software_warning_widget);
});
} else {
QTimer::singleShot(0, [=]() { QTimer::singleShot(0, [=]() {
setCurrentWidget(downloading_widget); setCurrentWidget(downloading_widget);
}); });
QString url = OPENPILOT_URL;
if (group->checkedButton() != openpilot) {
url = InputDialog::getText(tr("Enter URL"), this, tr("for Custom Software"));
}
if (!url.isEmpty()) {
QTimer::singleShot(1000, this, [=]() { QTimer::singleShot(1000, this, [=]() {
download(url); download(OPENPILOT_URL);
}); });
} else {
setCurrentWidget(w);
} }
}); });
@ -415,8 +465,10 @@ Setup::Setup(QWidget *parent) : QStackedWidget(parent) {
addWidget(getting_started()); addWidget(getting_started());
addWidget(network_setup()); addWidget(network_setup());
addWidget(software_selection()); software_selection_widget = software_selection();
addWidget(software_selection_widget);
custom_software_warning_widget = custom_software_warning();
addWidget(custom_software_warning_widget);
downloading_widget = downloading(); downloading_widget = downloading();
addWidget(downloading_widget); addWidget(downloading_widget);

@ -15,6 +15,7 @@ public:
private: private:
void selectLanguage(); void selectLanguage();
QWidget *low_voltage(); QWidget *low_voltage();
QWidget *custom_software_warning();
QWidget *getting_started(); QWidget *getting_started();
QWidget *network_setup(); QWidget *network_setup();
QWidget *software_selection(); QWidget *software_selection();
@ -23,6 +24,8 @@ private:
QWidget *failed_widget; QWidget *failed_widget;
QWidget *downloading_widget; QWidget *downloading_widget;
QWidget *custom_software_warning_widget;
QWidget *software_selection_widget;
QTranslator translator; QTranslator translator;
signals: signals:

Loading…
Cancel
Save