feat(ui): search system for features#1255
Conversation
WalkthroughThe changes add a nested struct and virtual method to Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Menu
participant Feature
User->>Menu: Enter search text in feature search bar
Menu->>Menu: Filter features using FeatureMatchesSearch()
loop For each filtered feature
Menu->>Feature: Optionally call GetSettingsSearchEntries()
Menu->>Menu: Filter settings entries by search query
end
Menu->>User: Render filtered feature list and settings in UI
Suggested reviewers
Poem
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (2)
🧰 Additional context used🧠 Learnings (3)📓 Common learningssrc/Utils/UI.h (2)src/Utils/UI.cpp (1)🧬 Code Graph Analysis (1)src/Utils/UI.h (1)
⏰ 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)
🔇 Additional comments (4)
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed 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)
Other keywords and placeholders
Documentation and Community
|
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
src/Menu.cpp (3)
348-357: Consider searching both short name and display name.The current implementation only searches the feature's short name. Users might expect to search by the display name they see in the UI.
Consider matching against both names:
bool Menu::FeatureMatchesSearch(Feature* feat) const { if (featureSearch.empty()) return true; - std::string s = feat->GetShortName(); + std::string shortName = feat->GetShortName(); + std::string displayName = feat->GetName(); std::string q = featureSearch; - std::transform(s.begin(), s.end(), s.begin(), ::tolower); + std::transform(shortName.begin(), shortName.end(), shortName.begin(), ::tolower); + std::transform(displayName.begin(), displayName.end(), displayName.begin(), ::tolower); std::transform(q.begin(), q.end(), q.begin(), ::tolower); - return s.find(q) != std::string::npos; + return shortName.find(q) != std::string::npos || displayName.find(q) != std::string::npos; }
359-369: Unused settings search method.This method is implemented but not called anywhere in the provided code. Is the settings search functionality planned for a future update?
Would you like me to help implement the settings search UI that would utilize this method?
1083-1088: Simplify lambda capture.The lambda unnecessarily captures
thiswhen it could directly use the method reference.// Filter features by search string if (!featureSearch.empty()) { - auto pred = [this](Feature* feat) { return FeatureMatchesSearch(feat); }; auto it = std::remove_if(sortedFeatureList.begin(), sortedFeatureList.end(), - [pred](Feature* feat) { return !pred(feat); }); + [this](Feature* feat) { return !FeatureMatchesSearch(feat); }); sortedFeatureList.erase(it, sortedFeatureList.end()); }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/Feature.h(1 hunks)src/Menu.cpp(2 hunks)src/Menu.h(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 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/Feature.h (1)
Learnt from: alandtse
PR: doodlum/skyrim-community-shaders#1157
File: src/Feature.cpp:42-49
Timestamp: 2025-06-17T09:27:49.594Z
Learning: In src/Feature.cpp, when an obsolete feature's INI file is deleted, the feature should be silently disabled without surfacing any issues to the user. This is the intended behavior because a deleted INI file for an obsolete feature indicates that the user has properly cleaned up the obsolete feature.
🧬 Code Graph Analysis (2)
src/Menu.h (1)
src/Menu.cpp (6)
feat(798-844)feat(798-798)feat(865-1072)feat(865-865)label(776-785)label(776-776)
src/Menu.cpp (5)
src/State.h (2)
featureName(218-218)featureName(219-219)src/Utils/UI.cpp (6)
DrawSectionHeader(415-476)DrawSectionHeader(415-415)DrawCategoryHeader(350-413)DrawCategoryHeader(350-350)HoverTooltipWrapper(24-31)HoverTooltipWrapper(33-39)src/Utils/FileSystem.cpp (2)
GetFeatureIniPath(40-43)GetFeatureIniPath(40-40)src/FeatureIssues.cpp (6)
IsObsoleteFeature(714-718)IsObsoleteFeature(714-714)HasFeatureIssues(114-117)HasFeatureIssues(114-114)DrawFeatureIssuesUI(346-451)DrawFeatureIssuesUI(346-346)src/Feature.cpp (2)
GetFeatureList(197-256)GetFeatureList(197-197)
⏰ 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 (4)
src/Feature.h (1)
7-17: Well-structured foundation for settings search.The
SettingSearchEntrystruct andGetSettingsSearchEntries()virtual method provide a clean interface for features to expose their settings to the search system.src/Menu.h (1)
6-9: Clean additions for search functionality.The header changes properly declare the necessary members and methods for the search system implementation.
Also applies to: 30-33, 63-65, 216-223
src/Menu.cpp (2)
299-346: Well-implemented search bar with custom icon.The transparent styling and custom-drawn magnifying glass icon provide a clean, integrated appearance. Proper ImGui ID and style management ensures no conflicts.
1203-1227: Clean separation of built-in menus and features.The rendering logic properly groups built-in settings separately from features, with the search bar positioned intuitively after the "Features" header.
|
✅ A pre-release build is available for this PR: |
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
Automated formatting by clang-format, prettier, and other hooks. See https://pre-commit.ci for details.
Adds a system to search for features out of the GetFeatureList based on simple character recognition.
Summary by CodeRabbit
New Features
UI Improvements