Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions gcs/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,13 +304,6 @@ function setMainMenu() {
{
label: "View",
submenu: [
{
label: "Connection Stats",
click: () => {
openLinkStatsWindow()
},
},
{ type: "separator" },
{ role: "reload" },
{ role: "forceReload" },
{ role: "toggleDevTools" },
Expand All @@ -322,6 +315,23 @@ function setMainMenu() {
{ role: "togglefullscreen" },
],
},
{
label: "Advanced",
submenu: [
{
label: "Connection Stats",
click: () => {
openLinkStatsWindow()
},
},
{
label: "MAVLink Forwarding",
click: () => {
win?.webContents.send("mavlink-forwarding:open")
},
},
],
},
]
const menu = Menu.buildFromTemplate(template)
Menu.setApplicationMenu(menu)
Expand Down
1 change: 1 addition & 0 deletions gcs/electron/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const ALLOWED_ON_CHANNELS = [
"app:send-ekf-status",
"app:send-vibe-status",
"settings:open",
"mavlink-forwarding:open",
]

contextBridge.exposeInMainWorld("ipcRenderer", {
Expand Down
7 changes: 7 additions & 0 deletions gcs/src/components/navbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ export default function Navbar() {
}
}, [comPorts, selectedComPort])

useEffect(() => {
const handler = () => dispatch(setForwardingAddressModalOpened(true))
window.ipcRenderer.on("mavlink-forwarding:open", handler)
return () =>
window.ipcRenderer.removeAllListeners("mavlink-forwarding:open")
}, [dispatch])

const linkClassName =
"text-md px-2 rounded-sm outline-none focus:text-falconred-400 hover:text-falconred-400 transition-colors delay-50"

Expand Down
2 changes: 1 addition & 1 deletion gcs/src/helpers/settingsProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const SettingsProvider = ({ children }) => {
useEffect(() => {
const handler = () => open()
window.ipcRenderer.on("settings:open", handler)
return () => window.ipcRenderer.removeListener("settings:open", handler)
return () => window.ipcRenderer.removeAllListeners("settings:open")
}, [open])

const setSetting = (setting, value) => {
Expand Down
Loading