diff --git a/src/ui/windows/mining_tab.cpp b/src/ui/windows/mining_tab.cpp index 44e4079..a4ce8f4 100644 --- a/src/ui/windows/mining_tab.cpp +++ b/src/ui/windows/mining_tab.cpp @@ -866,9 +866,42 @@ void RenderMiningTab(App* app) ImGui::SetMouseCursor(ImGuiMouseCursor_Hand); ImGui::SetTooltip("%s", idleOn ? TR("mining_idle_on_tooltip") : TR("mining_idle_off_tooltip")); } - ImGui::SetCursorScreenPos(savedCur); idleRightEdge = btnX - 4.0f * dp; + + // Idle delay combo (to the left of the icon when enabled) + if (idleOn) { + struct DelayOption { int seconds; const char* label; }; + static const DelayOption delays[] = { + {30, "30s"}, {60, "1m"}, {120, "2m"}, {300, "5m"}, {600, "10m"} + }; + int curDelay = app->settings()->getMineIdleDelay(); + const char* previewLabel = "2m"; + for (const auto& d : delays) { + if (d.seconds == curDelay) { previewLabel = d.label; break; } + } + float comboW = schema::UI().drawElement("components.settings-page", "idle-combo-width").sizeOr(64.0f); + float comboX = idleRightEdge - comboW; + float comboY = curY + (headerH - ImGui::GetFrameHeight()) * 0.5f; + ImGui::SetCursorScreenPos(ImVec2(comboX, comboY)); + ImGui::SetNextItemWidth(comboW); + if (ImGui::BeginCombo("##IdleDelay", previewLabel, ImGuiComboFlags_NoArrowButton)) { + for (const auto& d : delays) { + bool selected = (d.seconds == curDelay); + if (ImGui::Selectable(d.label, selected)) { + app->settings()->setMineIdleDelay(d.seconds); + app->settings()->save(); + } + if (selected) ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip("%s", TR("tt_idle_delay")); + idleRightEdge = comboX - 4.0f * dp; + } + + ImGui::SetCursorScreenPos(savedCur); } // Active mining indicator (left of idle toggle)