Skip to content

Commit

Permalink
ui: add WiFiPromptWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam committed May 24, 2023
1 parent 210d502 commit 60cb3c4
Show file tree
Hide file tree
Showing 9 changed files with 142 additions and 1 deletion.
2 changes: 1 addition & 1 deletion selfdrive/ui/SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ if arch == "Darwin":
qt_env['FRAMEWORKS'] += ['OpenCL']

qt_util = qt_env.Library("qt_util", ["#selfdrive/ui/qt/api.cc", "#selfdrive/ui/qt/util.cc"], LIBS=base_libs)
widgets_src = ["ui.cc", "qt/widgets/input.cc",
widgets_src = ["ui.cc", "qt/widgets/input.cc", "qt/widgets/wifi.cc",
"qt/widgets/ssh_keys.cc", "qt/widgets/toggle.cc", "qt/widgets/controls.cc",
"qt/widgets/offroad_alerts.cc", "qt/widgets/prime.cc", "qt/widgets/keyboard.cc",
"qt/widgets/scrollview.cc", "qt/widgets/cameraview.cc", "#third_party/qrcode/QrCode.cc",
Expand Down
41 changes: 41 additions & 0 deletions selfdrive/ui/qt/widgets/wifi.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#include "selfdrive/ui/qt/widgets/wifi.h"

#include <QHBoxLayout>
#include <QLabel>
#include <QPushButton>

WiFiPromptWidget::WiFiPromptWidget(QWidget *parent) : QWidget(parent) {
QVBoxLayout *main_layout = new QVBoxLayout(this);
main_layout->setContentsMargins(48, 48, 48, 32);
main_layout->setSpacing(32);

QHBoxLayout *title_layout = new QHBoxLayout;
{
// TODO: icon pixmap
QLabel *title = new QLabel(tr("Setup Wi-Fi"));
title->setStyleSheet("font-size: 64px; font-weight: 700;");
title_layout->addWidget(title);
title_layout->addStretch();
}
main_layout->addLayout(title_layout);

QLabel *desc = new QLabel(tr("Connect to Wi-Fi to upload driving data and help improve openpilot"));
desc->setStyleSheet("font-size: 36px;");
desc->setWordWrap(true);
main_layout->addWidget(desc);

QPushButton *settings_btn = new QPushButton(tr("Open Settings"));
settings_btn->setContentsMargins(96, 32, 96, 32);
settings_btn->setStyleSheet(R"(
QPushButton {
font-size: 48px;
font-weight: 500;
border-radius: 10px;
background-color: #465BEA;
}
QPushButton:pressed {
background-color: #3049F4;
}
)");
main_layout->addWidget(settings_btn, 0, Qt::AlignHCenter);
}
10 changes: 10 additions & 0 deletions selfdrive/ui/qt/widgets/wifi.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

#include <QWidget>

class WiFiPromptWidget : public QWidget {
Q_OBJECT

public:
explicit WiFiPromptWidget(QWidget* parent);
};
15 changes: 15 additions & 0 deletions selfdrive/ui/translations/main_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1049,6 +1049,21 @@ This may take up to a minute.</source>
<translation>Aktualisierung fehlgeschlagen</translation>
</message>
</context>
<context>
<name>WiFiPromptWidget</name>
<message>
<source>Setup Wi-Fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Wi-Fi to upload driving data and help improve openpilot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WifiUI</name>
<message>
Expand Down
15 changes: 15 additions & 0 deletions selfdrive/ui/translations/main_ja.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,21 @@ This may take up to a minute.</source>
<translation>更新失敗</translation>
</message>
</context>
<context>
<name>WiFiPromptWidget</name>
<message>
<source>Setup Wi-Fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Wi-Fi to upload driving data and help improve openpilot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WifiUI</name>
<message>
Expand Down
15 changes: 15 additions & 0 deletions selfdrive/ui/translations/main_ko.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1044,6 +1044,21 @@ This may take up to a minute.</source>
<translation>업데이트 실패</translation>
</message>
</context>
<context>
<name>WiFiPromptWidget</name>
<message>
<source>Setup Wi-Fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Wi-Fi to upload driving data and help improve openpilot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WifiUI</name>
<message>
Expand Down
15 changes: 15 additions & 0 deletions selfdrive/ui/translations/main_pt-BR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1048,6 +1048,21 @@ Isso pode levar até um minuto.</translation>
<translation>Falha na atualização</translation>
</message>
</context>
<context>
<name>WiFiPromptWidget</name>
<message>
<source>Setup Wi-Fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Wi-Fi to upload driving data and help improve openpilot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WifiUI</name>
<message>
Expand Down
15 changes: 15 additions & 0 deletions selfdrive/ui/translations/main_zh-CHS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,21 @@ This may take up to a minute.</source>
<translation>更新失败</translation>
</message>
</context>
<context>
<name>WiFiPromptWidget</name>
<message>
<source>Setup Wi-Fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Wi-Fi to upload driving data and help improve openpilot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WifiUI</name>
<message>
Expand Down
15 changes: 15 additions & 0 deletions selfdrive/ui/translations/main_zh-CHT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,21 @@ This may take up to a minute.</source>
<translation>更新失敗</translation>
</message>
</context>
<context>
<name>WiFiPromptWidget</name>
<message>
<source>Setup Wi-Fi</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Connect to Wi-Fi to upload driving data and help improve openpilot</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Open Settings</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>WifiUI</name>
<message>
Expand Down

0 comments on commit 60cb3c4

Please sign in to comment.