Skip to content

Commit

Permalink
add developer tab with ssh keys toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
BBBmau committed Oct 16, 2024
1 parent b425240 commit 253430a
Show file tree
Hide file tree
Showing 15 changed files with 841 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 @@ -28,7 +28,7 @@ qt_libs = [widgets, qt_util] + base_libs

qt_src = ["main.cc", "ui.cc", "qt/sidebar.cc", "qt/body.cc",
"qt/window.cc", "qt/home.cc", "qt/offroad/settings.cc",
"qt/offroad/software_settings.cc", "qt/offroad/onboarding.cc",
"qt/offroad/software_settings.cc", "qt/offroad/developer_settings.cc", "qt/offroad/onboarding.cc",
"qt/offroad/driverview.cc", "qt/offroad/experimental_mode.cc",
"qt/onroad/onroad_home.cc", "qt/onroad/annotated_camera.cc", "qt/onroad/model.cc",
"qt/onroad/buttons.cc", "qt/onroad/alerts.cc", "qt/onroad/driver_monitoring.cc", "qt/onroad/hud.cc"]
Expand Down
44 changes: 44 additions & 0 deletions selfdrive/ui/qt/offroad/developer_settings.cc
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#include "selfdrive/ui/qt/offroad/settings.h"

#include <cassert>
#include <cmath>
#include <string>

#include <QDebug>
#include <QLabel>

#include "common/params.h"
#include "common/util.h"
#include "selfdrive/ui/ui.h"
#include "selfdrive/ui/qt/util.h"
#include "selfdrive/ui/qt/widgets/controls.h"
#include "selfdrive/ui/qt/widgets/ssh_keys.h"
#include "selfdrive/ui/qt/widgets/input.h"
#include "system/hardware/hw.h"

DeveloperPanel::DeveloperPanel(QWidget* parent) : ListWidget(parent) {
addItem(new SshToggle());

// if (!params.getBool("IsTestedBranch")) {
// addItme(joystickModeToggle);
// addItme(longitudinalReportButton);
// }

// fs_watch = new ParamWatcher(this);
// QObject::connect(fs_watch, &ParamWatcher::paramChanged, [=](const QString &param_name, const QString &param_value) {
// updateLabels();
// });

// connect(uiState(), &UIState::offroadTransition, [=](bool offroad) {
// is_onroad = !offroad;
// updateLabels();
// });

// updateLabels();
}

// Add this function implementation
void DeveloperPanel::showEvent(QShowEvent* event) {
ListWidget::showEvent(event);
// Add any custom behavior for when the panel is shown
}
1 change: 1 addition & 0 deletions selfdrive/ui/qt/offroad/settings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ SettingsWindow::SettingsWindow(QWidget *parent) : QFrame(parent) {
{tr("Network"), networking},
{tr("Toggles"), toggles},
{tr("Software"), new SoftwarePanel(this)},
{tr("Developer"), new DeveloperPanel(this)},
};

nav_btns = new QButtonGroup(this);
Expand Down
22 changes: 22 additions & 0 deletions selfdrive/ui/qt/offroad/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,25 @@ class SoftwarePanel : public ListWidget {
Params params;
ParamWatcher *fs_watch;
};

