console and mining tab visual improvements

This commit is contained in:
2026-02-27 13:30:06 -06:00
parent 48ce983966
commit eebfd5947e
13 changed files with 962 additions and 183 deletions

View File

@@ -104,6 +104,21 @@ bool App::init()
DEBUG_LOGF("Warning: Could not load settings, using defaults\n");
}
// Apply saved user font scale so fonts are correct on first reload
{
float fs = settings_->getFontScale();
if (fs > 1.0f) {
ui::Layout::setUserFontScale(fs);
// Fonts were loaded at default scale in Init(); rebuild now.
auto& typo = ui::material::Typography::instance();
ImGuiIO& io = ImGui::GetIO();
typo.reload(io, typo.getDpiScale());
// Consume the flag so App::update() doesn't double-reload
ui::Layout::consumeUserFontReload();
DEBUG_LOGF("App: Applied saved font scale %.1fx\n", fs);
}
}
// Ensure ObsidianDragon config directory and template files exist
util::Platform::ensureObsidianDragonSetup();
@@ -190,6 +205,39 @@ bool App::init()
return true;
}
// ============================================================================
// Pre-frame: font atlas rebuilds (must run BEFORE ImGui::NewFrame)
// ============================================================================
void App::preFrame()
{
ImGuiIO& io = ImGui::GetIO();
// Hot-reload unified UI schema
{
PERF_SCOPE("PreFrame.SchemaHotReload");
ui::schema::UISchema::instance().pollForChanges();
ui::schema::UISchema::instance().applyIfDirty();
}
// Refresh balance layout config after schema reload
ui::RefreshBalanceLayoutConfig();
// If font sizes changed in the TOML, rebuild the font atlas
if (ui::schema::UISchema::instance().consumeFontsChanged()) {
auto& typo = ui::material::Typography::instance();
typo.reload(io, typo.getDpiScale());
DEBUG_LOGF("App: Font atlas rebuilt after hot-reload\n");
}
// If the user changed font scale in Settings, rebuild the font atlas
if (ui::Layout::consumeUserFontReload()) {
auto& typo = ui::material::Typography::instance();
typo.reload(io, typo.getDpiScale());
DEBUG_LOGF("App: Font atlas rebuilt after user font-scale change (%.1fx)\n",
ui::Layout::userFontScale());
}
}
void App::update()
{
PERF_SCOPE("Update.Total");
@@ -206,6 +254,9 @@ void App::update()
if (worker_) {
worker_->drainResults();
}
if (fast_worker_) {
fast_worker_->drainResults();
}
// Auto-lock check (only when connected + encrypted + unlocked)
if (state_.connected && state_.isUnlocked()) {
@@ -218,23 +269,6 @@ void App::update()
state_.rebuildAddressList();
}
// Hot-reload unified UI schema
{
PERF_SCOPE("Update.SchemaHotReload");
ui::schema::UISchema::instance().pollForChanges();
ui::schema::UISchema::instance().applyIfDirty();
}
// Refresh balance layout config after schema reload
ui::RefreshBalanceLayoutConfig();
// If font sizes changed in the JSON, rebuild the font atlas
if (ui::schema::UISchema::instance().consumeFontsChanged()) {
auto& typo = ui::material::Typography::instance();
typo.reload(io, typo.getDpiScale());
DEBUG_LOGF("App: Font atlas rebuilt after hot-reload\n");
}
// Update timers
refresh_timer_ += io.DeltaTime;
price_timer_ += io.DeltaTime;
@@ -775,7 +809,12 @@ void App::render()
ui::RenderMarketTab(this);
break;
case ui::NavPage::Console:
console_tab_.render(embedded_daemon_.get(), rpc_.get(), worker_.get(), xmrig_manager_.get());
// Use fast-lane worker for console commands to avoid head-of-line
// blocking behind the consolidated refreshData() batch.
console_tab_.render(embedded_daemon_.get(),
fast_rpc_ ? fast_rpc_.get() : rpc_.get(),
fast_worker_ ? fast_worker_.get() : worker_.get(),
xmrig_manager_.get());
break;
case ui::NavPage::Settings:
ui::RenderSettingsPage(this);
@@ -1723,6 +1762,9 @@ void App::beginShutdown()
if (worker_) {
worker_->requestStop();
}
if (fast_worker_) {
fast_worker_->requestStop();
}
// Stop xmrig pool miner before stopping the daemon
if (xmrig_manager_ && xmrig_manager_->isRunning()) {
@@ -2260,6 +2302,9 @@ void App::shutdown()
if (worker_) {
worker_->stop();
}
if (fast_worker_) {
fast_worker_->stop();
}
if (settings_) {
settings_->save();
}
@@ -2269,6 +2314,9 @@ void App::shutdown()
if (rpc_) {
rpc_->disconnect();
}
if (fast_rpc_) {
fast_rpc_->disconnect();
}
return;
}
@@ -2288,10 +2336,16 @@ void App::shutdown()
if (worker_) {
worker_->stop();
}
if (fast_worker_) {
fast_worker_->stop();
}
// Disconnect RPC after worker is fully stopped (safe — no curl in flight)
if (rpc_) {
rpc_->disconnect();
}
if (fast_rpc_) {
fast_rpc_->disconnect();
}
}
// ===========================================================================
@@ -2310,7 +2364,8 @@ bool App::hasPinVault() const {
}
bool App::hasPendingRPCResults() const {
return worker_ && worker_->hasPendingResults();
return (worker_ && worker_->hasPendingResults())
|| (fast_worker_ && fast_worker_->hasPendingResults());
}
void App::restartDaemon()
{