Files
ObsidianDragon/src/ui/windows/console_channel.h
DanS 33735b1d52 refactor(console): phase 2 — channel-as-semantic key; decouple executor from UI colors
Make ConsoleChannel the canonical semantic classification of every console
line. Producers (command executor, app log forwarders, result formatter) tag
each line with a channel; the UI derives both the text color and the left
accent-bar color from it at draw time, and the output filter keys off it.

This replaces the prior scheme of storing an ImU32 color per line and then
reverse-engineering the source from color-equality plus a "[daemon] "/"[xmrig] "
/"[app] "/"[rpc] " text prefix. Consequences:

- ConsoleLine now stores {text, ConsoleChannel} — no per-line color.
- addLine()/addRpcTraceLine() take a channel; the redundant text prefixes are
  gone (the accent bar carries the origin).
- The executor's ConsoleAddLineFn hands a channel, not an ImU32, so the backend
  no longer depends on ConsoleTab::COLOR_* — FullNode/Lite executors emit clean
  text + channel.
- The theme-remap loop that rewrote stored colors on light/dark flip is deleted;
  colors are resolved per-channel each frame (refreshColors on flip only).
- ConsoleOutputFilter drops its color fields; consoleLinePassesFilter() keys off
  the channel. Test updated to the channel-based API.
- Added a Warning channel (amber severity peer of Error/Success) so the
  notification + logger warning forwarders keep their color.

Full-node + lite build clean; ctest green; source hygiene clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-01 18:22:35 -05:00

36 lines
1.3 KiB
C++

// DragonX Wallet - ImGui Edition
// Copyright 2024-2026 The Hush Developers
// Released under the GPLv3
//
// ConsoleChannel — the semantic classification of a console line. It is the canonical
// key: producers (the command executor, app log forwarders, the result formatter) tag
// each line with a channel, the UI derives both the text color and the left accent-bar
// color from it at draw time, and the output filter keys off it. This replaces the older
// approach of storing an ImU32 color and reverse-engineering the source from color
// equality + a "[daemon] " text prefix.
#pragma once
namespace dragonx {
namespace ui {
enum class ConsoleChannel {
None = 0, // plain result / default text
Command, // the "> cmd" echo
Info, // informational / help text
Success, // positive events (connected, accepted, ready)
Warning, // non-fatal warnings (amber)
Error, // errors
Rpc, // RPC trace lines
Daemon, // dragonxd log output
Xmrig, // miner log output
App, // app / wallet / lite-diagnostics log
JsonKey, // result JSON: object key
JsonString, // result JSON: string value
JsonNumber, // result JSON: number / bool / null
JsonBrace, // result JSON: braces / brackets
};
} // namespace ui
} // namespace dragonx