obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

frontend: Replace add source dropdown with dialog

Open Warchamp7 opened this issue 8 months ago • 9 comments

Description

Replaces the add source context menu with a brand new window.

  • Adds new FlowFrame and FlowLayout for automatic wrapping widget frame

    • Supports keyboard navigation of focusable widgets using arrow keys
  • Adds ThumbnailManager class

    • Keeps a cache of low resolution thumbnails of all visible sources
    • Periodically updates the oldest preview thumbnail among visible sources only
    • Utilizes ScreenshotObj which performs output over several render ticks
    • Throttled update loop
  • Adds new dialog for adding sources

    • Shows static previews of sources when possible
    • Supports selection of multiple existing sources in the list via Ctrl and/or Shift + clicking
    • Supports keyboard navigation of the existing source list
    • Supports drag and drop of individual sources onto the main window without closing the dialog

Sources Dock Menu

image

New Window

image

https://github.com/user-attachments/assets/4b5a7631-7170-4a2e-8dc9-8d7eb5d6d100

Motivation and Context

The current process for adding a source is rather cumbersome, especially when adding a source that already exists. Ideally users should be re-using Sources whenever it makes sense, so one of the goals of this PR is exposing that better than the old radio button and list selection.

How Has This Been Tested?

Created a number of different sources.

Types of changes

  • New feature (non-breaking change which adds functionality)
  • Tweak (non-breaking change to improve existing functionality)

Checklist:

  • [x] My code has been run through clang-format.
  • [x] I have read the contributing document.
  • [x] My code is not on the master branch.
  • [x] The code has been tested.
  • [x] All commit messages are properly formatted and commits squashed where appropriate.
  • [x] I have included updates to all appropriate documentation.

Warchamp7 avatar Apr 20 '25 04:04 Warchamp7

Testing on Ubuntu 24.04, three suggestions :

  • when you add an existing one, have a confirmation button after selecting it, instead of adding it the moment you click.
  • a way to show again the "recently added" of all source types once you have selected a given source type (basically to "unselect" a source type).
  • bit unsure about this one but the "recently added" sources when no sources have been added manually during the session is based on the most recently added ones during scene collection load, no? If so maybe a way to not add to that list sources created during sc load? idk if that makes sense

one visual bug :

  • in all themes except classic, the right bit of the right column of source types gets cut off Selection_3687

Penwy avatar Apr 20 '25 04:04 Penwy

Two additional notes after playing more with it :

  • the purple color when selecting a source type is unchanged by the theme, so it doesn't fit in some themes, typically in the light theme it makes select source type quite hard to read because of the black text. Selection_3706
  • the "make source visible" toggle is imo too far away and would benefit from being moved closer to the column where sources are created instead of hanging below the source types. Selection_3707

Penwy avatar Apr 21 '25 02:04 Penwy

PR has been updated with a new design and UI altogether

image

Warchamp7 avatar Jul 17 '25 21:07 Warchamp7

This has been updated with a bunch of cleanup and optimizations by @Lain-B. It is ready for proper testing and review now

Warchamp7 avatar Sep 03 '25 18:09 Warchamp7

Pushed some final cleanup as separate commits to make review of those changes easier.

As far as I am concerned, this PR is now ready for merge pending final code review.

Warchamp7 avatar Oct 30 '25 23:10 Warchamp7

Another thing I noticed is that deprecated source types like "Window Capture" and "Desktop Capture" are presented as bona-fide source types and are neither displayed with lower priority in the left-hand list, nor do they retain a deprecation marker.

PatTheMav avatar Nov 07 '25 13:11 PatTheMav

After testing latest (Ubuntu 24.04 in case) :

Two theming issues :

  • On Yami - Classic, when the source name text field is in focus, it has no border and is indistiguishable from the background. Selection_4613

  • On Yami - Light, the Create New button is hardly legible when not hovered. Selection_4614

Two suggestions :

  • Double clicking one of the existing sources should add an item of that source, in the same way that double clicking a source type does add a new source of that type.

  • I feel the Recently Added tab should be made to stand out more from the list, I would suggest by putting a separator between it and the rest of the list, and/or by giving it an icon to bring it level with the list. Rough mockup attached. Selection_4611

Penwy avatar Nov 07 '25 15:11 Penwy

Fixed the above visual issues

Two suggestions :

  • Double clicking one of the existing sources should add an item of that source, in the same way that double clicking a source type does add a new source of that type.

I toyed with this idea, but since the items are multi-selectable and can be unselected by clicking, double clicking was a bit confusing.

  • I feel the Recently Added tab should be made to stand out more from the list, I would suggest by putting a separator between it and the rest of the list, and/or by giving it an icon to bring it level with the list. Rough mockup attached.

I aimed to distinguish it with the lack of an icon. Adding a separator is also non-trivial due to how simplistic QListWidgets are heh

Warchamp7 avatar Nov 17 '25 20:11 Warchamp7

Fixed the above visual issues

Can confirm, also did a round of all themes to check for other visual issues, found none.

I aimed to distinguish it with the lack of an icon.

While I agree it is a visual distinction, it does, in my opinion, make it stand out less, as the eye is naturally drawn to the icons as "markers" of the list. Without the presence of such a marker, the "Recently added" does not impart that it is a list item at first sight.

Adding a separator is also non-trivial due to how simplistic QListWidgets are heh

Would it be possible to make it not be the same list but in a separate one(that's what I had in mind in the mockup), or not a list item at all, but still behave like one?

Penwy avatar Nov 18 '25 01:11 Penwy