feat(gui): compact icon toolbar + SD-card media button
source / check (pull_request) Skipped
verify / verify (pull_request) Successful in 22m53s
verify / verify-windows (pull_request) Successful in 20m10s

Reworks the fleet-view toolbar into icon buttons and adds a direct
Installation-Media entry point:

- New wx-rs bridge fn `wxbr_svg_button` (patch 0010): render a recoloured SVG
  into a clickable wxBitmapButton. Rust wrapper `Widget::svg_button`.
- Settings -> gear icon; its dropdown already carries Logs (ID_LOGS_OPEN), so
  the standalone Log toolbar button is removed (the inline log view + toggle
  are kept but no longer surfaced as a button).
- Bug report -> bug icon.
- New unified "Data" icon (database) with a dropdown: Presets, Filter, Columns,
  Export (the four former standalone buttons; items dispatched via on_menu_item).
- New "SD card" icon opens the Installation Media dialog without right-clicking
  a miner (ID_MEDIA_TOOLBAR -> build_install_media_dialog; defaults to the
  zynq-7010 board when nothing is selected).
- Four new Font-Awesome-style icons (gear/bug/database/sd-card), recoloured to
  the theme foreground via svg_recolored; tooltips name each button.

Native + Windows clippy clean, fmt clean, GUI self-test passes; icons verified
to rasterise correctly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B1W6qKwKxq3oUPDKWicM6i
This commit is contained in:
2026-11-17 13:27:01 -06:00
co-authored by Claude Opus 4.8
parent 99cddbdf93
commit 8cb6989000
8 changed files with 149 additions and 12 deletions
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><g stroke="currentColor" stroke-width="24" stroke-linecap="round" fill="none"><path d="M256 150 L256 118"/><path d="M256 118 L214 74"/><path d="M256 118 L298 74"/><path d="M168 232 L88 196"/><path d="M164 302 L78 302"/><path d="M168 372 L88 414"/><path d="M344 232 L424 196"/><path d="M348 302 L434 302"/><path d="M344 372 L424 414"/></g><ellipse cx="256" cy="300" rx="96" ry="138" fill="currentColor"/><circle cx="256" cy="162" r="56" fill="currentColor"/></svg>

After

Width:  |  Height:  |  Size: 526 B

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" d="M448 80l0 48c0 44.2-100.3 80-224 80S0 172.2 0 128L0 80C0 35.8 100.3 0 224 0S448 35.8 448 80zM393.2 214.7c20.8-7.4 39.9-16.9 54.8-28.6L448 288c0 44.2-100.3 80-224 80S0 332.2 0 288L0 186.1c14.9 11.8 34 21.2 54.8 28.6C99.7 230.7 159.5 240 224 240s124.3-9.3 169.2-25.3zM0 346.1c14.9 11.8 34 21.2 54.8 28.6C99.7 390.7 159.5 400 224 400s124.3-9.3 169.2-25.3c20.8-7.4 39.9-16.9 54.8-28.6L448 432c0 44.2-100.3 80-224 80S0 476.2 0 432L0 346.1z"/></svg>

After

Width:  |  Height:  |  Size: 535 B

+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path fill="currentColor" d="M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336a80 80 0 1 0 0-160 80 80 0 1 0 0 160z"/></svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><path fill="currentColor" d="M64 0C28.7 0 0 28.7 0 64L0 448c0 35.3 28.7 64 64 64l256 0c35.3 0 64-28.7 64-64l0-277.5c0-17-6.7-33.3-18.7-45.3l-90.5-90.5C262.7 6.7 246.5 0 229.5 0L64 0zM96 96c0-8.8 7.2-16 16-16s16 7.2 16 16l0 64c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64zm80 0c0-8.8 7.2-16 16-16s16 7.2 16 16l0 64c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64zm80 0c0-8.8 7.2-16 16-16s16 7.2 16 16l0 64c0 8.8-7.2 16-16 16s-16-7.2-16-16l0-64z"/></svg>

After

Width:  |  Height:  |  Size: 498 B

