feat(gui): compact icon toolbar + SD-card media button
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:
+60
-12
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user