Skip to content

feat: Added search functionality to Audacity 4 Preferences - #12915

Open
eman00001 wants to merge 1 commit into
audacity:masterfrom
eman00001:preferences-search
Open

eman00001 wants to merge 1 commit into
audacity:masterfrom
eman00001:preferences-search

Conversation

@eman00001

Copy link
Copy Markdown

Assisted-by: OpenAI Codex

Resolves: #12914

This adds a search field to the Preferences window. Search matches section names and settings labels (including partial matches). Opening a result goesto and highlights a matching label if available.

  • I signed CLA
  • This PR includes AI assistance
  • If the PR is AI-assisted, I have read, understood and complied with the guidelines for AI-assisted contributions
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The preferences dialog adds search across preference-page titles and descendant title and text labels. Matching pages appear in a results list. Selecting a result switches to its page and scrolls to a visible match, highlighting it when it is a Text item. The sidebar includes keyboard navigation, a shortcut to focus the search field, Escape handling, and a no-results message. The preferences model now includes page titles in its available-page data.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant PreferencesDialog
  participant PreferencesModel
  participant PreferencePage
  User->>PreferencesDialog: Enter search query
  PreferencesDialog->>PreferencesModel: Read available page titles
  PreferencesDialog->>PreferencePage: Index descendant title and text labels
  PreferencesDialog-->>User: Show matching pages
  User->>PreferencesDialog: Select a result
  PreferencesDialog->>PreferencePage: Switch page and scroll to visible match
  PreferencesDialog-->>User: Highlight matched Text item
Loading
Merge Risk: Low · up to e4d4d

Preferences search adds a search field that finds sections and labels. In edge cases, such as changing high contrast while the dialog is open, or a hidden label matching first, search results may be stale or may not highlight the visible match. The impact is minor and the page still opens, so this is mergeable with small follow-ups.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title states the main change: a search feature added to Audacity 4 Preferences. The raw summary confirms the PreferencesDialog.qml search field, results list, and navigation to matched items, and …
Description check Passed The description follows the repository template. It includes the Resolves line with a direct link to issue #12914 and a short explanation of the search feature and its matching behavior. All checklist…
Linked Issues check Passed Issue #12914 has three coding requirements. (1) Narrow the category list to categories with matching settings: PreferencesDialog.qml replaces the preferences menu with a results list while a query is …
Out of Scope Changes check Passed All changes support the search feature. The PreferencesDialog.qml changes add the search field, results list, keyboard navigation, no-results message, and sidebar layout needed to show results. The Ct…
Full details: Title check

Explanation

The title states the main change: a search feature added to Audacity 4 Preferences. The raw summary confirms the PreferencesDialog.qml search field, results list, and navigation to matched items, and the PR objectives describe the same feature. The title is specific and accurate, and it follows the conventional commit prefix style.

Full details: Description check

Explanation

The description follows the repository template. It includes the Resolves line with a direct link to issue #12914 and a short explanation of the search feature and its matching behavior. All checklist items from the template are present and marked. It is brief and does not describe the implementation details, such as the Ctrl+Shift+L shortcut, Escape handling, or the no-results message. It also does not report any testing. These gaps are non-critical, so the description is mostly complete.

Full details: Linked Issues check

Explanation

Issue #12914 has three coding requirements. (1) Narrow the category list to categories with matching settings: PreferencesDialog.qml replaces the preferences menu with a results list while a query is active. Results list matching pages whose title or descendant title/text labels contain the trimmed, lowercase query. (2) Opening a result navigates to its section and highlights the matching label when the item is visible and is a Text item. This matches the issue's 'if possible' wording. (3) Clearing the search restores the full list: Escape clears an active query, and the menu returns when the query is empty. PreferencesModel::availablePages() adds each page title, which the QML search needs. Partial matching is implemented by substring comparison, as the PR description states. The assessment relies on the AI-generated summary and the PR description. I did not inspect the QML hunks or run the dialog, so runtime behavior of the highlight and the clear path is not independently verified. No automated tests are part of the stated requirements, and none are reported.

Full details: Out of Scope Changes check

Explanation

All changes support the search feature. The PreferencesDialog.qml changes add the search field, results list, keyboard navigation, no-results message, and sidebar layout needed to show results. The Ctrl+Shift+L shortcut focuses the search field, so it belongs to the same feature. The PreferencesModel.cpp change exposes page titles for matching. No unrelated functional change appears in the summary. The summary reports no changes to exported or public declarations. The PR reports a moderate code size (+203/-6 in QML, +1 in C++). The reviewed evidence does not show unrelated changes.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Linked repositories: Public OSS repositories can only analyze public repositories installed in this organization. No linked repositories were analyzed; skipped musescore/musescore.

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI (base), Organization UI (inherited)
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: e7b93ae1-bddd-4d29-820f-10be7321fde7
Commits

Reviewing files that changed from the base of the PR and between cfc1f6a and e4d4d45.

Files selected for processing: 2

  • src/preferences/qml/Audacity/Preferences/PreferencesDialog.qml
  • src/preferences/qml/Audacity/Preferences/preferencesmodel.cpp

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.

searchMatches = []
return
}
if (searchIndex === null) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Refresh cached text when setting labels change.

After the first search, enable high contrast without closing Preferences. ThemesSection.title changes from “Theme” to “High-contrast theme”. The index retains the earlier string because this branch never runs again. Searches for the new heading therefore use stale label text. (raw.githubusercontent.com)

Invalidate the index when labels change, or read current label properties during matching.

}
const matches = []
for (const page of searchIndex) {
const label = page.labels.find(entry => entry.text.includes(searchQuery))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor · Functional Correctness · Quick win

Select a visible match after opening the page.

With high contrast enabled, search for “Accent color”. The first matching label belongs to the hidden AccentColorsSection. A later matching label in UiColorsSection is visible. The visibility guard on Line 94 returns without scrolling or highlighting that available label. (raw.githubusercontent.com)

Keep the matching candidates and select a visible candidate after page activation. Do not exclude inactive pages during indexing.

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.

Add search functionality to Audacity 4 Preferences

1 participant