+60 -12
View File
@@ -28,6 +28,11 @@ pub const ID_EXPORT: i32 = 109;
pub const ID_SETTINGS: i32 = 110;
// Bug report / feature request dialog (toolbar, between Export and Settings).
pub const ID_BUG_REPORT: i32 = 111;
// Unified "Data" toolbar icon button: a dropdown of Presets/Filter/Columns/Export.
pub const ID_DATA: i32 = 112;
// "Installation Media" toolbar icon button: opens the SD-card build dialog
// without needing to right-click a miner.
pub const ID_MEDIA_TOOLBAR: i32 = 113;
const ID_REPORT_SEND: i32 = 240;
const ID_REPORT_CLOSE: i32 = 241;
const ID_REPORT_OPEN: i32 = 242;
@@ -683,6 +688,12 @@ const SVG_BOLT_FULL: &str = include_str!("../assets/icons/bolt-solid-full.svg");
const SVG_BRAIN_FULL: &str = include_str!("../assets/icons/brain-solid-full.svg");
const SVG_FAN_FULL: &str = include_str!("../assets/icons/fan-solid-full.svg");
const SVG_CHIP_FULL: &str = include_str!("../assets/icons/microchip-solid-full.svg");
// Toolbar icon buttons (round 19): gear (Settings), bug (report), database
// (Data dropdown), sd-card (Installation Media).
const SVG_GEAR: &str = include_str!("../assets/icons/gear.svg");
const SVG_BUG: &str = include_str!("../assets/icons/bug.svg");
const SVG_DATA: &str = include_str!("../assets/icons/database.svg");
const SVG_SDCARD: &str = include_str!("../assets/icons/sd-card.svg");
/// KPI card minimum widths. The count cards (Total/Hashing/...) are narrow; the
/// two wide cards (SHA-256 Hashrate, Est. power) need more room so their
@@ -1269,21 +1280,36 @@ pub fn build(frame: Widget) -> App {
// when the language changes (round 15 #13).
let mut l10n_labels: Vec<(Widget, &'static str)> = Vec::new();
l10n_labels.push((ranges_btn, "Scan ranges"));
let mut tbtn = |label: &'static str, id: i32| -> Widget {
let b = Widget::button(panel, &crate::i18n::t(label), id);
// Compact icon toolbar (round 19): a unified "Data" dropdown (presets /
// filter / columns / export), an Installation-Media (SD card) button, Bug
// report, and Settings. Logs moved into the Settings dropdown
// (ID_LOGS_OPEN), so the old standalone Log button is gone. Icon buttons
// carry no text label, so they are not tracked for localization; their
// tooltips name them.
let icon_fg = if wx_rs::is_dark() {
(0xDD, 0xDD, 0xDD)
} else {
(0x33, 0x33, 0x33)
};
let icon_btn = |svg: &str, id: i32, tip: &str| -> Widget {
let b = Widget::svg_button(panel, &svg_recolored(svg, icon_fg), id, 22, 22);
b.set_tool_tip(&crate::i18n::t(tip));
ctl.add(b, 0, sf::ALIGN_CENTRE_VERTICAL | sf::BORDER_ALL, 4);
l10n_labels.push((b, label));
b
};
let _presets_btn = tbtn("Presets", ID_PRESETS);
let _filter_btn = tbtn("Filter", ID_FILTER);
let _columns_btn = tbtn("Columns", ID_COLUMNS);
let _export_btn = tbtn("Export", ID_EXPORT);
let _report_btn = tbtn("Bug report", ID_BUG_REPORT);
// The old Credentials button is now a Settings menu (round 15 #13).
let _creds_btn = tbtn("Settings", ID_SETTINGS);
// Toggle between the fleet table and the live activity log.
let log_toggle_btn = tbtn("Log", ID_LOG_TOGGLE);
let _data_btn = icon_btn(SVG_DATA, ID_DATA, "Data: presets, filter, columns, export");
let _media_btn = icon_btn(
SVG_SDCARD,
ID_MEDIA_TOOLBAR,
"Create installation media (SD card)",
);
let _report_btn = icon_btn(SVG_BUG, ID_BUG_REPORT, "Report a bug or request a feature");
let _settings_btn = icon_btn(SVG_GEAR, ID_SETTINGS, "Settings, language, and logs");
// The inline table/log view toggle is kept (toggle_log_view / log_view) but
// no longer surfaced as a toolbar button; logs are reached from Settings.
// Created hidden so the field and toggle_log_view stay valid.
let log_toggle_btn = Widget::button(panel, "Log", ID_LOG_TOGGLE);
log_toggle_btn.show(false);
root.add_sizer(ctl, 0, sf::EXPAND | sf::BORDER_LEFT | sf::BORDER_RIGHT, 4);
// Track the KPI captions for live re-localization (index 5, the hashrate
// caption, is dynamic per-algorithm so it is refreshed by refresh_kpis).
@@ -3766,6 +3792,12 @@ impl App {
// Settings menu items (round 15 #13).
ID_SCAN_CREDS => return Some(self.build_firmware_creds_dialog()),
ID_LOGS_OPEN => return Some(self.build_logs_dialog()),
// "Data" dropdown items (round 19): the former standalone toolbar
// buttons, now entries in one icon button's menu.
ID_PRESETS => return Some(self.build_presets_dialog()),
ID_FILTER => return Some(self.build_filter_dialog()),
ID_COLUMNS => return Some(self.build_columns_dialog()),
ID_EXPORT => return self.open_export_dialog(),
ID_HDR_SORT_ASC | ID_HDR_SORT_DESC | ID_HDR_SORT_REL_ASC | ID_HDR_SORT_REL_DESC
| ID_HDR_HIDE | ID_HDR_AUTOSIZE | ID_HDR_AUTOSIZE_ALL | ID_HDR_COLUMNS => {
return self.on_header_menu(id)
@@ -5680,6 +5712,20 @@ impl App {
/// Build + queue the Settings popup menu (round 15 #13): Credentials, a
/// Language submenu, and the Logs page.
/// The unified "Data" toolbar dropdown: presets, filter, columns, export.
/// The items reuse the existing action ids and are dispatched by
/// `on_menu_item` (same as any popped menu).
fn open_data_menu(&mut self) {
let t = crate::i18n::t;
let menu = Widget::menu_new();
menu.menu_append(ID_PRESETS, &t("Presets..."));
menu.menu_append(ID_FILTER, &t("Filter..."));
menu.menu_append(ID_COLUMNS, &t("Columns..."));
menu.menu_append_separator();
menu.menu_append(ID_EXPORT, &t("Export..."));
self.pending_popup = Some((Widget::main_frame(), menu));
}
fn open_settings_menu(&mut self) {
let menu = Widget::menu_new();
menu.menu_append(ID_SCAN_CREDS, &crate::i18n::t("Credentials"));
@@ -6468,6 +6514,8 @@ impl App {
ID_EXPORT_ALL => self.export_check_all(true),
ID_EXPORT_NONE => self.export_check_all(false),
ID_SETTINGS => self.open_settings_menu(),
ID_DATA => self.open_data_menu(),
ID_MEDIA_TOOLBAR => return self.build_install_media_dialog(),
ID_LOG_TOGGLE => self.toggle_log_view(),
ID_BUG_REPORT => return Some(self.build_report_dialog()),
ID_REPORT_SEND => self.send_report(),
+56
View File
@@ -0,0 +1,56 @@
Subject: [PATCH 0010] svg_button: clickable SVG icon button for the toolbar
--- a/cpp_src/widgets_bridge.cpp
+++ b/cpp_src/widgets_bridge.cpp
@@ -2140,6 +2140,18 @@
return (void*)new wxStaticBitmap((wxWindow*)parent, wxID_ANY, bundle);
}
+// Like wxbr_svg_icon, but a clickable button: render the (already-recoloured)
+// SVG into a w x h DIP bitmap bundle and wrap it in a wxBitmapButton that emits
+// WxEV_BUTTON_CLICKED with `id`. Used for the toolbar's icon buttons.
+void* wxbr_svg_button(void* parent, const char* svg, int id, int w, int h) {
+ wxBitmapBundle bundle = wxBitmapBundle::FromSVG(svg, wxSize(w, h));
+ wxBitmapButton* btn = new wxBitmapButton((wxWindow*)parent, id, bundle);
+ btn->Bind(wxEVT_BUTTON, [id](wxCommandEvent&) {
+ if (g_widget_event) g_widget_event(WxEV_BUTTON_CLICKED, id, 0);
+ });
+ return (void*)btn;
+}
+
// Register a raw SVG (with its viewBox width/height for aspect) for a table-cell
// shape sentinel, so the SegmentRenderer can draw it recoloured to the cell's
// segment colour (round 12 #9 access padlocks, #11 status KPI icons). Replaces
--- a/src/widgets.rs
+++ b/src/widgets.rs
@@ -121,6 +121,13 @@
pub fn wxbr_choice_set_selection(win: *mut c_void, i: c_int);
pub fn wxbr_media_button(parent: *mut c_void, id: c_int, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
pub fn wxbr_svg_icon(parent: *mut c_void, svg: *const c_char, w: c_int, h: c_int) -> *mut c_void;
+ pub fn wxbr_svg_button(
+ parent: *mut c_void,
+ svg: *const c_char,
+ id: c_int,
+ w: c_int,
+ h: c_int,
+ ) -> *mut c_void;
pub fn wxbr_register_shape_svg(sentinel: c_int, svg: *const c_char, vbw: c_int, vbh: c_int);
pub fn wxbr_set_light_pulse(on: c_int);
pub fn wxbr_bind_sys_colour(win: *mut c_void);
@@ -949,6 +956,16 @@
Widget(unsafe { notsafe::wxbr_svg_icon(parent.0, c.as_ptr(), w as c_int, h as c_int) })
}
+ /// A clickable icon button: render the (already-recoloured) SVG into a
+ /// `w`x`h` DIP bitmap button that emits a button click with `id`. Recolour
+ /// the SVG first (explicit fill, not `currentColor`).
+ pub fn svg_button(parent: Widget, svg: &str, id: i32, w: i32, h: i32) -> Widget {
+ let c = CString::new(svg).unwrap_or_default();
+ Widget(unsafe {
+ notsafe::wxbr_svg_button(parent.0, c.as_ptr(), id as c_int, w as c_int, h as c_int)
+ })
+ }
+
/// Listen for OS light/dark theme changes on this window (emits `SysColour`).
pub fn bind_sys_colour(&self) {
unsafe { notsafe::wxbr_bind_sys_colour(self.0) }
@@ -2140,6 +2140,18 @@ void* wxbr_svg_icon(void* parent, const char* svg, int w, int h) {
return (void*)new wxStaticBitmap((wxWindow*)parent, wxID_ANY, bundle);
}
// Like wxbr_svg_icon, but a clickable button: render the (already-recoloured)
// SVG into a w x h DIP bitmap bundle and wrap it in a wxBitmapButton that emits
// WxEV_BUTTON_CLICKED with `id`. Used for the toolbar's icon buttons.
void* wxbr_svg_button(void* parent, const char* svg, int id, int w, int h) {
wxBitmapBundle bundle = wxBitmapBundle::FromSVG(svg, wxSize(w, h));
wxBitmapButton* btn = new wxBitmapButton((wxWindow*)parent, id, bundle);
btn->Bind(wxEVT_BUTTON, [id](wxCommandEvent&) {
if (g_widget_event) g_widget_event(WxEV_BUTTON_CLICKED, id, 0);
});
return (void*)btn;
}
// Register a raw SVG (with its viewBox width/height for aspect) for a table-cell
// shape sentinel, so the SegmentRenderer can draw it recoloured to the cell's
// segment colour (round 12 #9 access padlocks, #11 status KPI icons). Replaces
+17
View File
@@ -121,6 +121,13 @@ mod notsafe {
pub fn wxbr_choice_set_selection(win: *mut c_void, i: c_int);
pub fn wxbr_media_button(parent: *mut c_void, id: c_int, kind: c_int, r: c_int, g: c_int, b: c_int) -> *mut c_void;
pub fn wxbr_svg_icon(parent: *mut c_void, svg: *const c_char, w: c_int, h: c_int) -> *mut c_void;
pub fn wxbr_svg_button(
parent: *mut c_void,
svg: *const c_char,
id: c_int,
w: c_int,
h: c_int,
) -> *mut c_void;
pub fn wxbr_register_shape_svg(sentinel: c_int, svg: *const c_char, vbw: c_int, vbh: c_int);
pub fn wxbr_set_light_pulse(on: c_int);
pub fn wxbr_bind_sys_colour(win: *mut c_void);
@@ -949,6 +956,16 @@ impl Widget {
Widget(unsafe { notsafe::wxbr_svg_icon(parent.0, c.as_ptr(), w as c_int, h as c_int) })
}
/// A clickable icon button: render the (already-recoloured) SVG into a
/// `w`x`h` DIP bitmap button that emits a button click with `id`. Recolour
/// the SVG first (explicit fill, not `currentColor`).
pub fn svg_button(parent: Widget, svg: &str, id: i32, w: i32, h: i32) -> Widget {
let c = CString::new(svg).unwrap_or_default();
Widget(unsafe {
notsafe::wxbr_svg_button(parent.0, c.as_ptr(), id as c_int, w as c_int, h as c_int)
})
}
/// Listen for OS light/dark theme changes on this window (emits `SysColour`).
pub fn bind_sys_colour(&self) {
unsafe { notsafe::wxbr_bind_sys_colour(self.0) }