Files
ObsidianDragon/src/ui/windows/mining_controls.h
DanS fa240e7b99 refactor(mining): extract the Controls/CPU-grid card into mining_controls.{h,cpp} (audit #10, slice 3)
Third and largest slice of decomposing mining_tab.cpp. The ~843-line "Controls" card (CPU-core
grid + drag-to-select, mining start/stop button, benchmark + miner-update controls) is moved
verbatim into RenderMiningControls(). mining_tab.cpp is now 839 lines (was 2628 originally).

The most coupled section, so mutated state is passed BY REFERENCE — the benchmark
(ThreadBenchmark&), selected thread count (int&), and drag state (bool&/int&) — with local
reference aliases so the body stays byte-identical and interactions (drag, benchmark, start/stop)
behave exactly as before. Read-only context is passed by value/const; the compiler verified
const-correctness. Local statics inside the block moved with it.

Verified: full-node + Windows + lite build, tests, hygiene, no startup crash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 16:57:09 -05:00

33 lines
1.4 KiB
C++

// 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 "mining_benchmark.h" // ThreadBenchmark
#include "imgui.h"
#include <string>
namespace dragonx {
class App;
namespace ui {
// Renders the mining "Controls" card (CPU-core grid + mining start/stop button + benchmark /
// miner-update controls). Extracted verbatim from the monolithic mining tab. State the section
// MUTATES is passed BY REFERENCE (the benchmark, selected thread count, and drag state) so the
// interactions behave exactly as before; read-only context is passed by value/const.
void RenderMiningControls(App* app, const WalletState& state, const MiningInfo& mining,
ImDrawList* dl, ImFont* capFont, ImFont* sub1, ImFont* ovFont,
float dp, float hs, float vs, float gap, float pad, float availWidth,
const material::GlassPanelSpec& glassSpec, float controlsBudgetH,
int max_threads, bool isMiningActive, bool poolMode,
const char* poolWorker, const std::string& xmrigLatestTag,
ThreadBenchmark& benchmark, int& selectedThreads,
bool& dragActive, int& dragAnchorThread);
} // namespace ui
} // namespace dragonx