refactor(mining): extract the Hashrate+Stats card into mining_stats.{h,cpp} (audit #10, slice 2)

Second slice of decomposing mining_tab.cpp. The ~313-line "Hashrate + Stats" card (stat values +
hashrate chart / live-log view) is moved verbatim into RenderMiningStats(); mining_tab.cpp is now
1680 lines (was 1992 after slice 1, 2628 originally). Body byte-identical apart from a s_pool_mode
alias; the chart/log toggle statics (s_show_pool_log/s_show_solo_log) moved with the card, and the
log buffer was already a function-local static. No App dependency in this section.

Verified: full-node + Windows + lite build, tests, hygiene, clean smoke start. Pending hands-on
visual check before the next slice.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 16:03:51 -05:00
parent 47f228fa47
commit e21f7bf8aa
4 changed files with 381 additions and 316 deletions

View File

@@ -0,0 +1,24 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include "../../data/wallet_state.h"
#include "../material/draw_helpers.h" // GlassPanelSpec
#include "imgui.h"
namespace dragonx {
namespace ui {
// Renders the mining "Hashrate + Stats" card (stat values on top, hashrate chart or live log
// below). Extracted verbatim from the monolithic mining tab; the immediate-mode layout context is
// passed in so the rendering flows in sequence exactly as before. `poolMode` is the parent's
// solo/pool toggle.
void RenderMiningStats(const WalletState& state, const MiningInfo& mining,
ImDrawList* dl, ImFont* capFont, ImFont* sub1, ImFont* ovFont,
float dp, float vs, float gap, float pad, float availWidth,
const material::GlassPanelSpec& glassSpec, float chartBudgetH, bool poolMode);
} // namespace ui
} // namespace dragonx