Renaming a collapsed preset or configuration group lost its collapsed
state and left a stale entry under the old name. Deleting a group left a
stale entry too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Device Set Presets and Configurations dialogs expanded every group each
time they were opened. With many groups, finding a preset means scrolling
through the whole list.
Remember which groups the user collapses (QSettings keys
presets.collapsed_groups and configurations.collapsed_groups, same mechanism
as graphics.ui_scale_factor) and restore that state when the dialogs are
reopened. The initially selected item is now picked from expanded groups
only, so the selection does not re-expand a collapsed group.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setValue() formatted the new text before clamping the value, so a value
above the maximum produced a text with more digits than the dial and the
dial ended up showing the unclamped value. Format the clamped value
instead.
The current and new texts can still differ in length while animating,
for example when setValueRange() changes the number of digits, so only
compare characters that exist in the new text.
Fixes#2997
Explicitly delete the copy constructor and copy assignment operator for
TVScreenAnalogBuffer to prevent accidental duplication of its buffer.
The destructor deletes m_outOfBoundsLine with delete[]. A shallow copy
would cause multiple instances to own the same array, potentially
resulting in double deletion and memory corruption.
Since TVScreenAnalogBuffer manages this buffer directly, prohibit copying
and assignment at compile time.
cppcheck identified the missing copy constructor and assignment operator
with its noCopyConstructor and noOperatorEq warnings.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Initialize devicePixelRatio to avoid a GCC 14.2 -Wmaybe-uninitialized
warning when the window handle is unavailable.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Normalize existing text files to LF to conform to the repository-wide
line-ending policy defined by .gitattributes by:
git add --renormalize .
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Assign descriptive names to SDRangel threads so thread activity can be
identified when investigating multi-threaded behavior, including crashes,
leaks, and synchronization issues in debuggers and others tools.
Use compact names to fit platform thread-name limits (14 chars) while
retaining the component and thread role where possible.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
MessageQueue::pop() transfers ownership of the popped message to the
caller, but many handleInputMessages() implementations only deleted
the message when handleMessage() returned true. When a message was not
handled, ownership had already been transferred from the queue and the
message was leaked.
This was identified while investigating an ASAN leak in the audio
subsystem.
Update the applicable handleInputMessages() implementations to always
delete messages after handleMessage() returns. Unhandled messages are
also logged with the component and message identifier so unexpected
message routing is visible during debugging.
This change:
- Ensures every message popped from a queue has its ownership resolved.
- Prevents leaks when handleMessage() returns false.
- Makes unhandled messages visible instead of silently discarding them.
- Preserves the existing message handling logic and does not require
components to handle message types that are legitimately irrelevant
to them.
The changes are intentionally mechanical and limited to the common
message queue ownership and diagnostic pattern.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Add a world icon button to the position dialog that opens
mapquest.com in the default browser. This makes users aware that
latitude, longitude can be obtained from standard web sites when
a GPS or other positioning device is not available, without
requiring them to search for a way to obtain the information.
This provides an (in)direct path to the values needed by SDRangel.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Removing a channel's sink or source from a device engine was a queued
message, so a channel could be deleted while the engine thread was
still feeding it. When the caller is deleting, the removal now runs on
the engine thread and is waited for, provided that thread is running
and is not the caller. The MIMO engine gains the same deleting flag and
does the same for its MIMO channels.
ScopeVis and GLScope now attach and detach under the vis mutex and each
clears the other on destruction, as SpectrumVis and GLSpectrum already
do, so a scope window closing while its channel is still running no
longer leaves a dangling pointer on either side.
Also drops an unused variable in GLSpectrumView::paintGL.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GET .../spectrum/history reads the history the spectrum display keeps
for scrolling and reports, over the last seconds and a frequency range
reduced to bins, the per bin maximum, mean and occupancy against a
floor taken as the median of the per bin means, and the signals: each
run of bins above the threshold with its frequency, width, peak, duty
cycle and first and last seen. GET .../spectrum/history/image renders
the same history as a greyscale PNG with its extents in headers.
GLSpectrumInterface gains getSpectrumHistory, which GLSpectrumView
answers from its scroll buffer under its mutex, folding consecutive
rows together by maximum so that at most the rows asked for span the
whole period, since every FFT is a row. Rows taken at another centre or
rate are skipped and counted.
SpectrumVis reads the display while holding its mutex, so the display
is now attached and detached under it, and each side clears the other
on destruction.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
GET /sdrangel/windows lists every device, spectrum, channel and feature
window with its workspace, title and whether it is hidden; the workspace
PUTs take a hidden field alongside the index.
The Web API has no access to the GUI, so MainCore keeps a table of what
the GUI has published for each window, keyed by the DeviceAPI,
SpectrumVis, ChannelAPI or Feature it belongs to. The GUI side is a new
WorkspaceWindow base for the four window classes, which publishes on
every show and hide, on a retitle and when the workspaces are renumbered,
and takes the workspace from the window's Workspace ancestor rather than
the plugin's settings, which a settings message from the channel can
reset.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The GPS position button indicates that other positioning methods may be
used when GPS is unavailable. Add an IP geolocation fallback using the
IP2Location.io web service to obtain approximate latitude and longitude,
followed by Open-Elevation to determine elevation for those coordinates.
Only use the fallback when GPS is unavailable and the current latitude and
longitude are both zero, avoiding replacement of an existing position
entered by the user or obtained from another source since the IP geolocation
is known to be ± 50km.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
blockApplySettings(true) ... blockApplySettings(false) only works while the
pairs do not nest. Where they did, the inner one unblocked on the way out
and everything after it in the outer call ran unblocked, so touching a
widget there sent the settings back to the channel.
FreqScannerGUI::handleMessage did exactly that: it blocked, called
displaySettings(), which blocks and unblocks around its own work, and so
ran the rest of itself unblocked. The spectrum GUI had the same shape in
its waterfall and spectrogram handlers.
blockApplySettings now returns the state it found, and callers pass that
back rather than false.
The spectrum GUI also blocks the waterfall and spectrogram signals while
displaySettings ticks them. setChecked() fires the toggled handlers, which
clear each other for mutual exclusion, so displaying a saved
display3DSpectrogram immediately switched it back off: the 3D spectrogram
could be set but never appeared.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Device, spectrum, channel and feature windows gain a hide button beside
the existing ones. A hidden window is still there and still running, it
just takes no screen space, which is the difference between hiding one and
closing it.
The new Window menu brings them back: it lists whatever is currently
hidden, grouped under Devices, Spectrums, Channels and Features, and is
empty when nothing is. It also carries the sub window arrangements that
until now only existed as workspace title bar buttons: cascade, tile,
stack vertically, stack in columns, and tabs.
Those buttons held Ctrl+Shift+C/T/V/S/B, but every workspace's buttons
claimed the same keys, so with more than one workspace the shortcuts were
ambiguous and none of them fired. The menu items take the shortcuts
instead, as application shortcuts since an undocked workspace is a window
of its own, and act on the workspace last worked in. Tabs is per
workspace, so its tick follows whichever workspace that is.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Server side for the spectrum paths added to the spec: GET spectrum/report
returns whichever measurement is switched on, POST spectrum/actions
carries autoscale, clearSpectrum, resetMeasurements, freeze and
gotoMarker, and GET spectrum/data returns the power values reduced to a
number of bins. The display actions reach the spectrum through new
GLSpectrumInterface methods that default to doing nothing, so an instance
without a GUI ignores them rather than every caller having to know.
The measurement results are kept as plain values behind a lock and
published once per displayed frame, so a report costs nothing until one is
asked for, and the figures match what is on screen.
Also completes the main spectrum settings, which were only partly carried
over the API, and adds reports that had no way to be read at all: vessels
for AIS, stations for APRS, sondes for Radiosonde, the programme list for
DAB, the RDS programme service name for BFM, and validity flags for the
ADS-B aircraft report so a caller can tell a missing position from one at
zero. Map settings are exposed through their generated setters.
Two fixes found while testing: the frequency scanner dropped the frequency
list because the API calls it "frequencies" and everything downstream
keys it as "frequencySettings", and the spectrum adapters bound a
reference to the error message before init() had allocated one, so every
error path returned no response at all.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
QMessageBox::information() and friends build the box on the stack, parent
it to the calling widget and run a nested event loop in exec(). If the
parent is closed while the box is open, which the Web API can do at any
time, the parent deletes the box and its children and the heap is
corrupted.
MessageDialog offers the same calls, but the box is heap allocated, given
Qt::WA_DeleteOnClose and shown rather than exec'd, so nothing runs a
nested event loop and the box owns its own lifetime. A box with the same
text as one already up is raised instead of a second being created.
The trade off is that information(), warning() and critical() return
immediately and cannot report which button was pressed. question() takes
a callback for the cases that need the answer.
Converts the call sites in the device, channel and feature GUIs.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ThreadSanitizer identified a race on GLSpectrumView::m_displayChanged
between the GUI thread and the spectrum processing thread. The
spectrum processing path sets m_displayChanged when display
configuration changes, while the GUI update path reads and clears the
flag in GLSpectrumView::tick().
These accesses can occur concurrently when the display is being
updated, allowing tick() to read or clear m_displayChanged while
another thread is setting it.
Make m_displayChanged an atomic_bool so the cross-thread notification
between the spectrum processing and GUI threads is synchronized.
This eliminates the data race identified by ThreadSanitizer and
ensures display-change notifications are not subject to unsynchronized
reads and writes.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Fix a signed/unsigned arithmetic issue in ValueDialZ::keyPressEvent()
reported by cppcheck.
The digit editing code used quint64 intermediates together with a signed
sign value:
int sign = m_value < 0 ? -1 : 1;
setValue(sign * v);
When editing negative values, the signed -1 was converted to an unsigned
value before multiplication, causing the result to wrap instead of
producing a negative value.
Use qint64 intermediates for the digit manipulation and apply the existing
sign explicitly when updating the value. This preserves correct behavior
when editing negative values and avoids the unintended unsigned conversion.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Cppcheck reported that setAlpha() could call log() with an argument of
zero when alpha is clamped to 0.0f, resulting in an invalid-domain
mathematical operation.
Initialize tau to 0.0f and only compute the logarithm when alpha is
strictly positive. This preserves the existing behavior while avoiding
the invalid log(0) call.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
cppcheck identified that LogSlider::LogSlider() calls the derived
setRange(double, double) overload instead of QSlider::setRange(int, int)
due to C++ name hiding.
The constructor's call to:
setRange(0, 1000);
was therefore invoking the logarithmic range implementation with
min == 0.0, resulting in a call to log10(0). While most callers
immediately replace the initial state by calling LogSlider::setRange()
with a valid positive range, the constructor still performs an invalid
mathematical operation during initialization.
Explicitly qualify the call as QSlider::setRange(0, 1000) to initialize
the underlying slider without invoking the logarithmic overload. This
eliminates the invalid-domain call, avoids undefined behavior from
propagating exceptional floating-point values into the slider state, and
makes the constructor's intent explicit.
This change has no functional impact on normal operation, but removes a
latent initialization bug and prevents future regressions caused by
overload hiding.
Signed-off-by: Robin Getz <rgetz503@gmail.com>
Built-in devices were previously always selectable regardless of
their claimed state. The "show devices in use" change
964bc0994d
inadvertently disabled all claimed devices in the selection dialog,
preventing multiple instances of FileInput, RemoteTCPInput, AudioInput,
TestSource and other built-in sources from being opened. :(
Only claimed physical devices are now disabled and marked
"[in use]". Built-in devices remain selectable as before.
Signed-off-by: Robin Getz <rgetz503@gmail.com>