diff --git a/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_flag.png b/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_flag.png new file mode 100644 index 000000000..2658aa9b7 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_home.png b/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_home.png new file mode 100644 index 000000000..2658aa9b7 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_settings.png b/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_settings.png new file mode 100644 index 000000000..559275997 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/frog_theme/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_flag.png b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_flag.png new file mode 100644 index 000000000..ef6fafe7b Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_home.png b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_home.png new file mode 100644 index 000000000..ef6fafe7b Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_settings.png b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_settings.png new file mode 100644 index 000000000..b58a7268b Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/images/button_settings.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_flag.png b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_flag.png new file mode 100644 index 000000000..2cc81a700 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_flag.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_home.png b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_home.png new file mode 100644 index 000000000..2cc81a700 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_home.png differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_settings.png b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_settings.png new file mode 100644 index 000000000..549e2bedb Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/images/button_settings.png differ diff --git a/selfdrive/ui/qt/sidebar.cc b/selfdrive/ui/qt/sidebar.cc index a6870331f..68bf0294d 100644 --- a/selfdrive/ui/qt/sidebar.cc +++ b/selfdrive/ui/qt/sidebar.cc @@ -50,6 +50,19 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed( {3, {"stalin_theme", {QColor(255, 0, 0)}}} }; + for (auto &[key, themeData] : themeConfiguration) { + QString &themeName = themeData.first; + QString base = themeName == "stock" ? "../assets/images" : QString("../frogpilot/assets/custom_themes/%1/images").arg(themeName); + std::vector paths = {base + "/button_home.png", base + "/button_flag.png", base + "/button_settings.png"}; + + home_imgs[key] = loadPixmap(paths[0], home_btn.size()); + flag_imgs[key] = loadPixmap(paths[1], home_btn.size()); + settings_imgs[key] = loadPixmap(paths[2], settings_btn.size(), Qt::IgnoreAspectRatio); + } + + home_img = home_imgs[scene.custom_icons]; + flag_img = flag_imgs[scene.custom_icons]; + settings_img = settings_imgs[scene.custom_icons]; currentColors = themeConfiguration[scene.custom_colors].second; } @@ -95,6 +108,10 @@ void Sidebar::updateState(const UIState &s) { // FrogPilot properties const UIScene &scene = s.scene; + home_img = home_imgs[scene.custom_icons]; + flag_img = flag_imgs[scene.custom_icons]; + settings_img = settings_imgs[scene.custom_icons]; + currentColors = themeConfiguration[scene.custom_colors].second; auto frogpilotDeviceState = sm["frogpilotDeviceState"].getFrogpilotDeviceState(); diff --git a/selfdrive/ui/qt/sidebar.h b/selfdrive/ui/qt/sidebar.h index c67629e82..4d96693fd 100644 --- a/selfdrive/ui/qt/sidebar.h +++ b/selfdrive/ui/qt/sidebar.h @@ -64,6 +64,9 @@ private: Params params; std::unordered_map>> themeConfiguration; + std::unordered_map flag_imgs; + std::unordered_map home_imgs; + std::unordered_map settings_imgs; std::vector currentColors; }; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 00cd6beb6..7f4bd127b 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -331,6 +331,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { bool custom_theme = params.getBool("CustomTheme"); scene.custom_colors = custom_theme ? params.getInt("CustomColors") : 0; + scene.custom_icons = custom_theme ? params.getInt("CustomIcons") : 0; scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing"); scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 27d8b22c3..2cc9f00df 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -186,6 +186,7 @@ typedef struct UIScene { int conditional_speed_lead; int conditional_status; int custom_colors; + int custom_icons; int model_length; int steering_angle_deg; int tethering_config;