From addd0b97cabb7597979a56689aeec69d0a4bc6f4 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Thu, 16 Jan 2025 17:15:24 -0300 Subject: [PATCH] widgets: Only enable cog icon for widgets that are configurable through the standard system --- src/components/EditMenu.vue | 5 +++++ src/types/widgets.ts | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/components/EditMenu.vue b/src/components/EditMenu.vue index fdb19a56c..02fa4a2d6 100644 --- a/src/components/EditMenu.vue +++ b/src/components/EditMenu.vue @@ -294,6 +294,7 @@ />
@@ -360,6 +361,7 @@
@@ -429,6 +431,7 @@
@@ -664,6 +667,8 @@ import { CustomWidgetElementType, ExternalWidgetSetupInfo, InternalWidgetSetupInfo, + isMiniWidgetConfigurable, + isWidgetConfigurable, MiniWidgetType, WidgetType, } from '@/types/widgets' diff --git a/src/types/widgets.ts b/src/types/widgets.ts index 773c91644..ff29d6536 100644 --- a/src/types/widgets.ts +++ b/src/types/widgets.ts @@ -810,6 +810,41 @@ export type Profile = { name: string } +export const isWidgetConfigurable: Record = { + [WidgetType.Attitude]: true, + [WidgetType.Compass]: true, + [WidgetType.CompassHUD]: true, + [WidgetType.CustomWidgetBase]: true, + [WidgetType.DepthHUD]: true, + [WidgetType.IFrame]: true, + [WidgetType.ImageView]: true, + [WidgetType.Map]: true, + [WidgetType.MiniWidgetsBar]: false, + [WidgetType.Plotter]: true, + [WidgetType.URLVideoPlayer]: true, + [WidgetType.VideoPlayer]: true, + [WidgetType.VirtualHorizon]: false, +} + +export const isMiniWidgetConfigurable: Record = { + [MiniWidgetType.Alerter]: false, + [MiniWidgetType.ArmerButton]: false, + [MiniWidgetType.BaseCommIndicator]: false, + [MiniWidgetType.BatteryIndicator]: true, + [MiniWidgetType.ChangeAltitudeCommander]: false, + [MiniWidgetType.Clock]: false, + [MiniWidgetType.DepthIndicator]: false, + [MiniWidgetType.MissionIdentifier]: true, + [MiniWidgetType.RelativeAltitudeIndicator]: false, + [MiniWidgetType.TakeoffLandCommander]: false, + [MiniWidgetType.VeryGenericIndicator]: true, + [MiniWidgetType.JoystickCommIndicator]: true, + [MiniWidgetType.MiniVideoRecorder]: true, + [MiniWidgetType.ModeSelector]: false, + [MiniWidgetType.SatelliteIndicator]: false, + [MiniWidgetType.ViewSelector]: false, +} + export const validateWidget = (maybeWidget: Widget): maybeWidget is Widget => { if (maybeWidget.hash === undefined) throw new Error('Widget validation failed: property hash is missing.')