feat: the session file remembers which sidebar tab was showing

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Martino FerrariandClaude Sonnet 4.6 committed 2026-10-14 12:09:21 +02:00
1 parent d2ec89d866
commit 132041f79e
3 files changed
+9

No files matched your search

+3
View File
@@ -496,6 +496,8 @@ bool load_layout(const std::string& path, LayoutState& out) {
} }
} else if (key == "measure_stats") { } else if (key == "measure_stats") {
st.measure_stats = value == "true"; st.measure_stats = value == "true";
} else if (key == "side_tab") {
st.side_tab = strip_quote(value);
} else if (key == "multicast") { } else if (key == "multicast") {
st.multicast = strip_quote(value); st.multicast = strip_quote(value);
} else if (key == "interface") { } else if (key == "interface") {
@@ -645,6 +647,7 @@ bool save_layout(const std::string& path, const LayoutState& state) {
o << "]\n"; o << "]\n";
} }
o << "measure_stats = " << (state.measure_stats ? "true" : "false") << "\n"; o << "measure_stats = " << (state.measure_stats ? "true" : "false") << "\n";
o << "side_tab = \"" << state.side_tab << "\"\n";
if (!state.comment.empty()) o << "comment = " << toml_escape(state.comment) << "\n"; if (!state.comment.empty()) o << "comment = " << toml_escape(state.comment) << "\n";
if (state.buffer_mb > 0.0) o << "buffer_mb = " << state.buffer_mb << "\n"; if (state.buffer_mb > 0.0) o << "buffer_mb = " << state.buffer_mb << "\n";
o << "relative_time = " << (state.relative_time ? "true" : "false") << "\n"; o << "relative_time = " << (state.relative_time ? "true" : "false") << "\n";
+4
View File
@@ -66,6 +66,10 @@ struct LayoutState {
/// stream and mean nothing restored against another one. /// stream and mean nothing restored against another one.
bool measure_stats = false; bool measure_stats = false;
/// Which sidebar tab was showing: "measure" or "signals". The one thing the panel persists --
/// no revealer states remain, and the 320 px width is the `.ui`'s.
std::string side_tab = "signals";
/// The measurements pane, by signal *name* and with the type and options a row was built with. /// The measurements pane, by signal *name* and with the type and options a row was built with.
std::vector<Measure> measures; std::vector<Measure> measures;
+2
View File
@@ -58,6 +58,7 @@ LayoutState collect_layout(App& app) {
st.math = app.math; st.math = app.math;
st.measures = app.measures; st.measures = app.measures;
st.measure_stats = app.measure_stats_on; st.measure_stats = app.measure_stats_on;
st.side_tab = app.side_tab;
// The connection is the session's too: the file's name carries only host and port. // The connection is the session's too: the file's name carries only host and port.
st.multicast = app.source_multicast; st.multicast = app.source_multicast;
st.interface_addr = app.source_interface; st.interface_addr = app.source_interface;
@@ -327,6 +328,7 @@ void apply_layout(App& app, const LayoutState& st) {
app.measures = st.measures; app.measures = st.measures;
app.measure_stats_on = st.measure_stats; app.measure_stats_on = st.measure_stats;
app.updating_panels = true; app.updating_panels = true;
select_side_tab(app, st.side_tab.c_str());
if (app.measures_stats_check != nullptr) { if (app.measures_stats_check != nullptr) {
gtk_check_button_set_active(GTK_CHECK_BUTTON(app.measures_stats_check), gtk_check_button_set_active(GTK_CHECK_BUTTON(app.measures_stats_check),
app.measure_stats_on); app.measure_stats_on);