diff --git a/selfdrive/ui/SConscript b/selfdrive/ui/SConscript index f3957c3d03..47ad5bdefa 100644 --- a/selfdrive/ui/SConscript +++ b/selfdrive/ui/SConscript @@ -15,7 +15,7 @@ if arch == "Darwin": sp_widgets_src = [] sp_qt_src = [] if not GetOption('stock_ui'): - SConscript(['../../sunnypilot/selfdrive/ui/SConscript']) + SConscript(['sunnypilot/SConscript']) Import('sp_widgets_src', 'sp_qt_src') # FIXME: remove this once we're on 5.15 (24.04) diff --git a/selfdrive/ui/main.cc b/selfdrive/ui/main.cc index 268a3d000b..db96817f1a 100644 --- a/selfdrive/ui/main.cc +++ b/selfdrive/ui/main.cc @@ -8,7 +8,7 @@ #include "selfdrive/ui/qt/window.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/window.h" +#include "selfdrive/ui/sunnypilot/qt/window.h" #define MainWindow MainWindowSP #else #include "selfdrive/ui/qt/qt_window.h" diff --git a/selfdrive/ui/qt/body.h b/selfdrive/ui/qt/body.h index b0ea20e552..187e015af7 100644 --- a/selfdrive/ui/qt/body.h +++ b/selfdrive/ui/qt/body.h @@ -7,7 +7,7 @@ #include "common/util.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #define UIState UIStateSP #else #include "selfdrive/ui/ui.h" diff --git a/selfdrive/ui/qt/home.h b/selfdrive/ui/qt/home.h index 24ae756584..f3227c6559 100644 --- a/selfdrive/ui/qt/home.h +++ b/selfdrive/ui/qt/home.h @@ -13,9 +13,9 @@ #include "selfdrive/ui/ui.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" -#include "../../sunnypilot/selfdrive/ui/qt/onroad/onroad_home.h" -#include "../../sunnypilot/selfdrive/ui/qt/sidebar.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/onroad/onroad_home.h" +#include "selfdrive/ui/sunnypilot/qt/sidebar.h" #define OnroadWindow OnroadWindowSP #define LayoutWidget LayoutWidgetSP #define Sidebar SidebarSP diff --git a/selfdrive/ui/qt/network/networking.cc b/selfdrive/ui/qt/network/networking.cc index 0f101a35c3..02c137413c 100644 --- a/selfdrive/ui/qt/network/networking.cc +++ b/selfdrive/ui/qt/network/networking.cc @@ -10,8 +10,8 @@ #include "selfdrive/ui/qt/util.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" -#include "../../sunnypilot/selfdrive/ui/qt/widgets/scrollview.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" #else #include "selfdrive/ui/qt/widgets/controls.h" #include "selfdrive/ui/qt/widgets/scrollview.h" diff --git a/selfdrive/ui/qt/network/networking.h b/selfdrive/ui/qt/network/networking.h index 93d7229e94..2d924588f0 100644 --- a/selfdrive/ui/qt/network/networking.h +++ b/selfdrive/ui/qt/network/networking.h @@ -9,7 +9,7 @@ #include "selfdrive/ui/qt/widgets/toggle.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" #define ButtonControl ButtonControlSP #define ElidedLabel ElidedLabelSP #define LabelControl LabelControlSP diff --git a/selfdrive/ui/qt/offroad/developer_panel.cc b/selfdrive/ui/qt/offroad/developer_panel.cc index ac43c35d72..ac0b4dc4de 100644 --- a/selfdrive/ui/qt/offroad/developer_panel.cc +++ b/selfdrive/ui/qt/offroad/developer_panel.cc @@ -5,7 +5,7 @@ #include "common/util.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" #else #include "selfdrive/ui/qt/widgets/controls.h" #endif diff --git a/selfdrive/ui/qt/offroad/developer_panel.h b/selfdrive/ui/qt/offroad/developer_panel.h index 824660458b..0351cd045c 100644 --- a/selfdrive/ui/qt/offroad/developer_panel.h +++ b/selfdrive/ui/qt/offroad/developer_panel.h @@ -1,7 +1,7 @@ #pragma once #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" #else #include "selfdrive/ui/qt/offroad/settings.h" #endif diff --git a/selfdrive/ui/qt/offroad/settings.h b/selfdrive/ui/qt/offroad/settings.h index 9c4acac582..41914c0ec0 100644 --- a/selfdrive/ui/qt/offroad/settings.h +++ b/selfdrive/ui/qt/offroad/settings.h @@ -13,8 +13,8 @@ #include "selfdrive/ui/qt/util.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/ui.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" #define ListWidget ListWidgetSP #define ParamControl ParamControlSP #define ButtonControl ButtonControlSP diff --git a/selfdrive/ui/qt/onroad/buttons.h b/selfdrive/ui/qt/onroad/buttons.h index 6bf479d136..3afaed33f4 100644 --- a/selfdrive/ui/qt/onroad/buttons.h +++ b/selfdrive/ui/qt/onroad/buttons.h @@ -3,7 +3,7 @@ #include #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #else #include "selfdrive/ui/ui.h" #endif diff --git a/selfdrive/ui/qt/onroad/model.h b/selfdrive/ui/qt/onroad/model.h index d2303eebd6..7e1b43acb4 100644 --- a/selfdrive/ui/qt/onroad/model.h +++ b/selfdrive/ui/qt/onroad/model.h @@ -4,7 +4,7 @@ #include #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #else #include "selfdrive/ui/ui.h" #endif diff --git a/selfdrive/ui/qt/request_repeater.h b/selfdrive/ui/qt/request_repeater.h index 7c3c740b5e..a0e8bde0eb 100644 --- a/selfdrive/ui/qt/request_repeater.h +++ b/selfdrive/ui/qt/request_repeater.h @@ -4,7 +4,7 @@ #include "selfdrive/ui/qt/api.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #else #include "selfdrive/ui/ui.h" #endif diff --git a/selfdrive/ui/qt/sidebar.h b/selfdrive/ui/qt/sidebar.h index d23427336e..b1ce5887f5 100644 --- a/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/qt/sidebar.h @@ -8,7 +8,7 @@ #include "selfdrive/ui/qt/network/networking.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #else #include "selfdrive/ui/ui.h" #endif diff --git a/selfdrive/ui/qt/widgets/cameraview.h b/selfdrive/ui/qt/widgets/cameraview.h index 63b2bf8628..e446ef5987 100644 --- a/selfdrive/ui/qt/widgets/cameraview.h +++ b/selfdrive/ui/qt/widgets/cameraview.h @@ -25,7 +25,7 @@ #include "msgq/visionipc/visionipc_client.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #else #include "selfdrive/ui/ui.h" #endif diff --git a/selfdrive/ui/qt/widgets/ssh_keys.h b/selfdrive/ui/qt/widgets/ssh_keys.h index 53f0afac1b..ef40346c83 100644 --- a/selfdrive/ui/qt/widgets/ssh_keys.h +++ b/selfdrive/ui/qt/widgets/ssh_keys.h @@ -5,7 +5,7 @@ #include "system/hardware/hw.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" #define ButtonControl ButtonControlSP #define ToggleControl ToggleControlSP #else diff --git a/selfdrive/ui/qt/widgets/wifi.h b/selfdrive/ui/qt/widgets/wifi.h index 40552a699d..3daf25a124 100644 --- a/selfdrive/ui/qt/widgets/wifi.h +++ b/selfdrive/ui/qt/widgets/wifi.h @@ -5,7 +5,7 @@ #include #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #define UIState UIStateSP #else #include "selfdrive/ui/ui.h" diff --git a/selfdrive/ui/qt/window.cc b/selfdrive/ui/qt/window.cc index c28f3a2422..4479d4f79d 100644 --- a/selfdrive/ui/qt/window.cc +++ b/selfdrive/ui/qt/window.cc @@ -5,11 +5,10 @@ #include "system/hardware/hw.h" // We have this constructor so that we can provide custom implementations of the windows. By default (stock_ui) would receive them as nullptr, so they'll be instantiated with stock. Otherwise they'd be SP instances -MainWindow::MainWindow(QWidget *parent, HomeWindow *hw, SettingsWindow *sw, OnboardingWindow *ow) : +MainWindow::MainWindow(QWidget *parent, HomeWindow *hw, SettingsWindow *sw) : QWidget(parent), homeWindow(hw ? hw : new HomeWindow(this)), - settingsWindow(sw ? sw : new SettingsWindow(this)), - onboardingWindow(ow ? ow : new OnboardingWindow(this)) { + settingsWindow(sw ? sw : new SettingsWindow(this)) { main_layout = new QStackedLayout(this); main_layout->setMargin(0); @@ -25,6 +24,7 @@ MainWindow::MainWindow(QWidget *parent, HomeWindow *hw, SettingsWindow *sw, Onbo main_layout->setCurrentWidget(onboardingWindow); }); + onboardingWindow = new OnboardingWindow(this); main_layout->addWidget(onboardingWindow); QObject::connect(onboardingWindow, &OnboardingWindow::onboardingDone, [=]() { main_layout->setCurrentWidget(homeWindow); diff --git a/selfdrive/ui/qt/window.h b/selfdrive/ui/qt/window.h index 2ed56e6d58..8a118b0bb6 100644 --- a/selfdrive/ui/qt/window.h +++ b/selfdrive/ui/qt/window.h @@ -11,13 +11,12 @@ class MainWindow : public QWidget { Q_OBJECT public: - explicit MainWindow(QWidget *parent = 0) : MainWindow(parent, nullptr, nullptr, nullptr) {} + explicit MainWindow(QWidget *parent = 0) : MainWindow(parent, nullptr, nullptr) {} protected: - explicit MainWindow(QWidget *parent, HomeWindow *hw = nullptr, SettingsWindow *sw = nullptr, OnboardingWindow *ow = nullptr); + explicit MainWindow(QWidget *parent, HomeWindow *hw = nullptr, SettingsWindow *sw = nullptr); HomeWindow *homeWindow; SettingsWindow *settingsWindow; - OnboardingWindow *onboardingWindow; virtual void closeSettings(); private: @@ -25,4 +24,5 @@ private: void openSettings(int index = 0, const QString ¶m = ""); QStackedLayout *main_layout; + OnboardingWindow *onboardingWindow; }; diff --git a/selfdrive/ui/sunnypilot/SConscript b/selfdrive/ui/sunnypilot/SConscript new file mode 100644 index 0000000000..efbe6a8e4a --- /dev/null +++ b/selfdrive/ui/sunnypilot/SConscript @@ -0,0 +1,19 @@ +widgets_src = [ + "sunnypilot/qt/widgets/toggle.cc", + "sunnypilot/qt/widgets/controls.cc", + "sunnypilot/qt/widgets/scrollview.cc", +] + +qt_src = [ + "sunnypilot/ui.cc", + "sunnypilot/qt/sidebar.cc", + "sunnypilot/qt/window.cc", + "sunnypilot/qt/home.cc", + "sunnypilot/qt/offroad/settings/settings.cc", + "sunnypilot/qt/onroad/onroad_home.cc", +] + +sp_widgets_src = widgets_src +sp_qt_src = qt_src + +Export('sp_widgets_src', 'sp_qt_src') diff --git a/sunnypilot/selfdrive/ui/qt/home.cc b/selfdrive/ui/sunnypilot/qt/home.cc similarity index 90% rename from sunnypilot/selfdrive/ui/qt/home.cc rename to selfdrive/ui/sunnypilot/qt/home.cc index 8cdd178a46..2fd4dcbbee 100644 --- a/sunnypilot/selfdrive/ui/qt/home.cc +++ b/selfdrive/ui/sunnypilot/qt/home.cc @@ -5,7 +5,7 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/home.h" +#include "selfdrive/ui/sunnypilot/qt/home.h" HomeWindowSP::HomeWindowSP(QWidget *parent) : HomeWindow(parent) { } diff --git a/sunnypilot/selfdrive/ui/qt/home.h b/selfdrive/ui/sunnypilot/qt/home.h similarity index 89% rename from sunnypilot/selfdrive/ui/qt/home.h rename to selfdrive/ui/sunnypilot/qt/home.h index b4129126d3..4cf532d14c 100644 --- a/sunnypilot/selfdrive/ui/qt/home.h +++ b/selfdrive/ui/sunnypilot/qt/home.h @@ -13,11 +13,11 @@ #include "common/params.h" #include "selfdrive/ui/qt/body.h" #include "selfdrive/ui/qt/widgets/offroad_alerts.h" -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #include "selfdrive/ui/qt/home.h" #ifdef SUNNYPILOT -#include "../../sunnypilot/selfdrive/ui/qt/sidebar.h" +#include "selfdrive/ui/sunnypilot/qt/sidebar.h" #define OnroadWindow OnroadWindowSP #else #include "selfdrive/ui/qt/sidebar.h" diff --git a/sunnypilot/selfdrive/ui/qt/offroad/settings/settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc similarity index 97% rename from sunnypilot/selfdrive/ui/qt/offroad/settings/settings.cc rename to selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc index cf446c6c3f..3a66101a82 100644 --- a/sunnypilot/selfdrive/ui/qt/offroad/settings/settings.cc +++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc @@ -5,10 +5,10 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/offroad/settings/settings.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" #include "selfdrive/ui/qt/network/networking.h" -#include "../../sunnypilot/selfdrive/ui/qt/widgets/scrollview.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/scrollview.h" #include "selfdrive/ui/qt/offroad/developer_panel.h" TogglesPanelSP::TogglesPanelSP(SettingsWindow *parent) : TogglesPanel(parent) { diff --git a/sunnypilot/selfdrive/ui/qt/offroad/settings/settings.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h similarity index 100% rename from sunnypilot/selfdrive/ui/qt/offroad/settings/settings.h rename to selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h diff --git a/sunnypilot/selfdrive/ui/qt/onroad/onroad_home.cc b/selfdrive/ui/sunnypilot/qt/onroad/onroad_home.cc similarity index 93% rename from sunnypilot/selfdrive/ui/qt/onroad/onroad_home.cc rename to selfdrive/ui/sunnypilot/qt/onroad/onroad_home.cc index a2743df34c..b26d1b828a 100644 --- a/sunnypilot/selfdrive/ui/qt/onroad/onroad_home.cc +++ b/selfdrive/ui/sunnypilot/qt/onroad/onroad_home.cc @@ -5,7 +5,7 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/onroad/onroad_home.h" +#include "selfdrive/ui/sunnypilot/qt/onroad/onroad_home.h" #include "common/swaglog.h" #include "selfdrive/ui/qt/util.h" diff --git a/sunnypilot/selfdrive/ui/qt/onroad/onroad_home.h b/selfdrive/ui/sunnypilot/qt/onroad/onroad_home.h similarity index 100% rename from sunnypilot/selfdrive/ui/qt/onroad/onroad_home.h rename to selfdrive/ui/sunnypilot/qt/onroad/onroad_home.h diff --git a/sunnypilot/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/sunnypilot/qt/sidebar.cc similarity index 93% rename from sunnypilot/selfdrive/ui/qt/sidebar.cc rename to selfdrive/ui/sunnypilot/qt/sidebar.cc index fb177856ca..af090e738f 100644 --- a/sunnypilot/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/sunnypilot/qt/sidebar.cc @@ -5,7 +5,7 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/sidebar.h" +#include "selfdrive/ui/sunnypilot/qt/sidebar.h" #include #include diff --git a/sunnypilot/selfdrive/ui/qt/sidebar.h b/selfdrive/ui/sunnypilot/qt/sidebar.h similarity index 91% rename from sunnypilot/selfdrive/ui/qt/sidebar.h rename to selfdrive/ui/sunnypilot/qt/sidebar.h index 5a9a66df50..ff9b78748f 100644 --- a/sunnypilot/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/sunnypilot/qt/sidebar.h @@ -11,7 +11,7 @@ #include "selfdrive/ui/qt/sidebar.h" -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" class SidebarSP : public Sidebar { Q_OBJECT diff --git a/sunnypilot/selfdrive/ui/qt/widgets/controls.cc b/selfdrive/ui/sunnypilot/qt/widgets/controls.cc similarity index 99% rename from sunnypilot/selfdrive/ui/qt/widgets/controls.cc rename to selfdrive/ui/sunnypilot/qt/widgets/controls.cc index a72fe34758..0c0e174001 100644 --- a/sunnypilot/selfdrive/ui/qt/widgets/controls.cc +++ b/selfdrive/ui/sunnypilot/qt/widgets/controls.cc @@ -5,7 +5,7 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/widgets/controls.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/controls.h" #include #include diff --git a/sunnypilot/selfdrive/ui/qt/widgets/controls.h b/selfdrive/ui/sunnypilot/qt/widgets/controls.h similarity index 99% rename from sunnypilot/selfdrive/ui/qt/widgets/controls.h rename to selfdrive/ui/sunnypilot/qt/widgets/controls.h index ebfc640cb7..a5071d97e7 100644 --- a/sunnypilot/selfdrive/ui/qt/widgets/controls.h +++ b/selfdrive/ui/sunnypilot/qt/widgets/controls.h @@ -15,7 +15,7 @@ #include "common/params.h" #include "selfdrive/ui/qt/widgets/controls.h" #include "selfdrive/ui/qt/widgets/input.h" -#include "../../sunnypilot/selfdrive/ui/qt/widgets/toggle.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/toggle.h" QFrame *horizontal_line(QWidget *parent = nullptr); diff --git a/selfdrive/ui/sunnypilot/qt/widgets/scrollview.cc b/selfdrive/ui/sunnypilot/qt/widgets/scrollview.cc new file mode 100644 index 0000000000..49f6e93430 --- /dev/null +++ b/selfdrive/ui/sunnypilot/qt/widgets/scrollview.cc @@ -0,0 +1,18 @@ +/** +* 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/scrollview.h" + +#include + +void ScrollViewSP::setLastScrollPosition() { + lastScrollPosition = verticalScrollBar()->value(); +} + +void ScrollViewSP::restoreScrollPosition() { + verticalScrollBar()->setValue(lastScrollPosition); +} diff --git a/sunnypilot/selfdrive/ui/qt/widgets/scrollview.h b/selfdrive/ui/sunnypilot/qt/widgets/scrollview.h similarity index 100% rename from sunnypilot/selfdrive/ui/qt/widgets/scrollview.h rename to selfdrive/ui/sunnypilot/qt/widgets/scrollview.h diff --git a/sunnypilot/selfdrive/ui/qt/widgets/toggle.cc b/selfdrive/ui/sunnypilot/qt/widgets/toggle.cc similarity index 93% rename from sunnypilot/selfdrive/ui/qt/widgets/toggle.cc rename to selfdrive/ui/sunnypilot/qt/widgets/toggle.cc index e240e15664..601c8f94c1 100644 --- a/sunnypilot/selfdrive/ui/qt/widgets/toggle.cc +++ b/selfdrive/ui/sunnypilot/qt/widgets/toggle.cc @@ -5,7 +5,7 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/widgets/toggle.h" +#include "selfdrive/ui/sunnypilot/qt/widgets/toggle.h" #include diff --git a/sunnypilot/selfdrive/ui/qt/widgets/toggle.h b/selfdrive/ui/sunnypilot/qt/widgets/toggle.h similarity index 100% rename from sunnypilot/selfdrive/ui/qt/widgets/toggle.h rename to selfdrive/ui/sunnypilot/qt/widgets/toggle.h diff --git a/sunnypilot/selfdrive/ui/qt/window.cc b/selfdrive/ui/sunnypilot/qt/window.cc similarity index 74% rename from sunnypilot/selfdrive/ui/qt/window.cc rename to selfdrive/ui/sunnypilot/qt/window.cc index 168a1af467..f332e1ed8e 100644 --- a/sunnypilot/selfdrive/ui/qt/window.cc +++ b/selfdrive/ui/sunnypilot/qt/window.cc @@ -5,14 +5,13 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/qt/window.h" +#include "selfdrive/ui/sunnypilot/qt/window.h" MainWindowSP::MainWindowSP(QWidget *parent) - : MainWindow(parent, new HomeWindowSP(parent), new SettingsWindowSP(parent), new OnboardingWindowSP(parent)) { + : MainWindow(parent, new HomeWindowSP(parent), new SettingsWindowSP(parent)) { homeWindow = dynamic_cast(MainWindow::homeWindow); settingsWindow = dynamic_cast(MainWindow::settingsWindow); - onboardingWindow = dynamic_cast(MainWindow::onboardingWindow); } void MainWindowSP::closeSettings() { diff --git a/sunnypilot/selfdrive/ui/qt/window.h b/selfdrive/ui/sunnypilot/qt/window.h similarity index 71% rename from sunnypilot/selfdrive/ui/qt/window.h rename to selfdrive/ui/sunnypilot/qt/window.h index 39d20aec8f..d4c0900901 100644 --- a/sunnypilot/selfdrive/ui/qt/window.h +++ b/selfdrive/ui/sunnypilot/qt/window.h @@ -8,9 +8,8 @@ #pragma once #include "selfdrive/ui/qt/window.h" -#include "../../sunnypilot/selfdrive/ui/qt/home.h" -#include "../../sunnypilot/selfdrive/ui/qt/offroad/settings/settings.h" -#include "offroad/settings/onboarding.h" +#include "selfdrive/ui/sunnypilot/qt/home.h" +#include "selfdrive/ui/sunnypilot/qt/offroad/settings/settings.h" class MainWindowSP : public MainWindow { Q_OBJECT @@ -21,6 +20,5 @@ public: private: HomeWindowSP *homeWindow; SettingsWindowSP *settingsWindow; - OnboardingWindowSP *onboardingWindow; void closeSettings() override; }; diff --git a/sunnypilot/selfdrive/ui/ui.cc b/selfdrive/ui/sunnypilot/ui.cc similarity index 96% rename from sunnypilot/selfdrive/ui/ui.cc rename to selfdrive/ui/sunnypilot/ui.cc index 3475a5e6e9..e869d3b2dd 100644 --- a/sunnypilot/selfdrive/ui/ui.cc +++ b/selfdrive/ui/sunnypilot/ui.cc @@ -5,7 +5,7 @@ * See the LICENSE.md file in the root directory for more details. */ -#include "../../sunnypilot/selfdrive/ui/ui.h" +#include "selfdrive/ui/sunnypilot/ui.h" #include "common/watchdog.h" diff --git a/sunnypilot/selfdrive/ui/ui.h b/selfdrive/ui/sunnypilot/ui.h similarity index 100% rename from sunnypilot/selfdrive/ui/ui.h rename to selfdrive/ui/sunnypilot/ui.h diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts index cea12a1048..523e3ff04e 100644 --- a/selfdrive/ui/translations/main_ar.ts +++ b/selfdrive/ui/translations/main_ar.ts @@ -500,6 +500,17 @@ إلغاء + + ParamControlSP + + Enable + تمكين + + + Cancel + إلغاء + + PrimeAdWidget @@ -662,6 +673,37 @@ This may take up to a minute. المطور + + SettingsWindowSP + + × + × + + + Device + الجهاز + + + Network + الشبكة + + + Toggles + المثبتتات + + + Software + البرنامج + + + Developer + المطور + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts index ac8b46712e..18bc65a80f 100644 --- a/selfdrive/ui/translations/main_de.ts +++ b/selfdrive/ui/translations/main_de.ts @@ -495,6 +495,17 @@ Aktivieren + + ParamControlSP + + Cancel + Abbrechen + + + Enable + Aktivieren + + PrimeAdWidget @@ -644,6 +655,37 @@ This may take up to a minute. + + SettingsWindowSP + + × + x + + + Device + Gerät + + + Network + Netzwerk + + + Toggles + Schalter + + + Software + Software + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts index 94f7b8efaf..c3003a6d97 100644 --- a/selfdrive/ui/translations/main_es.ts +++ b/selfdrive/ui/translations/main_es.ts @@ -496,6 +496,17 @@ Cancelar + + ParamControlSP + + Enable + Activar + + + Cancel + Cancelar + + PrimeAdWidget @@ -646,6 +657,37 @@ Esto puede tardar un minuto. Desarrollador + + SettingsWindowSP + + × + × + + + Device + Dispositivo + + + Network + Red + + + Toggles + Ajustes + + + Software + Software + + + Developer + Desarrollador + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts index 33c7e4b918..be883b23e9 100644 --- a/selfdrive/ui/translations/main_fr.ts +++ b/selfdrive/ui/translations/main_fr.ts @@ -496,6 +496,17 @@ Annuler + + ParamControlSP + + Enable + Activer + + + Cancel + Annuler + + PrimeAdWidget @@ -646,6 +657,37 @@ Cela peut prendre jusqu'à une minute. + + SettingsWindowSP + + × + × + + + Device + Appareil + + + Network + Réseau + + + Toggles + Options + + + Software + Logiciel + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts index 51121d3174..629d5f9b0e 100644 --- a/selfdrive/ui/translations/main_ja.ts +++ b/selfdrive/ui/translations/main_ja.ts @@ -494,6 +494,17 @@ を有効化 + + ParamControlSP + + Cancel + キャンセル + + + Enable + を有効化 + + PrimeAdWidget @@ -640,6 +651,37 @@ This may take up to a minute. + + SettingsWindowSP + + × + × + + + Device + デバイス + + + Network + ネットワーク + + + Toggles + 機能設定 + + + Software + ソフトウェア + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts index 7854330fd2..586e856a4b 100644 --- a/selfdrive/ui/translations/main_ko.ts +++ b/selfdrive/ui/translations/main_ko.ts @@ -495,6 +495,17 @@ 활성화 + + ParamControlSP + + Cancel + 취소 + + + Enable + 활성화 + + PrimeAdWidget @@ -642,6 +653,37 @@ This may take up to a minute. 개발자 + + SettingsWindowSP + + × + × + + + Device + 장치 + + + Network + 네트워크 + + + Toggles + 토글 + + + Software + 소프트웨어 + + + Developer + 개발자 + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts index b1af49bf63..13573e0b46 100644 --- a/selfdrive/ui/translations/main_pt-BR.ts +++ b/selfdrive/ui/translations/main_pt-BR.ts @@ -496,6 +496,17 @@ Ativar + + ParamControlSP + + Cancel + Cancelar + + + Enable + Ativar + + PrimeAdWidget @@ -646,6 +657,37 @@ Isso pode levar até um minuto. Desenvdor + + SettingsWindowSP + + × + × + + + Device + Dispositivo + + + Network + Rede + + + Toggles + Ajustes + + + Software + Software + + + Developer + Desenvdor + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts index c99a13567e..164db2fe9a 100644 --- a/selfdrive/ui/translations/main_th.ts +++ b/selfdrive/ui/translations/main_th.ts @@ -495,6 +495,17 @@ ยกเลิก + + ParamControlSP + + Enable + เปิดใช้งาน + + + Cancel + ยกเลิก + + PrimeAdWidget @@ -642,6 +653,37 @@ This may take up to a minute. + + SettingsWindowSP + + × + × + + + Device + อุปกรณ์ + + + Network + เครือข่าย + + + Toggles + ตัวเลือก + + + Software + ซอฟต์แวร์ + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts index 65ca1bf6f7..679656a8b8 100644 --- a/selfdrive/ui/translations/main_tr.ts +++ b/selfdrive/ui/translations/main_tr.ts @@ -494,6 +494,17 @@ + + ParamControlSP + + Enable + + + + Cancel + + + PrimeAdWidget @@ -640,6 +651,37 @@ This may take up to a minute. + + SettingsWindowSP + + × + x + + + Device + Cihaz + + + Network + + + + Toggles + Değiştirme + + + Software + Yazılım + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts index be1e34ac7a..9c5290a0cd 100644 --- a/selfdrive/ui/translations/main_zh-CHS.ts +++ b/selfdrive/ui/translations/main_zh-CHS.ts @@ -495,6 +495,17 @@ 启用 + + ParamControlSP + + Cancel + 取消 + + + Enable + 启用 + + PrimeAdWidget @@ -642,6 +653,37 @@ This may take up to a minute. + + SettingsWindowSP + + × + × + + + Device + 设备 + + + Network + 网络 + + + Toggles + 设定 + + + Software + 软件 + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts index b8e69f904e..cd8a95e346 100644 --- a/selfdrive/ui/translations/main_zh-CHT.ts +++ b/selfdrive/ui/translations/main_zh-CHT.ts @@ -495,6 +495,17 @@ 啟用 + + ParamControlSP + + Cancel + 取消 + + + Enable + 啟用 + + PrimeAdWidget @@ -642,6 +653,37 @@ This may take up to a minute. + + SettingsWindowSP + + × + × + + + Device + 裝置 + + + Network + 網路 + + + Toggles + 設定 + + + Software + 軟體 + + + Developer + + + + sunnypilot + sunnypilot + + Setup diff --git a/sunnypilot/selfdrive/ui/.gitignore b/sunnypilot/selfdrive/ui/.gitignore deleted file mode 100644 index e047b1f5dd..0000000000 --- a/sunnypilot/selfdrive/ui/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -moc_* -*.moc diff --git a/sunnypilot/selfdrive/ui/SConscript b/sunnypilot/selfdrive/ui/SConscript deleted file mode 100644 index 421744f257..0000000000 --- a/sunnypilot/selfdrive/ui/SConscript +++ /dev/null @@ -1,21 +0,0 @@ -widgets_src = [ - "../../sunnypilot/selfdrive/ui/ui.cc", - "../../sunnypilot/selfdrive/ui/qt/window.cc", - "../../sunnypilot/selfdrive/ui/qt/widgets/controls.cc", - "../../sunnypilot/selfdrive/ui/qt/widgets/drive_stats.cc", - "../../sunnypilot/selfdrive/ui/qt/widgets/scrollview.cc", - "../../sunnypilot/selfdrive/ui/qt/widgets/toggle.cc", -] - -qt_src = [ - "../../sunnypilot/selfdrive/ui/qt/home.cc", - "../../sunnypilot/selfdrive/ui/qt/sidebar.cc", - "../../sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.cc", - "../../sunnypilot/selfdrive/ui/qt/offroad/settings/settings.cc", - "../../sunnypilot/selfdrive/ui/qt/onroad/onroad_home.cc", -] - -sp_widgets_src = widgets_src -sp_qt_src = qt_src - -Export('sp_widgets_src', 'sp_qt_src') diff --git a/sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.cc b/sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.cc deleted file mode 100644 index 2615743f27..0000000000 --- a/sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.cc +++ /dev/null @@ -1,102 +0,0 @@ -/** - * 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 "../../sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.h" - -#include - -#include -#include - -#include "common/util.h" -#include "common/params.h" -#include "selfdrive/ui/qt/util.h" -#include "selfdrive/ui/qt/widgets/input.h" -#include "selfdrive/ui/qt/widgets/scrollview.h" - -void TermsPageSP::showEvent(QShowEvent *event) { - // late init, building QML widget takes 200ms - if (layout()) { - return; - } - - QVBoxLayout *main_layout = new QVBoxLayout(this); - main_layout->setContentsMargins(45, 35, 45, 45); - main_layout->setSpacing(0); - - QLabel *title = new QLabel(tr("Terms & Conditions")); - title->setStyleSheet("font-size: 90px; font-weight: 600;"); - main_layout->addWidget(title); - - QLabel *text = new QLabel(this); - text->setTextFormat(Qt::RichText); - text->setWordWrap(true); - std::string tc_text = sunnypilot_tc ? "../assets/offroad/sp_tc.html" : "../assets/offroad/tc.html"; - text->setText(QString::fromStdString(util::read_file(tc_text))); - text->setStyleSheet("font-size:50px; font-weight: 200; color: #C9C9C9; background-color:#1B1B1B; padding:50px 50px;"); - ScrollView *scroll = new ScrollView(text, this); - - main_layout->addSpacing(30); - main_layout->addWidget(scroll); - main_layout->addSpacing(50); - - QHBoxLayout *buttons = new QHBoxLayout; - buttons->setMargin(0); - buttons->setSpacing(45); - main_layout->addLayout(buttons); - - QPushButton *decline_btn = new QPushButton(tr("Decline")); - buttons->addWidget(decline_btn); - QObject::connect(decline_btn, &QPushButton::clicked, this, &TermsPage::declinedTerms); - - accept_btn = new QPushButton(tr("Scroll to accept")); - accept_btn->setEnabled(false); - accept_btn->setStyleSheet(R"( - QPushButton { - background-color: #465BEA; - } - QPushButton:pressed { - background-color: #3049F4; - } - QPushButton:disabled { - background-color: #4F4F4F; - } - )"); - buttons->addWidget(accept_btn); - QObject::connect(accept_btn, &QPushButton::clicked, this, &TermsPage::acceptedTerms); - QScrollBar *scroll_bar = scroll->verticalScrollBar(); - connect(scroll_bar, &QScrollBar::valueChanged, this, [this, scroll_bar](int value) { - if (value == scroll_bar->maximum()) { - enableAccept(); - } - }); -} - -void OnboardingWindowSP::updateActiveScreen() { - if (accepted_terms && training_done && !accepted_terms_sp) { - setCurrentIndex(3); - } else { - OnboardingWindow::updateActiveScreen(); - } -} - -OnboardingWindowSP::OnboardingWindowSP(QWidget *parent) : OnboardingWindow(parent) { - std::string current_terms_version_sp = params.get("TermsVersionSunnypilot"); - accepted_terms_sp = params.get("HasAcceptedTermsSP") == current_terms_version_sp; - LOGD("accepted_terms_sp: %s", params.get("HasAcceptedTermsSP").c_str()); - - auto *terms_sp = new TermsPageSP(true, parent); - addWidget(terms_sp); // index = 3 - connect(terms_sp, &TermsPageSP::acceptedTerms, [=]() { - params.put("HasAcceptedTermsSP", current_terms_version_sp); - accepted_terms_sp = true; - updateActiveScreen(); - }); - connect(terms_sp, &TermsPageSP::declinedTerms, [=]() { setCurrentIndex(2); }); - - OnboardingWindowSP::updateActiveScreen(); -} diff --git a/sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.h b/sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.h deleted file mode 100644 index 626428478c..0000000000 --- a/sunnypilot/selfdrive/ui/qt/offroad/settings/onboarding.h +++ /dev/null @@ -1,35 +0,0 @@ -/** - * 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 "selfdrive/ui/qt/offroad/onboarding.h" - -#include "selfdrive/ui/qt/qt_window.h" - -class TermsPageSP : public TermsPage { - Q_OBJECT - -public: - explicit TermsPageSP(bool sunnypilot = false, QWidget *parent = 0) : TermsPage(parent), sunnypilot_tc(sunnypilot) {} - -private: - bool sunnypilot_tc = false; - void showEvent(QShowEvent *event) override; -}; - -class OnboardingWindowSP : public OnboardingWindow { - Q_OBJECT - -public: - explicit OnboardingWindowSP(QWidget *parent = 0); - inline bool completed() const override { return accepted_terms && accepted_terms_sp && training_done; } - -private: - bool accepted_terms_sp = false; - void updateActiveScreen() override; -}; diff --git a/sunnypilot/selfdrive/ui/qt/widgets/drive_stats.cc b/sunnypilot/selfdrive/ui/qt/widgets/drive_stats.cc deleted file mode 100644 index 0814e1e24e..0000000000 --- a/sunnypilot/selfdrive/ui/qt/widgets/drive_stats.cc +++ /dev/null @@ -1,103 +0,0 @@ -/** - * 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 "../../sunnypilot/selfdrive/ui/qt/widgets/drive_stats.h" - -#include -#include -#include - -#include "common/params.h" -#include "selfdrive/ui/qt/request_repeater.h" -#include "selfdrive/ui/qt/util.h" - -static QLabel* newLabel(const QString& text, const QString &type) { - QLabel* label = new QLabel(text); - label->setProperty("type", type); - return label; -} - -DriveStats::DriveStats(QWidget* parent) : QFrame(parent) { - metric_ = Params().getBool("IsMetric"); - - QVBoxLayout* main_layout = new QVBoxLayout(this); - main_layout->setContentsMargins(50, 50, 50, 60); - - auto add_stats_layouts = [=](const QString &title, StatsLabels& labels) { - QGridLayout* grid_layout = new QGridLayout; - grid_layout->setVerticalSpacing(10); - grid_layout->setContentsMargins(0, 10, 0, 10); - - int row = 0; - grid_layout->addWidget(newLabel(title, "title"), row++, 0, 1, 3); - grid_layout->addItem(new QSpacerItem(0, 50), row++, 0, 1, 1); - - grid_layout->addWidget(labels.routes = newLabel("0", "number"), row, 0, Qt::AlignLeft); - grid_layout->addWidget(labels.distance = newLabel("0", "number"), row, 1, Qt::AlignLeft); - grid_layout->addWidget(labels.hours = newLabel("0", "number"), row, 2, Qt::AlignLeft); - - grid_layout->addWidget(newLabel((tr("Drives")), "unit"), row + 1, 0, Qt::AlignLeft); - grid_layout->addWidget(labels.distance_unit = newLabel(getDistanceUnit(), "unit"), row + 1, 1, Qt::AlignLeft); - grid_layout->addWidget(newLabel(tr("Hours"), "unit"), row + 1, 2, Qt::AlignLeft); - - main_layout->addLayout(grid_layout); - }; - - add_stats_layouts(tr("ALL TIME"), all_); - main_layout->addStretch(); - add_stats_layouts(tr("PAST WEEK"), week_); - - if (auto dongleId = getDongleId()) { - QString url = CommaApi::BASE_URL + "/v1.1/devices/" + *dongleId + "/stats"; - RequestRepeater* repeater = new RequestRepeater(this, url, "ApiCache_DriveStats", 30); - QObject::connect(repeater, &RequestRepeater::requestDone, this, &DriveStats::parseResponse); - } - - setStyleSheet(R"( - DriveStats { - background-color: #333333; - border-radius: 10px; - } - - QLabel[type="title"] { font-size: 51px; font-weight: 500; } - QLabel[type="number"] { font-size: 78px; font-weight: 500; } - QLabel[type="unit"] { font-size: 51px; font-weight: 300; color: #A0A0A0; } - )"); -} - -void DriveStats::updateStats() { - auto update = [=](const QJsonObject& obj, StatsLabels& labels) { - labels.routes->setText(QString::number((int)obj["routes"].toDouble())); - labels.distance->setText(QString::number(int(obj["distance"].toDouble() * (metric_ ? MILE_TO_KM : 1)))); - labels.distance_unit->setText(getDistanceUnit()); - labels.hours->setText(QString::number((int)(obj["minutes"].toDouble() / 60))); - }; - - QJsonObject json = stats_.object(); - update(json["all"].toObject(), all_); - update(json["week"].toObject(), week_); -} - -void DriveStats::parseResponse(const QString& response, bool success) { - if (!success) return; - - QJsonDocument doc = QJsonDocument::fromJson(response.trimmed().toUtf8()); - if (doc.isNull()) { - qDebug() << "JSON Parse failed on getting past drives statistics"; - return; - } - stats_ = doc; - updateStats(); -} - -void DriveStats::showEvent(QShowEvent* event) { - bool metric = Params().getBool("IsMetric"); - if (metric_ != metric) { - metric_ = metric; - updateStats(); - } -} diff --git a/sunnypilot/selfdrive/ui/qt/widgets/drive_stats.h b/sunnypilot/selfdrive/ui/qt/widgets/drive_stats.h deleted file mode 100644 index 0b2802ed8c..0000000000 --- a/sunnypilot/selfdrive/ui/qt/widgets/drive_stats.h +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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 - -class DriveStats : public QFrame { - Q_OBJECT - -public: - explicit DriveStats(QWidget* parent = 0); - -private: - void showEvent(QShowEvent *event) override; - void updateStats(); - inline QString getDistanceUnit() const { return metric_ ? tr("KM") : tr("Miles"); } - - bool metric_; - QJsonDocument stats_; - struct StatsLabels { - QLabel *routes, *distance, *distance_unit, *hours; - } all_, week_; - -private slots: - void parseResponse(const QString &response, bool success); -}; diff --git a/sunnypilot/selfdrive/ui/qt/widgets/scrollview.cc b/sunnypilot/selfdrive/ui/qt/widgets/scrollview.cc deleted file mode 100644 index ab3ae1401c..0000000000 --- a/sunnypilot/selfdrive/ui/qt/widgets/scrollview.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * The MIT License - * - * Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors. - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * Last updated: July 29, 2024 -*/ - -#include "../../sunnypilot/selfdrive/ui/qt/widgets/scrollview.h" - -#include - -void ScrollViewSP::setLastScrollPosition() { - lastScrollPosition = verticalScrollBar()->value(); -} - -void ScrollViewSP::restoreScrollPosition() { - verticalScrollBar()->setValue(lastScrollPosition); -}