class DeveloperPanel : public ListWidget {
Q_OBJECT
public:
explicit DeveloperPanel(QWidget* parent = nullptr);

private:
void showEvent(QShowEvent *event) override;
void updateLabels();
void checkForUpdates();

bool is_onroad = false;

QLabel *onroadLbl;
LabelControl *versionLbl;
ButtonControl *installBtn;
ButtonControl *downloadBtn;
ButtonControl *targetBranchBtn;

Params params;
ParamWatcher *fs_watch;
};
79 changes: 79 additions & 0 deletions selfdrive/ui/translations/main_ar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,81 @@
<translation>رفض، إلغاء التثبيت %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Updates are only downloaded while the car is off.</source>
<translation type="obsolete">يتم تحميل التحديثات فقط عندما تكون السيارة متوقفة.</translation>
</message>
<message>
<source>Current Version</source>
<translation type="obsolete">النسخة الحالية</translation>
</message>
<message>
<source>Download</source>
<translation type="obsolete">تنزيل</translation>
</message>
<message>
<source>CHECK</source>
<translation type="obsolete">التحقق</translation>
</message>
<message>
<source>Install Update</source>
<translation type="obsolete">تثبيت التحديث</translation>
</message>
<message>
<source>INSTALL</source>
<translation type="obsolete">تثبيت</translation>
</message>
<message>
<source>Target Branch</source>
<translation type="obsolete">فرع الهدف</translation>
</message>
<message>
<source>SELECT</source>
<translation type="obsolete">اختيار</translation>
</message>
<message>
<source>Select a branch</source>
<translation type="obsolete">اختر فرعاً</translation>
</message>
<message>
<source>Uninstall %1</source>
<translation type="obsolete">إلغاء التثبيت %1</translation>
</message>
<message>
<source>UNINSTALL</source>
<translation type="obsolete">إلغاء التثبيت</translation>
</message>
<message>
<source>Are you sure you want to uninstall?</source>
<translation type="obsolete">هل أنت متأكد أنك تريد إلغاء التثبيت؟</translation>
</message>
<message>
<source>Uninstall</source>
<translation type="obsolete">إلغاء التثبيت</translation>
</message>
<message>
<source>failed to check for update</source>
<translation type="obsolete">فشل التحقق من التحديث</translation>
</message>
<message>
<source>DOWNLOAD</source>
<translation type="obsolete">تنزيل</translation>
</message>
<message>
<source>update available</source>
<translation type="obsolete">يتوفر تحديث</translation>
</message>
<message>
<source>never</source>
<translation type="obsolete">إطلاقاً</translation>
</message>
<message>
<source>up to date, last checked %1</source>
<translation type="obsolete">أحدث نسخة، آخر تحقق %1</translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -618,6 +693,10 @@ This may take up to a minute.</source>
<source>Software</source>
<translation>البرنامج</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
59 changes: 59 additions & 0 deletions selfdrive/ui/translations/main_de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,61 @@
<translation>Ablehnen, deinstallieren %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Updates are only downloaded while the car is off.</source>
<translation type="obsolete">Updates werden nur heruntergeladen, wenn das Auto aus ist.</translation>
</message>
<message>
<source>Current Version</source>
<translation type="obsolete">Aktuelle Version</translation>
</message>
<message>
<source>Download</source>
<translation type="obsolete">Download</translation>
</message>
<message>
<source>CHECK</source>
<translation type="obsolete">ÜBERPRÜFEN</translation>
</message>
<message>
<source>Install Update</source>
<translation type="obsolete">Update installieren</translation>
</message>
<message>
<source>INSTALL</source>
<translation type="obsolete">INSTALLIEREN</translation>
</message>
<message>
<source>Target Branch</source>
<translation type="obsolete">Ziel Branch</translation>
</message>
<message>
<source>SELECT</source>
<translation type="obsolete">AUSWÄHLEN</translation>
</message>
<message>
<source>Select a branch</source>
<translation type="obsolete">Wähle einen Branch</translation>
</message>
<message>
<source>Uninstall %1</source>
<translation type="obsolete">Deinstalliere %1</translation>
</message>
<message>
<source>UNINSTALL</source>
<translation type="obsolete">DEINSTALL</translation>
</message>
<message>
<source>Are you sure you want to uninstall?</source>
<translation type="obsolete">Bist du sicher, dass du Openpilot entfernen möchtest?</translation>
</message>
<message>
<source>Uninstall</source>
<translation type="obsolete">Deinstallieren</translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -600,6 +655,10 @@ This may take up to a minute.</source>
<source>Software</source>
<translation>Software</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
79 changes: 79 additions & 0 deletions selfdrive/ui/translations/main_es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,81 @@
<translation>Rechazar, desinstalar %1</translation>
</message>
</context>
<context>
<name>DeveloperPanel</name>
<message>
<source>Updates are only downloaded while the car is off.</source>
<translation type="obsolete">Actualizaciones solo se descargan con el auto apagado.</translation>
</message>
<message>
<source>Current Version</source>
<translation type="obsolete">Versión Actual</translation>
</message>
<message>
<source>Download</source>
<translation type="obsolete">Descargar</translation>
</message>
<message>
<source>CHECK</source>
<translation type="obsolete">VERIFICAR</translation>
</message>
<message>
<source>Install Update</source>
<translation type="obsolete">Actualizar</translation>
</message>
<message>
<source>INSTALL</source>
<translation type="obsolete">INSTALAR</translation>
</message>
<message>
<source>Target Branch</source>
<translation type="obsolete">Rama objetivo</translation>
</message>
<message>
<source>SELECT</source>
<translation type="obsolete">SELECCIONAR</translation>
</message>
<message>
<source>Select a branch</source>
<translation type="obsolete">Selecione una rama</translation>
</message>
<message>
<source>Uninstall %1</source>
<translation type="obsolete">Desinstalar %1</translation>
</message>
<message>
<source>UNINSTALL</source>
<translation type="obsolete">DESINSTALAR</translation>
</message>
<message>
<source>Are you sure you want to uninstall?</source>
<translation type="obsolete">¿Seguro qué desea desinstalar?</translation>
</message>
<message>
<source>Uninstall</source>
<translation type="obsolete">Desinstalar</translation>
</message>
<message>
<source>failed to check for update</source>
<translation type="obsolete">no se pudo buscar actualizaciones</translation>
</message>
<message>
<source>DOWNLOAD</source>
<translation type="obsolete">DESCARGAR</translation>
</message>
<message>
<source>update available</source>
<translation type="obsolete">actualización disponible</translation>
</message>
<message>
<source>never</source>
<translation type="obsolete">nunca</translation>
</message>
<message>
<source>up to date, last checked %1</source>
<translation type="obsolete">actualizado, último chequeo %1</translation>
</message>
</context>
<context>
<name>DevicePanel</name>
<message>
Expand Down Expand Up @@ -602,6 +677,10 @@ Esto puede tardar un minuto.</translation>
<source>Software</source>
<translation>Software</translation>
</message>
<message>
<source>Developer</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>Setup</name>
Expand Down
Loading

0 comments on commit 253430a

Please sign in to comment.