acquisition: drive a DataSource from the registry; --source and --source-opt

This commit is contained in:
Martino Ferrari committed 2026-10-31 19:59:51 +01:00
1 parent 46076312cc
commit 504bc193ea
8 files changed
+156 -164

No files matched your search

+4 -2
View File
@@ -7,6 +7,7 @@
#include "waveform.hpp"
#include "model.hpp"
#include "plot_host.hpp"
#include "source/registry.hpp"
#include "source_dialog.hpp"
#include "ui.hpp"
@@ -18,6 +19,7 @@
int main(int argc, char** argv) {
udpscope::Config cfg;
try {
udpscope::register_builtin_sources();
cfg = udpscope::parse_args(argc, argv);
// The preferences fill in what the command line did not decide. `--relative-time` is an explicit
// instruction for this run, so a preference can only turn the mode on, never off -- which is also
@@ -57,13 +59,13 @@ int main(int argc, char** argv) {
// declining must cost no buffer and no socket, and nothing below has to cope with "no source".
// `--open` is the other answer to that question, and the chooser knows it: its Waveforms page
// fills `open_waveform` in instead of the connection fields.
const bool asked = !cfg.server_specified && cfg.open_waveform.empty();
const bool asked = !cfg.has_source() && cfg.open_waveform.empty();
if (asked && !udpscope::choose_source(cfg)) return 0;
// A source named on the command line skips the chooser, but its *stored* configuration still
// applies: the buffer size, the clock and the capture ring are decided here, before the model --
// which is the only moment they can be -- and a saved host whose buffer was ignored because the
// address came from the command line is an edit that looks like it never took effect.
if (cfg.server_specified) udpscope::apply_stored_settings(cfg);
if (cfg.has_source()) udpscope::apply_stored_settings(cfg);
// Everything from here to `gtk_window_present()` inside `run_ui()` runs with no main loop: the
// buffer is allocated, a recording is read, then the whole UI is built. The chooser's window is