UI Updates
This commit is contained in:
+30
-5
@@ -1006,12 +1006,18 @@ impl App {
|
|||||||
|
|
||||||
// -- Signal Action Menu helpers --
|
// -- Signal Action Menu helpers --
|
||||||
|
|
||||||
/// Signal actions shown in the menu: all if HackRF (TX), else only export and delete.
|
/// Signal actions shown in the menu. With HackRF: Replay always; Lock/Unlock/Trunk/Panic only when
|
||||||
|
/// the selected capture is encoder-capable (unknown or decoded-only signals get Replay only).
|
||||||
|
/// Without TX (e.g. RTL-SDR): only export and delete.
|
||||||
pub fn available_signal_actions(&self) -> Vec<SignalAction> {
|
pub fn available_signal_actions(&self) -> Vec<SignalAction> {
|
||||||
if self.radio.as_ref().map_or(false, |r| r.supports_tx()) {
|
let has_tx = self.radio.as_ref().map_or(false, |r| r.supports_tx());
|
||||||
SignalAction::ALL.to_vec()
|
let encoder_capable = self
|
||||||
} else {
|
.selected_capture
|
||||||
SignalAction::ALL
|
.and_then(|idx| self.captures.get(idx))
|
||||||
|
.map_or(false, |c| c.status == crate::capture::CaptureStatus::EncoderCapable);
|
||||||
|
|
||||||
|
if !has_tx {
|
||||||
|
return SignalAction::ALL
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|a| {
|
.filter(|a| {
|
||||||
matches!(
|
matches!(
|
||||||
@@ -1020,6 +1026,25 @@ impl App {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
.copied()
|
.copied()
|
||||||
|
.collect();
|
||||||
|
}
|
||||||
|
|
||||||
|
if encoder_capable {
|
||||||
|
SignalAction::ALL.to_vec()
|
||||||
|
} else {
|
||||||
|
// Unknown or decoded-only: only Replay + export + delete (no TX Lock/Unlock/Trunk/Panic)
|
||||||
|
SignalAction::ALL
|
||||||
|
.iter()
|
||||||
|
.filter(|a| {
|
||||||
|
!matches!(
|
||||||
|
a,
|
||||||
|
SignalAction::Lock
|
||||||
|
| SignalAction::Unlock
|
||||||
|
| SignalAction::Trunk
|
||||||
|
| SignalAction::Panic
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.copied()
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user