Skip to content

chore(UI): combine shader & disk cache clear#1297

Merged
doodlum merged 2 commits into
community-shaders:devfrom
davo0411:merge-buttons
Jul 23, 2025
Merged

chore(UI): combine shader & disk cache clear#1297
doodlum merged 2 commits into
community-shaders:devfrom
davo0411:merge-buttons

Conversation

@davo0411
Copy link
Copy Markdown
Collaborator

@davo0411 davo0411 commented Jul 23, 2025

What the title says.

Moved all clear disk cache functionality to be conditional within the clear shader button. Having both was redundant, 99% of the time users needed to just press both buttons to achieve the goal of clearing cache,

Summary by CodeRabbit

  • New Features

    • The "Clear Shader Cache" action now also clears the disk cache if enabled, combining both actions into a single button and icon.
  • UI Updates

    • Removed the separate "Clear Disk Cache" button and icon from the menu.
    • Updated tooltips and header text to reflect the unified cache clearing action.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jul 23, 2025

Walkthrough

This change removes the separate "clear disk cache" UI icon and button from the menu, consolidating disk cache clearing into the existing "clear shader cache" action. All references, UI elements, and icon logic related to the disk cache are deleted, and tooltips and headers are updated to reflect the unified behavior.

Changes

File(s) Change Summary
src/Menu.cpp Removed all UI, logic, and tooltip references to the "clear disk cache" icon and button; unified cache clearing into the shader cache action.
src/Menu.h Removed clearDiskCache member from the UIIcons struct in the Menu class.
src/Utils/UI.cpp Removed all code for initializing, loading, and releasing the "clear disk cache" icon texture.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Menu
    participant CacheManager

    User->>Menu: Clicks "Clear Shader Cache" button
    Menu->>CacheManager: Clear shader cache
    alt Disk cache enabled
        Menu->>CacheManager: Clear disk cache
    end
    Menu-->>User: Show unified tooltip/confirmation
Loading

Estimated code review effort

2 (~12 minutes)

Possibly related PRs

Suggested reviewers

  • doodlum

Poem

A button once for disk cache stood,
Now gone, as code bunnies knew it should.
Shader and disk, now cleared as one—
Fewer icons, less confusion, more fun!
With menus neat and tooltips clear,
The code hops forward, full of cheer.
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between be2ddc6 and 6275c7f.

📒 Files selected for processing (3)
  • src/Menu.cpp (4 hunks)
  • src/Menu.h (0 hunks)
  • src/Utils/UI.cpp (2 hunks)
🧠 Learnings (3)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
src/Menu.cpp (2)

Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.

Learnt from: davo0411
PR: #1107
File: src/Menu.cpp:310-315
Timestamp: 2025-05-31T02:51:24.195Z
Learning: In the Community Shaders codebase, when validating UI icons, checking for texture presence (non-null pointer) is sufficient. Avoid adding dimension validation checks as icon sizes should vary based on user needs (4K+ resolution users may want higher resolution icons). Don't artificially limit icon dimensions.

src/Utils/UI.cpp (1)

Learnt from: davo0411
PR: #1107
File: src/Menu.cpp:310-315
Timestamp: 2025-05-31T02:51:24.195Z
Learning: In the Community Shaders codebase, when validating UI icons, checking for texture presence (non-null pointer) is sufficient. Avoid adding dimension validation checks as icon sizes should vary based on user needs (4K+ resolution users may want higher resolution icons). Don't artificially limit icon dimensions.

💤 Files with no reviewable changes (1)
  • src/Menu.h
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-06-24T07:17:36.604Z
Learning: When reviewing PRs, always clarify the scope if there are multiple related features or dependencies. WeatherPicker was a separate PR that was already merged, while this PR focuses specifically on WetnessEffects climate preset system enhancements.
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.
src/Menu.cpp (2)

Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#0
File: :0-0
Timestamp: 2025-07-05T05:20:45.823Z
Learning: In the skyrim-community-shaders repository, file deletion error handling improvements that replace existence checks and try-catch blocks with std::filesystem::remove error-code-based approaches are considered bug fixes rather than refactoring, as they address inadequate error handling and misleading log messages.

