diff --git a/.github/workflows/ui_preview.yaml b/.github/workflows/ui_preview.yaml
index 0df696fd4..18f6f472c 100644
--- a/.github/workflows/ui_preview.yaml
+++ b/.github/workflows/ui_preview.yaml
@@ -86,7 +86,7 @@ jobs:
run: >-
sudo apt-get install -y imagemagick
- scenes="homescreen settings_device settings_software settings_sunnylink settings_toggles settings_sunnypilot settings_sunnypilot_mads settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard"
+ scenes="homescreen settings_device settings_software settings_sunnylink settings_toggles settings_sunnypilot settings_sunnypilot_mads setup_settings_trips settings_developer offroad_alert update_available prime onroad onroad_disengaged onroad_override onroad_sidebar onroad_wide onroad_wide_sidebar onroad_alert_small onroad_alert_mid onroad_alert_full driver_camera body keyboard"
A=($scenes)
DIFF=""
diff --git a/selfdrive/ui/sunnypilot/SConscript b/selfdrive/ui/sunnypilot/SConscript
index 121f621b4..8bfe1d79d 100644
--- a/selfdrive/ui/sunnypilot/SConscript
+++ b/selfdrive/ui/sunnypilot/SConscript
@@ -20,6 +20,7 @@ qt_src = [
"sunnypilot/qt/offroad/settings/software_panel.cc",
"sunnypilot/qt/offroad/settings/sunnylink_panel.cc",
"sunnypilot/qt/offroad/settings/sunnypilot_panel.cc",
+ "sunnypilot/qt/offroad/settings/trips_panel.cc",
"sunnypilot/qt/onroad/annotated_camera.cc",
"sunnypilot/qt/onroad/hud.cc",
"sunnypilot/qt/onroad/model.cc",
diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc
index b5e87e47c..d8e9d83de 100644
--- a/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc
+++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/settings.cc
@@ -14,6 +14,7 @@
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/software_panel.h"
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/sunnylink_panel.h"
#include "selfdrive/ui/sunnypilot/qt/offroad/settings/sunnypilot_panel.h"
+#include "selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.h"
TogglesPanelSP::TogglesPanelSP(SettingsWindow *parent) : TogglesPanel(parent) {
QObject::connect(uiStateSP(), &UIStateSP::uiUpdate, this, &TogglesPanelSP::updateState);
@@ -74,6 +75,7 @@ SettingsWindowSP::SettingsWindowSP(QWidget *parent) : SettingsWindow(parent) {
PanelInfo(" " + tr("Toggles"), toggles, "../../sunnypilot/selfdrive/assets/offroad/icon_toggle.png"),
PanelInfo(" " + tr("Software"), new SoftwarePanelSP(this), "../../sunnypilot/selfdrive/assets/offroad/icon_software.png"),
PanelInfo(" " + tr("sunnypilot"), new SunnypilotPanel(this), "../assets/images/button_home.png"),
+ PanelInfo(" " + tr("Trips"), new TripsPanel(this), "../../sunnypilot/selfdrive/assets/offroad/icon_trips.png"),
PanelInfo(" " + tr("Developer"), new DeveloperPanel(this), "../assets/offroad/icon_shell.png"),
};
diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.cc b/selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.cc
new file mode 100644
index 000000000..dcb16d168
--- /dev/null
+++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.cc
@@ -0,0 +1,36 @@
+/**
+ * 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/offroad/settings/trips_panel.h"
+
+TripsPanel::TripsPanel(QWidget* parent) : QFrame(parent) {
+ QVBoxLayout* main_layout = new QVBoxLayout(this);
+ main_layout->setMargin(0);
+
+ // main content
+ main_layout->addSpacing(25);
+ center_layout = new QStackedLayout();
+
+ driveStatsWidget = new DriveStats;
+ driveStatsWidget->setStyleSheet(R"(
+ 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; }
+ )");
+ center_layout->addWidget(driveStatsWidget);
+
+ main_layout->addLayout(center_layout, 1);
+
+ setStyleSheet(R"(
+ * {
+ color: white;
+ }
+ TripsPanel > QLabel {
+ font-size: 55px;
+ }
+ )");
+}
diff --git a/selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.h b/selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.h
new file mode 100644
index 000000000..67a49e21a
--- /dev/null
+++ b/selfdrive/ui/sunnypilot/qt/offroad/settings/trips_panel.h
@@ -0,0 +1,25 @@
+/**
+ * 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/sunnypilot/qt/widgets/controls.h"
+
+#include "selfdrive/ui/sunnypilot/qt/widgets/drive_stats.h"
+
+class TripsPanel : public QFrame {
+ Q_OBJECT
+
+public:
+ explicit TripsPanel(QWidget* parent = 0);
+
+private:
+ Params params;
+
+ QStackedLayout* center_layout;
+ DriveStats *driveStatsWidget;
+};
diff --git a/selfdrive/ui/tests/test_ui/run.py b/selfdrive/ui/tests/test_ui/run.py
index b978bd094..0c956a10b 100644
--- a/selfdrive/ui/tests/test_ui/run.py
+++ b/selfdrive/ui/tests/test_ui/run.py
@@ -42,16 +42,17 @@ def setup_settings_device(click, pm: PubMaster, scroll=None):
def setup_settings_toggles(click, pm: PubMaster, scroll=None):
setup_settings_device(click, pm)
- click(278, 640)
+ click(278, 632)
time.sleep(UI_DELAY)
def setup_settings_software(click, pm: PubMaster, scroll=None):
setup_settings_device(click, pm)
- click(278, 750)
+ click(278, 742)
time.sleep(UI_DELAY)
def setup_settings_developer(click, pm: PubMaster, scroll=None):
setup_settings_device(click, pm)
+ scroll(-100, 278, 962)
click(278, 970)
time.sleep(UI_DELAY)
@@ -122,7 +123,8 @@ def setup_body(click, pm: PubMaster, scroll=None):
def setup_keyboard(click, pm: PubMaster, scroll=None):
setup_settings_device(click, pm)
- click(250, 965)
+ scroll(-100, 278, 962)
+ click(278, 970)
click(1930, 228)
def setup_driver_camera(click, pm: PubMaster, scroll=None):
@@ -180,22 +182,27 @@ def setup_settings_sunnylink(click, pm: PubMaster, scroll=None):
Params().put_bool("SunnylinkEnabled", True)
setup_settings_device(click, pm)
- click(278, 530)
+ click(278, 522)
time.sleep(UI_DELAY)
def setup_settings_sunnypilot(click, pm: PubMaster, scroll=None):
setup_settings_device(click, pm)
- click(278, 860)
+ click(278, 852)
time.sleep(UI_DELAY)
def setup_settings_sunnypilot_mads(click, pm: PubMaster, scroll=None):
Params().put_bool("Mads", True)
setup_settings_device(click, pm)
- click(278, 860)
+ click(278, 852)
click(970, 455)
time.sleep(UI_DELAY)
+def setup_settings_trips(click, pm: PubMaster, scroll=None):
+ setup_settings_device(click, pm)
+ click(278, 962)
+ time.sleep(UI_DELAY)
+
CASES = {
"homescreen": setup_homescreen,
"prime": setup_homescreen,
diff --git a/selfdrive/ui/translations/main_ar.ts b/selfdrive/ui/translations/main_ar.ts
index 50e5656d3..f3fd4ea95 100644
--- a/selfdrive/ui/translations/main_ar.ts
+++ b/selfdrive/ui/translations/main_ar.ts
@@ -756,6 +756,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_de.ts b/selfdrive/ui/translations/main_de.ts
index fa068eefd..520699c99 100644
--- a/selfdrive/ui/translations/main_de.ts
+++ b/selfdrive/ui/translations/main_de.ts
@@ -738,6 +738,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_es.ts b/selfdrive/ui/translations/main_es.ts
index 0c1f38382..d3a0844e1 100644
--- a/selfdrive/ui/translations/main_es.ts
+++ b/selfdrive/ui/translations/main_es.ts
@@ -740,6 +740,10 @@ Esto puede tardar un minuto.
sunnylink
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_fr.ts b/selfdrive/ui/translations/main_fr.ts
index 1715ce127..f3630f1ce 100644
--- a/selfdrive/ui/translations/main_fr.ts
+++ b/selfdrive/ui/translations/main_fr.ts
@@ -740,6 +740,10 @@ Cela peut prendre jusqu'à une minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_ja.ts b/selfdrive/ui/translations/main_ja.ts
index a2264e659..ff83139cf 100644
--- a/selfdrive/ui/translations/main_ja.ts
+++ b/selfdrive/ui/translations/main_ja.ts
@@ -734,6 +734,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_ko.ts b/selfdrive/ui/translations/main_ko.ts
index 951c146bf..fad75d6ac 100644
--- a/selfdrive/ui/translations/main_ko.ts
+++ b/selfdrive/ui/translations/main_ko.ts
@@ -736,6 +736,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_pt-BR.ts b/selfdrive/ui/translations/main_pt-BR.ts
index 910ec2664..32a289557 100644
--- a/selfdrive/ui/translations/main_pt-BR.ts
+++ b/selfdrive/ui/translations/main_pt-BR.ts
@@ -740,6 +740,10 @@ Isso pode levar até um minuto.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_th.ts b/selfdrive/ui/translations/main_th.ts
index 469e79349..39baaf5e7 100644
--- a/selfdrive/ui/translations/main_th.ts
+++ b/selfdrive/ui/translations/main_th.ts
@@ -736,6 +736,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_tr.ts b/selfdrive/ui/translations/main_tr.ts
index 48edc6c83..349afb7a0 100644
--- a/selfdrive/ui/translations/main_tr.ts
+++ b/selfdrive/ui/translations/main_tr.ts
@@ -734,6 +734,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_zh-CHS.ts b/selfdrive/ui/translations/main_zh-CHS.ts
index 2ad90ae0a..1ab9de1d7 100644
--- a/selfdrive/ui/translations/main_zh-CHS.ts
+++ b/selfdrive/ui/translations/main_zh-CHS.ts
@@ -736,6 +736,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/selfdrive/ui/translations/main_zh-CHT.ts b/selfdrive/ui/translations/main_zh-CHT.ts
index 3ea95f66c..e4f4480b7 100644
--- a/selfdrive/ui/translations/main_zh-CHT.ts
+++ b/selfdrive/ui/translations/main_zh-CHT.ts
@@ -736,6 +736,10 @@ This may take up to a minute.
sunnylink
+
+ Trips
+
+
Setup
diff --git a/sunnypilot/selfdrive/assets/offroad/icon_trips.png b/sunnypilot/selfdrive/assets/offroad/icon_trips.png
new file mode 100644
index 000000000..95dec05c2
--- /dev/null
+++ b/sunnypilot/selfdrive/assets/offroad/icon_trips.png
@@ -0,0 +1,3 @@
+version https://git-lfs.github.com/spec/v1
+oid sha256:f8e5ba807427b7533f513fdd9ca270e420f3ccb63b2182203ed71453449c127a
+size 5354