Skip to content

feat(UI): require confirmation to clear shader cache#1757

Merged
alandtse merged 6 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:shader-cache-button-confirmation-prompt
Jan 25, 2026
Merged

feat(UI): require confirmation to clear shader cache#1757
alandtse merged 6 commits into
community-shaders:devfrom
SkrubbySkrubInAShrub:shader-cache-button-confirmation-prompt

Conversation

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub commented Jan 24, 2026

Add confirmation popup with "don't ask me again" checkbox when clearing cache via header buttons.
Secondary checkbox in menu so that it can be enabled/disabled without using the clear cache button.
Advanced settings button clears without confirmation.

Summary by CodeRabbit

  • New Features
    • Shader cache now requires confirmation before clearing to prevent accidental data loss.
    • Added "Skip Clear Cache Dialogue" setting in Shaders preferences, allowing users to disable the confirmation prompt for future cache clears.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

This pull request adds a confirmation dialog for shader cache clearing, introducing a persistent user setting to skip the confirmation if desired. It refactors existing clear cache actions to route through a centralized confirmation flow with UI rendering, and extends the settings structure to store the user preference.

Changes

Cohort / File(s) Summary
Settings Structure
src/Menu.h, src/Menu.cpp
Added SkipClearCacheConfirmation (bool, default false) to Menu::Settings struct; persists user preference to skip clear-cache confirmation dialogs.
Settings UI
src/Menu/SettingsTabRenderer.cpp
Added "Skip Clear Cache Dialogue" checkbox in the Shaders tab that reads/writes the new SkipClearCacheConfirmation setting with explanatory tooltip.
Clear Cache Actions
src/Menu/MenuHeaderRenderer.cpp
Replaced direct shaderCache->Clear() calls with Util::RequestClearShaderCacheConfirmation() invocations in both action handlers, centralizing confirmation flow.
Confirmation UI Logic
src/Utils/UI.cpp, src/Utils/UI.h
Added RequestClearShaderCacheConfirmation() and DrawClearShaderCacheConfirmation() functions managing a centered modal popup with "Don't ask again" checkbox and Clear/Cancel buttons; includes internal PerformClearShaderCache() helper for cache operations.
Theme Constants
src/Menu/ThemeManager.h
Added POPUP_BUTTON_WIDTH constant (180.0f) to ThemeManager::Constants for popup layout standardization.

Sequence Diagram

sequenceDiagram
    participant User
    participant MenuAction
    participant Util as Util::Request/Draw
    participant Settings as Menu::Settings
    participant Cache as ShaderCache
    
    User->>MenuAction: Click "Clear Shader Cache"
    MenuAction->>Util: RequestClearShaderCacheConfirmation()
    
    alt SkipClearCacheConfirmation is true
        Util->>Cache: Clear cache (memory + disk)
        Cache-->>Util: Done
    else SkipClearCacheConfirmation is false
        Util->>Util: Set showClearCacheConfirmation flag
    end
    
    Note over User,Util: Per-frame rendering loop
    
    alt Confirmation popup is visible
        Util->>Util: DrawClearShaderCacheConfirmation()
        Util-->>User: Display modal with "Don't ask again" checkbox
        
        alt User clicks "Clear Cache"
            User->>Util: Confirm clear
            Util->>Settings: Update SkipClearCacheConfirmation (if checkbox enabled)
            Settings-->>Util: Setting persisted
            Util->>Cache: PerformClearShaderCache()
            Cache-->>Util: Cache cleared
            Util->>Util: Close popup
        else User clicks "Cancel"
            User->>Util: Cancel
            Util->>Util: Close popup without clearing
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • alandtse
  • doodlum
  • davo0411

Poem

🐰 A cache so clear, yet pause and think—
Now confirmation guards the brink,
"Don't ask again!" the rabbit hops,
One click to clear, the dialog stops! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.77% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a confirmation requirement when clearing the shader cache via the UI.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@SkrubbySkrubInAShrub
Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 24, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 24, 2026

Using provided base ref: 6eb7142
Using base ref: 6eb7142
Base commit date: 2026-01-24T12:39:47-08:00 (Saturday, January 24, 2026 12:39 PM)
No actionable suggestions for changed features.

@SkrubbySkrubInAShrub SkrubbySkrubInAShrub marked this pull request as ready for review January 24, 2026 22:49
@github-actions
Copy link
Copy Markdown

✅ A pre-release build is available for this PR:
Download

@alandtse alandtse changed the title feat(UI): add confirmation dialog for clearing shader cache feat(UI): require confirmation to clear shader cache Jan 25, 2026
@alandtse alandtse merged commit 842bce6 into community-shaders:dev Jan 25, 2026
25 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants