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

UI: Resize projector window by resolution or scale

Open fsworld009 opened this issue 3 years ago • 10 comments

Description

Add Resize Window to Projector window's context menu to allow setting window size by resolution or scale. Add a dialog when choosing Custom... to allow users to manually input desired resolution or scale. image image image

Motivation and Context

There is an existing PR that trys to achieve resizing projector window by scale: #4378 However, that PR is put on hold due to some issues with integrating QDoubleSpinBox into context menu, which require a custom QT component to resolve.

This PR is based on the above PR and changes UX by opening a standalone dialog window for custom input, to avoid the need of doing such task.

Additional changes compared to the above PR:

  1. Add preset resolutions in context menu, which should be handy when previwing scenes or capture cards.
  2. Present scales as percentage values, so that we can restrain users to only input integers, this should avoid the issue discussed in https://github.com/obsproject/obs-studio/pull/4378#discussion_r598067480
  3. Since a standalone dialog is used for custom input, it can accept either resolution values or scale value.

How Has This Been Tested?

Built the code on my Windows 10 Machine and PopOS machine to manually tested my changes.

Edition	Windows 10 Pro
Version	21H2
Installed on	‎6/‎6/‎2020
OS build	19044.2251
Experience	Windows Feature Experience Pack 120.2212.4180.0
OS: Pop!_OS 22.04 LTS x86_64 
Kernel: 6.0.6-76060006-generic 

08.14.2023 Update

(New changes are only tested in Windows 10 for now)

Rebased to resolve conflicts and updated:

  1. Redid dialog UI with .ui Qt design file and followed existing settings UI layout.
    1. Input label is added
    2. Resolution input is now using the same format as in video settings
    3. Scale input now has suffix in the input
  2. Updated Context menu preset items: only resolutions or scales lower than screen resolution will be populated (except 100%, which is always available)

New dialog screenshots 0814-1 0814-2 0814-5

Context menu presets For a 1920x1080 source, when displayed in 4K screen: 0814-3

when displayed in 1080p screen: 0814-4

Types of changes

  • New feature (non-breaking change which adds 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.

fsworld009 avatar Nov 24 '22 05:11 fsworld009

I have included updates to all appropriate documentation.

There seems to be no existing documentation about the projector window, so I'm not sure if there's any TODO required for this one. (I also don't see any doc change in #4378)

fsworld009 avatar Nov 24 '22 05:11 fsworld009

Please can you merge this nice feature ? My sccreen is in portrait mode and i would like to have my projector in 1920x1080 and I can't ATM.

GhostvOne avatar Mar 15 '23 15:03 GhostvOne

@GhostvOne I'm not sure when I will get a chance to work on this again, and consider the review comments, it pretty much means I need to rewrite the PR for most part :P

In the meanwhile, you can try building this branch yourself. I have a build on my forked repo too, although it contains other stuffs from other PRs that would probably end up being changed as well based on review comments there.

fsworld009 avatar Mar 15 '23 15:03 fsworld009

08.14.2023 Update

(New changes are only tested in Windows 10 for now)

Rebased to resolve conflicts and updated:

  1. Redid dialog UI with .ui Qt design file and followed existing settings UI layout.
    1. Input label is added
    2. Resolution input is now using the same format as in video settings
    3. Scale input now has suffix in the input
  2. Updated Context menu preset items: only resolutions or scales lower than screen resolution will be populated (except 100%, which is always available)

New dialog screenshots 0814-1 0814-2 0814-5

Context menu presets For a 1920x1080 source, when displayed in 4K screen: 0814-3

when displayed in 1080p screen: 0814-4

fsworld009 avatar Aug 14 '23 14:08 fsworld009

@Warchamp7 please help rereview when you get a chance, thank you.

fsworld009 avatar Aug 14 '23 14:08 fsworld009

@fsworld009 Does your code take DPI scaling into account?

PatTheMav avatar Jan 10 '24 15:01 PatTheMav

Thanks for picking up the torch on this one @fsworld009

Scrxtchy avatar Jan 10 '24 15:01 Scrxtchy

@PatTheMav good question, I personally don't use scaling so didn't try it. What would be the expected behavior?

fsworld009 avatar Jan 12 '24 13:01 fsworld009