From f934f5a6c95ad720a24ed5ea4c2ecef006fc41cf Mon Sep 17 00:00:00 2001 From: royjr Date: Thu, 24 Jul 2025 22:30:10 -0400 Subject: [PATCH] move to sp qt --- selfdrive/ui/SConscript | 2 +- selfdrive/ui/qt/offroad/developer_panel.cc | 3 --- selfdrive/ui/sunnypilot/SConscript | 1 + .../qt/offroad/settings/developer_panel.cc | 5 +++++ .../qt/widgets/external_storage.cc | 9 ++++++++- .../qt/widgets/external_storage.h | 18 +++++++----------- 6 files changed, 22 insertions(+), 16 deletions(-) rename selfdrive/ui/{ => sunnypilot}/qt/widgets/external_storage.cc (95%) rename selfdrive/ui/{ => sunnypilot}/qt/widgets/external_storage.h (63%) diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index c5ee10eb25..d883ca5b15 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -22,7 +22,7 @@ if not GetOption('stock_ui'): qt_env['CXXFLAGS'] += ["-Wno-deprecated-declarations"] qt_util = qt_env.Library("qt_util", ["#selfdrive/ui/qt/api.cc", "#selfdrive/ui/qt/util.cc"] + sp_qt_util, LIBS=base_libs) -widgets_src = ["qt/widgets/input.cc", "qt/widgets/wifi.cc", "qt/prime_state.cc", "qt/widgets/external_storage.cc", +widgets_src = ["qt/widgets/input.cc", "qt/widgets/wifi.cc", "qt/prime_state.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", diff --git a/selfdrive/ui/qt/offroad/developer_panel.cc b/selfdrive/ui/qt/offroad/developer_panel.cc index 8f992bde5f..fbfb16294b 100644 --- a/selfdrive/ui/qt/offroad/developer_panel.cc +++ b/selfdrive/ui/qt/offroad/developer_panel.cc @@ -1,6 +1,5 @@ #include "selfdrive/ui/qt/offroad/developer_panel.h" #include "selfdrive/ui/qt/widgets/ssh_keys.h" -#include "selfdrive/ui/qt/widgets/external_storage.h" #ifdef SUNNYPILOT #include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" @@ -17,8 +16,6 @@ DeveloperPanel::DeveloperPanel(SettingsWindow *parent) : ListWidget(parent) { addItem(new SshToggle()); addItem(new SshControl()); - addItem(new ExternalStorageControl()); - joystickToggle = new ParamControl("JoystickDebugMode", tr("Joystick Debug Mode"), "", ""); QObject::connect(joystickToggle, &ParamControl::toggleFlipped, [=](bool state) { params.putBool("LongitudinalManeuverMode", false); diff --git a/selfdrive/ui/sunnypilot/SConscript b/selfdrive/ui/sunnypilot/SConscript index 810338aae8..130c1c7182 100644 --- a/selfdrive/ui/sunnypilot/SConscript +++ b/selfdrive/ui/sunnypilot/SConscript @@ -7,6 +7,7 @@ widgets_src = [ "sunnypilot/qt/widgets/prime.cc", "sunnypilot/qt/widgets/scrollview.cc", "sunnypilot/qt/network/networking.cc", + "sunnypilot/qt/widgets/external_storage.cc", ] qt_util = [ diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/developer_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/developer_panel.cc index 5c9f0ff99e..e2ee8dc521 100644 --- a/selfdrive/ui/sunnypilot/qt/offroad/settings/developer_panel.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/developer_panel.cc @@ -5,9 +5,14 @@ * See the LICENSE.md file in the root directory for more details. */ #include "selfdrive/ui/sunnypilot/qt/offroad/settings/developer_panel.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/external_storage.h" DeveloperPanelSP::DeveloperPanelSP(SettingsWindow *parent) : DeveloperPanel(parent) { + #ifndef __APPLE__ + addItem(new ExternalStorageControl()); + #endif + // Advanced Controls Toggle showAdvancedControls = new ParamControlSP("ShowAdvancedControls", tr("Show Advanced Controls"), tr("Toggle visibility of advanced sunnypilot controls.\nThis only toggles the visibility of the controls; it does not toggle the actual control enabled/disabled state."), ""); addItem(showAdvancedControls); diff --git a/selfdrive/ui/qt/widgets/external_storage.cc b/selfdrive/ui/sunnypilot/qt/widgets/external_storage.cc similarity index 95% rename from selfdrive/ui/qt/widgets/external_storage.cc rename to selfdrive/ui/sunnypilot/qt/widgets/external_storage.cc index bee6977971..24a5d9ab73 100644 --- a/selfdrive/ui/qt/widgets/external_storage.cc +++ b/selfdrive/ui/sunnypilot/qt/widgets/external_storage.cc @@ -1,4 +1,11 @@ -#include "selfdrive/ui/qt/widgets/external_storage.h" +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + +#include "selfdrive/ui/sunnypilot/qt/widgets/external_storage.h" #include #include diff --git a/selfdrive/ui/qt/widgets/external_storage.h b/selfdrive/ui/sunnypilot/qt/widgets/external_storage.h similarity index 63% rename from selfdrive/ui/qt/widgets/external_storage.h rename to selfdrive/ui/sunnypilot/qt/widgets/external_storage.h index 7c27156533..8ad093234e 100644 --- a/selfdrive/ui/qt/widgets/external_storage.h +++ b/selfdrive/ui/sunnypilot/qt/widgets/external_storage.h @@ -1,15 +1,14 @@ +/** + * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. + * + * This file is part of sunnypilot and is licensed under the MIT License. + * See the LICENSE.md file in the root directory for more details. + */ + #pragma once -#include - #include "system/hardware/hw.h" - -#ifdef SUNNYPILOT #include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" -#define ButtonControl ButtonControlSP -#else -#include "selfdrive/ui/qt/widgets/controls.h" -#endif class ExternalStorageControl : public ButtonControl { Q_OBJECT @@ -24,9 +23,6 @@ private: Params params; void refresh(); - bool isStorageMounted(); - bool isFilesystemPresent(); - bool isDriveInitialized(); void mountStorage(); void unmountStorage(); void formatStorage();