Learnt from: davo0411
PR: #1107
File: src/Menu.cpp:310-315
Timestamp: 2025-05-31T02:51:24.195Z
Learning: In the Community Shaders codebase, when validating UI icons, checking for texture presence (non-null pointer) is sufficient. Avoid adding dimension validation checks as icon sizes should vary based on user needs (4K+ resolution users may want higher resolution icons). Don't artificially limit icon dimensions.

src/Utils/UI.cpp (1)

Learnt from: davo0411
PR: #1107
File: src/Menu.cpp:310-315
Timestamp: 2025-05-31T02:51:24.195Z
Learning: In the Community Shaders codebase, when validating UI icons, checking for texture presence (non-null pointer) is sufficient. Avoid adding dimension validation checks as icon sizes should vary based on user needs (4K+ resolution users may want higher resolution icons). Don't artificially limit icon dimensions.

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build plugin and addons
🔇 Additional comments (8)
src/Utils/UI.cpp (2)

166-171: LGTM: Icon array correctly updated for consolidated cache clearing.

The reduction from 5 to 4 texture pointers properly reflects the removal of the clearDiskCache icon, maintaining only the essential icons: saveSettings, loadSettings, clearCache, and logo.


221-221: LGTM: Log message correctly updated.

The log message now accurately reflects loading 4 icons instead of 5, consistent with the removal of the clearDiskCache icon.

src/Menu.cpp (6)

209-220: LGTM: Destructor properly updated for icon removal.

The removal of uiIcons.clearDiskCache.Release() is correct since the clearDiskCache icon is no longer initialized. The remaining icon cleanup calls are preserved.


327-332: LGTM: Icon availability check correctly updated.

The condition properly removes the clearDiskCache.texture check while preserving the logic for the remaining action icons. This ensures the UI shows icons when at least one of the consolidated action icons is available.


358-372: LGTM: Cache clearing functionality properly consolidated.

The implementation correctly combines both operations:

  • Clear tooltip explains both shader cache and disk cache clearing
  • Callback executes shaderCache->Clear() followed by conditional shaderCache->DeleteDiskCache()
  • Single user action now handles both cache types when appropriate
  • Maintains all original functionality while simplifying the user interface

This achieves the PR objective of consolidating cache clearing into a single button.


580-585: LGTM: Text button correctly implements consolidated functionality.

The text button version properly mirrors the icon implementation, ensuring consistent behavior between icon and text button interfaces. Both cache clearing operations are consolidated into the single "Clear Shader Cache" action.


586-592: LGTM: Tooltip text clearly explains consolidated functionality.

The updated tooltip effectively communicates that the action now clears both shader cache and disk cache (when enabled), with clear explanations of what each cache contains. This helps users understand the comprehensive nature of the consolidated action.


1268-1268: LGTM: UI description accurately reflects consolidated buttons.

The updated description correctly lists the consolidated actions: "Save, Load, Clear Cache" instead of separate cache clearing operations, maintaining consistency with the simplified UI design.

✨ 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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Automated formatting by clang-format, prettier, and other hooks.
See https://pre-commit.ci for details.
@github-actions
Copy link
Copy Markdown

Using provided base ref: be2ddc6
Using base ref: be2ddc6
Base commit date: 2025-07-21T17:11:53+01:00 (Monday, July 21, 2025 05:11 PM)
No actionable suggestions for changed features.

@github-actions
Copy link
Copy Markdown

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

@alandtse
Copy link
Copy Markdown
Collaborator

This isn't a feat. Chore or style.

@alandtse alandtse changed the title feat(UI): combine shader & disk cache clear into single button chore(UI): combine shader & disk cache clear Jul 23, 2025
@doodlum doodlum merged commit aa0fa24 into community-shaders:dev Jul 23, 2025
17 checks passed
@davo0411 davo0411 deleted the merge-buttons branch December 31, 2025 04:37
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.

3 participants