Add mine-when-idle, default banlist, and console parsing improvements
Mine-when-idle: - Auto-start/stop mining based on system idle time detection - Platform::getSystemIdleSeconds() via XScreenSaver (Linux) / GetLastInputInfo (Win) - Settings: mine_when_idle toggle + configurable delay (30s–10m) - Settings page UI with checkbox and delay combo Console tab: - Shell-like argument parsing with quote and JSON bracket support - Pass JSON objects/arrays directly as RPC params - Fix selection indices when lines are evicted from buffer Connection & status bar: - Reduce RPC connect timeout to 1s for localhost fast-fail - Fast retry timer on daemon startup and external daemon detection - Show pool mining hashrate in status bar; sidebar badge reflects pool state UI polish: - Add logo to About card in settings; expose logo dimensions on App - Header title offset-y support; adjust content-area margins - Fix banned peers row cursor position (rawRowPosB.x) Branding: - Update copyright to "DragonX Developers" in RC and About section - Replace logo/icon assets with updated versions Misc: - setup.sh: checkout dragonx branch before pulling - Remove stale prebuilt-binaries/xmrig/.gitkeep
This commit is contained in:
@@ -413,6 +413,67 @@ void App::checkAutoLock() {
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// Mine when idle — auto-start/stop mining based on system idle state
|
||||
// ===========================================================================
|
||||
|
||||
void App::checkIdleMining() {
|
||||
if (!settings_ || !settings_->getMineWhenIdle()) {
|
||||
// Feature disabled — if we previously auto-started, stop now
|
||||
if (idle_mining_active_) {
|
||||
idle_mining_active_ = false;
|
||||
if (settings_ && settings_->getPoolMode()) {
|
||||
if (xmrig_manager_ && xmrig_manager_->isRunning())
|
||||
stopPoolMining();
|
||||
} else {
|
||||
if (state_.mining.generate)
|
||||
stopMining();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int idleSec = util::Platform::getSystemIdleSeconds();
|
||||
int delay = settings_->getMineIdleDelay();
|
||||
bool isPool = settings_->getPoolMode();
|
||||
|
||||
// Check if mining is already running (manually started by user)
|
||||
bool miningActive = isPool
|
||||
? (xmrig_manager_ && xmrig_manager_->isRunning())
|
||||
: state_.mining.generate;
|
||||
|
||||
if (idleSec >= delay) {
|
||||
// System is idle — start mining if not already running
|
||||
if (!miningActive && !idle_mining_active_ && !mining_toggle_in_progress_.load()) {
|
||||
// For solo mining, need daemon connected and synced
|
||||
if (!isPool && (!state_.connected || state_.sync.syncing)) return;
|
||||
|
||||
int threads = settings_->getPoolThreads();
|
||||
if (threads <= 0) threads = std::max(1, (int)std::thread::hardware_concurrency() / 2);
|
||||
|
||||
idle_mining_active_ = true;
|
||||
if (isPool)
|
||||
startPoolMining(threads);
|
||||
else
|
||||
startMining(threads);
|
||||
DEBUG_LOGF("[App] Idle mining started after %d seconds idle\n", idleSec);
|
||||
}
|
||||
} else {
|
||||
// User is active — stop mining if we auto-started it
|
||||
if (idle_mining_active_) {
|
||||
idle_mining_active_ = false;
|
||||
if (isPool) {
|
||||
if (xmrig_manager_ && xmrig_manager_->isRunning())
|
||||
stopPoolMining();
|
||||
} else {
|
||||
if (state_.mining.generate)
|
||||
stopMining();
|
||||
}
|
||||
DEBUG_LOGF("[App] Idle mining stopped — user returned\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ===========================================================================
|
||||
// Restart Setup Wizard (from Settings)
|
||||
// ===========================================================================
|
||||
|
||||
Reference in New Issue
Block a user