refactor(mining): extract the Mode toggle into mining_mode_toggle.{h,cpp} (audit #10, slice 4)

Final slice of decomposing mining_tab.cpp. The ~529-line "Mode toggle" section (SOLO | POOL
segmented control + pool URL/worker inputs) is moved verbatim into RenderMiningModeToggle().
mining_tab.cpp is now 311 lines (was 2628) — just the tab dispatch, thread-sync glue, benchmark
advance, section-budget setup, and four card calls.

State the toggle mutates is passed BY REFERENCE so behaviour is identical: the pool-mode flag,
the settings-dirty flag, and the pool URL / worker char[256] buffers (the text inputs write into
them) — passed as char(&)[256] references and named with their original identifiers so the body
stays byte-identical.

Verified: full-node + Windows + lite build, tests, hygiene. Audit #10 complete: the 2628-line
monolith is now five focused files (earnings, stats, controls, mode-toggle + the 311-line shell).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-10 18:42:16 -05:00
parent 9389859ee9
commit 1a8d6fd30f
4 changed files with 604 additions and 531 deletions

View File

@@ -0,0 +1,25 @@
// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
#pragma once
#include "../../data/wallet_state.h"
#include "imgui.h"
namespace dragonx {
class App;
namespace ui {
// Renders the mining "Mode toggle" (SOLO | POOL segmented control + pool URL/worker inputs).
// Extracted verbatim from the monolithic mining tab. The state it mutates is passed BY REFERENCE:
// the pool-mode flag, the pool URL / worker text buffers, and the settings-dirty flag (named with
// their original identifiers so the moved body is byte-identical).
void RenderMiningModeToggle(App* app, const WalletState& state, const MiningInfo& mining,
ImDrawList* dl, ImFont* capFont, ImFont* ovFont,
float dp, float hs, float gap, float availWidth,
bool& s_pool_mode, char (&s_pool_url)[256], char (&s_pool_worker)[256],
bool& s_pool_settings_dirty);
} // namespace ui
} // namespace dragonx