43 lines
2.1 KiB
C++
43 lines
2.1 KiB
C++
// SPDX-License-Identifier: MIT
|
|
// SPDX-FileCopyrightText: 2026 Martino Ferrari
|
|
|
|
#pragma once
|
|
|
|
#include "config.hpp"
|
|
|
|
namespace udpscope {
|
|
|
|
/// Asks which data source to open: a list of the sources with a stored session, and a form for a
|
|
/// new one. Returns true with `cfg`'s connection fields filled in, or false if the user declined
|
|
/// -- in which case `cfg` is untouched and the caller should exit.
|
|
///
|
|
/// Runs *before* `ScopeModel` exists, so declining costs no buffer and no socket. It drives its
|
|
/// own `gtk_init()` and nested `GMainLoop`; `run_ui()`'s `GtkApplication` comes afterwards in the
|
|
/// same process, which works because `gtk_init()` is idempotent.
|
|
bool choose_source(Config& cfg);
|
|
|
|
/// Fills in the settings a *stored* configuration carries for `cfg`'s source -- the buffer size,
|
|
/// relative time and the packet capture's ring size -- leaving alone anything the command line
|
|
/// actually asked for.
|
|
///
|
|
/// The chooser applies these when it opens a source; a source named with `--server` never reaches
|
|
/// the chooser, so without this a saved host's buffer size and clock were silently ignored and the
|
|
/// edit that set them read as one that never took effect. The layout is *not* applied here: it
|
|
/// names signals, so it is loaded by the app once a CONFIG has described them.
|
|
void apply_stored_settings(Config& cfg);
|
|
|
|
/// Puts a small window on screen saying what `cfg` is about to be opened as, and paints it before
|
|
/// returning. Call it after the chooser has answered and *before* the buffer is planned or a
|
|
/// recording is read: both of those run with no main loop, so nothing drawn later than this would
|
|
/// appear until they are over.
|
|
///
|
|
/// Returns having pumped the main context long enough for the window to be mapped and drawn. The
|
|
/// caller owes a `loading_hide()`, which `run_ui()` does once the main window is presented.
|
|
void loading_show(const Config& cfg);
|
|
|
|
/// Takes the loading window down. A no-op when none is up, so the paths that never show one -- a
|
|
/// source named with `--server` -- need no notion of it.
|
|
void loading_hide();
|
|
|
|
} // namespace udpscope
|