Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions framework/ui/view/iconcodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#ifdef INFO
#undef INFO
#endif
#ifdef ERROR
#undef ERROR
#ifdef ERROR_ICON
#undef ERROR_ICON
#endif
Comment on lines +34 to 36
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial | 💤 Low value

The ERROR_ICON guard is unnecessary.

Unlike ERROR, WARNING, INFO, and QUESTION, the name ERROR_ICON is not a macro defined by platform headers (e.g., Windows). This guard serves no protective purpose and can be safely removed. Alternatively, if downstream headers still require ERROR to be cleared, the original #undef ERROR should be retained alongside the enum rename.

🧹 Suggested removal
-#ifdef ERROR_ICON
-#undef ERROR_ICON
-#endif
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#ifdef ERROR_ICON
#undef ERROR_ICON
#endif
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/ui/view/iconcodes.h` around lines 34 - 36, The preprocessor guard
for ERROR_ICON is unnecessary because ERROR_ICON is not a platform macro; remove
the `#ifdef` ERROR_ICON / `#undef` ERROR_ICON / `#endif` block and instead either
leave no undef for ERROR_ICON or, if the intent was to avoid colliding with
platform ERROR, restore the original `#undef` ERROR (not ERROR_ICON) before
defining the enum entries; update any enum rename references (e.g., ERROR_ICON
vs ERROR) so the enum uses the intended identifier (such as ERROR_ICON) and
ensure WARNING, INFO, QUESTION handling remains unchanged.

#ifdef QUESTION
#undef QUESTION
Expand Down Expand Up @@ -340,7 +340,7 @@ enum class Code : char16_t {

WARNING = 0xF3CE,
INFO = 0xF3CF,
ERROR = 0xF3D0,
ERROR_ICON = 0xF3D0,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Search for usages of the old Code::ERROR enum value that need updating.

# Search for explicit Code::ERROR or IconCode::ERROR references
rg -n --type=cpp --type=qml -e 'Code::ERROR\b' -e 'IconCode::ERROR\b' -g '!iconcodes.h'

# Also check for QML usages
rg -n -e 'IconCode\.ERROR\b' --type-add 'qml:*.qml' --type=qml

Repository: musescore/muse_framework

Length of output: 182


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== iconcodes.h enum definitions around ERROR ==="
rg -n --type=cpp "enum class Code|ERROR_ICON|\\bERROR\\b" framework/ui/view/iconcodes.h
echo "--- snippet near ERROR_ICON ---"
python3 - <<'PY'
import re
path="framework/ui/view/iconcodes.h"
start=300; end=420
with open(path,'r',encoding='utf-8',errors='ignore') as f:
    lines=f.readlines()
for i in range(start-1,end):
    if 1<=i+1<=len(lines):
        print(f"{i+1}: {lines[i].rstrip()}")
PY

echo
echo "=== Remaining usages of old names (excluding iconcodes.h) ==="
rg -n --type=cpp --type=qml -e 'Code::ERROR\b' -e 'IconCode::ERROR\b' -g '!iconcodes.h' .
rg -n -e 'IconCode\.ERROR\b' --type-add 'qml:*.qml' --type=qml .

echo
echo "=== Usages of new names (ERROR_ICON) ==="
rg -n --type=cpp --type=qml -e 'ERROR_ICON\b' -g '!iconcodes.h' .
rg -n -e 'IconCode\.ERROR_ICON\b' --type-add 'qml:*.qml' --type=qml . || true

echo
echo "=== Specific QML mapping location found earlier ==="
rg -n "case \"ERROR\"" -S framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml
sed -n '60,105p' framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml

Repository: musescore/muse_framework

Length of output: 3236


🏁 Script executed:

#!/bin/bash
set -u

echo "=== iconcodes.h: presence of ERROR_ICON ==="
rg -n --type=cpp "ERROR_ICON\\b" framework/ui/view/iconcodes.h

echo
echo "=== QML: remaining IconCode.ERROR references ==="
rg -n --type=qml "IconCode\\.ERROR\\b" . || true

echo
echo "=== QML: case \"ERROR\" mapping ==="
rg -n 'case[[:space:]]+"ERROR"' -S --type=qml framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml || true
sed -n '70,100p' framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml

echo
echo "=== Usages of ERROR_ICON ==="
rg -n --type=cpp --type=qml "\\bERROR_ICON\\b" . -g '!iconcodes.h' || true
rg -n --type=qml "IconCode\\.ERROR_ICON\\b" . || true

Repository: musescore/muse_framework

Length of output: 1306


🏁 Script executed:

#!/bin/bash
set -u

echo "=== iconcodes.h: occurrences of ERROR not followed by _ (to catch potential aliases) ==="
rg -n --type=cpp -S "ERROR(?!_)" framework/ui/view/iconcodes.h || true

echo
echo "=== iconcodes.h: lines mentioning ERROR_ICON specifically ==="
rg -n --type=cpp "ERROR_ICON" framework/ui/view/iconcodes.h

echo
echo "=== iconcodes.h: top-of-file preprocessor context around ERROR_ICON ==="
sed -n '1,120p' framework/ui/view/iconcodes.h

echo
echo "=== iconcodes.h: QML exposure (Q_ENUM / Q_NAMESPACE / etc) near the enum ==="
# show a wider window around the enum declaration and any QML macros
sed -n '40,120p' framework/ui/view/iconcodes.h
sed -n '320,380p' framework/ui/view/iconcodes.h

echo
echo "=== sanity: any 'ERROR' enum value entries in iconcodes.h (comma form) ==="
rg -n --type=cpp "ERROR\\s*=" framework/ui/view/iconcodes.h || true
rg -n --type=cpp "ERROR\\s*," framework/ui/view/iconcodes.h || true

Repository: musescore/muse_framework

Length of output: 7021


Breaking API change: remaining IconCode.ERROR usage needs updating
framework/ui/view/iconcodes.h defines ERROR_ICON (no ERROR enum value), but framework/interactive/qml/Muse/Interactive/StandardDialogPanel.qml:84 still returns IconCode.ERROR in standardIcon(type) when type === "ERROR"—update it to IconCode.ERROR_ICON to avoid QML enum lookup/compile failures.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@framework/ui/view/iconcodes.h` at line 343, The QML enum named in code is now
ERROR_ICON (not ERROR), so update all places returning or referencing
IconCode.ERROR — specifically in the StandardDialogPanel.qml function
standardIcon(type) (and any other QML/JS callers) change IconCode.ERROR to
IconCode.ERROR_ICON; search for IconCode.ERROR usages and replace them with
IconCode.ERROR_ICON to prevent QML enum lookup/compile failures.

QUESTION = 0xF3D1,

MUTE = 0xF3D5,
Expand Down