Skip to content

Fix ImageViewer metadata tooltips - #2006

Open
zaum wants to merge 2 commits into
QL-Win:masterfrom
zaum:upstream-image-viewer-tooltips
Open

zaum wants to merge 2 commits into
QL-Win:masterfrom
zaum:upstream-image-viewer-tooltips

Conversation

@zaum

@zaum zaum commented Sep 19, 2026

Copy link
Copy Markdown

Improve the ImageViewer toolbar tooltips and metadata presentation.

image

Changes:

  • Add localized tooltips for the copy and background controls.
  • Show image MIME and dimension metadata in a native tooltip on middle-button hover.
  • Display image width before height.
  • Make the metadata tooltip appear immediately on hover.
  • Keep all supported ImageViewer translation files complete.

Validation:

  • ImageViewer plugin builds successfully with the installed .NET SDK.
  • Existing ruleset warning remains: MinimumRecommendedRules.ruleset is unavailable.

Summary by Sourcery

Improve ImageViewer toolbar guidance and image metadata presentation.

New Features:

  • Add localized tooltips for ImageViewer copy and background controls.
  • Present image MIME and dimension metadata in a native hover tooltip.

Bug Fixes:

  • Make ImageViewer metadata appear immediately on hover and consistently order dimensions as width before height.

Enhancements:

  • Complete the supported ImageViewer translation resources.

@sourcery-ai

sourcery-ai Bot commented Sep 19, 2026

Copy link
Copy Markdown

Reviewer's Guide

Improves ImageViewer toolbar usability by localizing copy/background tooltips and presenting MIME, dimensions, and other metadata in an immediately available native hover tooltip, with width listed before height and translation resources kept complete.

Sequence diagram for ImageViewer metadata hover presentation

sequenceDiagram
    participant User
    participant ImagePanel
    participant MetaProvider
    participant NativeTooltip

    User->>ImagePanel: Hover metadata control
    ImagePanel->>MetaProvider: GetExif()
    MetaProvider-->>ImagePanel: Metadata entries
    ImagePanel->>ImagePanel: ShowMeta()
    ImagePanel->>NativeTooltip: Display formatted metadata
    NativeTooltip-->>User: Show MIME and dimensions immediately
Loading

File-Level Changes

Change Details Files
Adds localized toolbar guidance and restructures the metadata display for native hover tooltips.
  • Loads copy and background tooltip text from the plugin translation resources.
  • Removes click-to-toggle metadata handling in favor of the XAML tooltip behavior.
  • Populates a dedicated metadata tooltip content element and orders dimensions width before height.
  • Hides the metadata indicator when no metadata is available.
QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml
QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs
Completes ImageViewer localization resources for the newly exposed tooltip strings and supported languages.
  • Adds the copy and background translation keys across the supported translation configuration.
QuickLook.Plugin/QuickLook.Plugin.ImageViewer/Translations.config

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@zaum
zaum force-pushed the upstream-image-viewer-tooltips branch from 4192e3d to 9022287 Compare September 19, 2026 06:41

@sourcery-ai sourcery-ai 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.

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai 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.

Hey - I've found 1 issue

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path="QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs" line_range="431" />
<code_context>
         });
-        textMeta.Inlines.Remove(textMeta.Inlines.LastInline);
-        if (!textMeta.Inlines.Any())
+        textMetaContent.Inlines.Remove(textMetaContent.Inlines.LastInline);
+        if (!textMetaContent.Inlines.Any())
             MetaIconVisibility = Visibility.Collapsed;
</code_context>
<issue_to_address>
**issue (bug_risk):** `textMetaContent.Inlines.Remove(textMetaContent.Inlines.LastInline)` throws when `Meta.GetExif()` produces no displayable metadata, because `LastInline` is null. Images without EXIF metadata therefore fail while the panel is being constructed instead of simply hiding the metadata icon.

**Triggers:** When the image has no EXIF entries, or all EXIF labels or values are empty.

**Suggested fix:** Only remove the trailing newline when `textMetaContent.Inlines.LastInline` is non-null, or check whether any valid metadata was added before removing it.

```suggestion
        if (textMetaContent.Inlines.LastInline != null)
            textMetaContent.Inlines.Remove(textMetaContent.Inlines.LastInline);
```
</issue_to_address>

Sourcery assessment

Approval pending. 1 finding to address first.

Blocking findings: QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs:431


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

Comment thread QuickLook.Plugin/QuickLook.Plugin.ImageViewer/ImagePanel.xaml.cs Outdated
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
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.

1 participant