obs-studio
obs-studio copied to clipboard
UI: Resize projector window by resolution or scale
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.

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:
- Add preset resolutions in context menu, which should be handy when previwing scenes or capture cards.
- 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
- 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:
- Redid dialog UI with
.uiQt design file and followed existing settings UI layout.- Input label is added
- Resolution input is now using the same format as in video settings
- Scale input now has suffix in the input
- 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
Context menu presets
For a 1920x1080 source, when displayed in 4K screen:
when displayed in 1080p screen:
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.
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)
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 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.
08.14.2023 Update
(New changes are only tested in Windows 10 for now)
Rebased to resolve conflicts and updated:
- Redid dialog UI with
.uiQt design file and followed existing settings UI layout.- Input label is added
- Resolution input is now using the same format as in video settings
- Scale input now has suffix in the input
- 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
Context menu presets
For a 1920x1080 source, when displayed in 4K screen:
when displayed in 1080p screen:
@Warchamp7 please help rereview when you get a chance, thank you.
@fsworld009 Does your code take DPI scaling into account?
Thanks for picking up the torch on this one @fsworld009
@PatTheMav good question, I personally don't use scaling so didn't try it. What would be the expected behavior?