Commit graph

83 commits

Author SHA1 Message Date
Richard Stanway d997a56fb6 UI: Destroy the frontend API after OBS_FRONTEND_EVENT_EXIT
The frontend API was never explicitly cleaned up which has lead to
several crashes from plugins continuing to call it even after OBS itself
has been destroyed. We now destroy the API after the exit event, so
further calls by plugins will be no-ops instead of potentially accessing
destroyed OBS state.

This also required some changes to our own use of the API, as we relied
on the OBSBasic destructor to clean up some callbacks, by which point
the API should have already been destroyed.
2023-07-15 16:54:51 -07:00
derrod dcc07cfe4e clang-format: Set AllowAllConstructorInitializersOnNextLine to false 2023-07-15 16:14:55 -07:00
gxalpha a4834efde9 UI: Remove Qt 5 ifdef guards and code 2023-07-12 13:22:13 -04:00
derrod 67f7712d83 UI: Migrate undo/redo to using UUIDs 2023-06-28 11:04:56 -07:00
Lain 106c7aa61f Update copyrights/names 2023-05-20 01:31:18 -07:00
bin 559925ebaa UI: Check item whether selected before select
To prevent item from being selected again,
then mess up the qt internal list order.
2023-02-15 23:09:42 +01:00
cg2121 7a838e877f UI: Fix scene item edit drag & drop bug
If an user exits the source tree edit mode, without changing the name,
the scene item would become undraggable until the scene is refreshed.
We were setting the focus to just the label, not the whole widget.
2023-02-12 02:46:12 -08:00
cg2121 610a2171a2 UI: Don't open properties dialog if item is scene
This disables opening of the properties dialog if a scene is double
clicked in the source tree.
2023-01-22 10:45:25 +11:00
tytan652 cf5c68b773 UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
2023-01-16 11:52:26 +01:00
Richard Stanway daee83373c UI: Remove unused assignments 2022-10-15 16:17:46 -07:00
PatTheMav 43dc65beec UI: Fix source name edit textbox not accepting input on enter
The Enter key is connected to the `Edit` function and is handled by
Qt with the highest priority in its key event handler. Alas the boolean
return value is not propagated to the shortcut handling system, so
the key event will always be consumed and as such the user will be stuck
in editing state.

To fix this, `Edit` needs to behave like a toggle, saving the current
state of the input at a repeat press of Enter while in editing state.
2022-09-17 16:27:25 -07:00
cg2121 5e67d96996 UI: Fix source tree hovering being inconsistent
When hovering over the source tree items, sometimes the preview
would show the item hovered, sometimes not. This is caused by
the SourceTree mouseMoveEvent/leaveEvent calling the same functions
as the SourceTreeItem enterEvent/leaveEvent, therefore competing
with each other, causing some jankiness.
2022-08-30 18:49:23 +10:00
Matt Gajownik ad68380910 UI: Fix position of Sources dock actions on horizontal resize
Attempting to resize the Sources dock to be smaller than when initially
loaded would result in the contents of the list to never shrink.
Switching to another scene & back would temporary fix the sizing.

Fixes an issue introduced in adba393ca8
2022-08-29 10:03:41 -07:00
cg2121 d69c749aaf UI: Fix crash with adding source
Bug introduced with adba393ca8

OBS would crash when adding a new source because the source tree item's
widget would be NULL in the sizeHint function when the list item is first
created.
2022-08-29 09:11:38 +10:00
cg2121 adba393ca8 UI: Fix source item widget color height
The background color of the source tree item widgets wouldn't be
rendered properly.
2022-08-28 09:45:00 +10:00
Georges Basile Stavracas Neto 2de20ac00d UI: Revamp empty state of SourcesTree
The empty state of the SourcesTree widget looks rather busy, with
multiple icons and text without spacing. Revamp that state to use
a single, faded-out, 32px icon, add some spacing between the icon
and the text, and put the icon above the text.
2022-08-02 09:27:00 -03:00
Georges Basile Stavracas Neto 3f3cf02d2a UI: Remove 1px spacer from SourceTree
With the new icons, this extra spacer is not necessary.
2022-08-02 09:27:00 -03:00
Georges Basile Stavracas Neto b26c0dd7d5 UI: Remove fixed icon sizes from SourceTree
Setting fixed sizes breaks rendering of the icons in subtle
ways, such as cutting 1px from their sizes. Removing these
fixes sizes seem to allow Qt to correctly render these icons,
and allows us to remove some negative margins hacks that were
added to deal with it.
2022-08-02 09:27:00 -03:00
gxalpha 05c6a408e3 UI: Fix Qt 6 position deprecations 2022-07-22 09:37:17 -04:00
Matt Gajownik 2bb780468c UI: Fix formatting 2022-06-25 14:46:05 +10:00
Matt Gajownik 0135af9c34 UI: Use existing IsThemeDark() in more places 2022-06-25 14:33:52 +10:00
Andrew Story 961b75b58c libobs,UI: Issue appropriate signals on group / ungroup
Due to the way the frontend works, the logic for inserting the row for
the group in the UI was dropped since the new item_add message will
insert one automatically since it forces a refresh of the scene items.
The reliance on that implicit row insertion when grouping items is a
bit of a code smell, although the alternative would be to add logic to
disable handling the signal for that instant, which is probably a
worse choice.
2022-04-24 12:09:38 -07:00
gxalpha aa0893b751 UI: Refresh edit menu on item locked signal 2022-02-26 15:35:10 -08:00
gxalpha d5f2b7e496 UI: Refresh edit menu on item select/deselect 2022-02-19 15:42:57 -08:00
Clayton Groeneveld 0377b962b5 UI: Disconnect group reorder signal
The group reorder signal was never disconnected when
resetting signals.
2022-01-25 06:06:15 -08:00
VodBox 3d544653e8 UI: Cleanup libobs C++ type use 2021-11-26 23:23:51 +13:00
tt2468 71d7b6855d UI: Refresh source tree when an item source is removed
Previously, calling `obs_source_remove()` on an input would not fully
remove it if there was a scene item of the input on the current scene.

Now, when calling `obs_source_remove()` and there is a scene item of
the removed input on the current scene, the UI refreshes the scene
items, allowing the scene item to be released completely and the
input destroyed.
2021-11-20 19:58:38 -08:00
jp9000 da04907927 Revert "UI: Disable hotkeys when a user is expected to type text"
This reverts commit f832d14220.

Reverting this until we do more investigation. Currently, any text
that can be typed in a dialog requires the dialog to re-enable hotkeys
on destruction, which is frustrating. There has to be a better way.
2021-10-03 07:52:44 -07:00
Ryan Foster f832d14220 UI: Disable hotkeys when a user is expected to type text
Disable hotkeys when a user starts an interaction with the UI where they
are expected to type text and re-enable hotkeys when the interaction is
completed.
2021-09-04 15:22:21 -07:00
gxalpha 85891630b3 UI: Dim hidden source items in source tree
Dims the items of hidden sources in the sources dock to make it more
obvious that they are not visible. Both the icon and the sources name
are affected.
2021-08-17 08:24:28 -07:00
Georges Basile Stavracas Neto 4c07ba6886 Revert "UI: Disable drag/drop on Linux scenes/sources (for now)"
This reverts commit 457adcedd3.

Requires https://github.com/obsproject/obs-browser/pull/304
2021-07-28 10:28:49 +10:00
Exeldro 5998f4cc4d UI: Optimize backup scene for undo/redo 2021-06-08 23:29:17 -07:00
jp9000 457adcedd3 UI: Disable drag/drop on Linux scenes/sources (for now)
Due to a Qt issue on Linux, disable drag/drop on the scenes/sources list
on Linux for the time being.
2021-05-31 12:18:45 -07:00
jp9000 c4c5b0d21d UI: Add Group/Ungroup Undo/Redo actions 2021-05-21 18:17:09 -07:00
jp9000 7bdd384fd5 UI: Fix hide undo/redo not working with group items
Fixes obsproject/obs-studio#4702
2021-05-17 16:34:56 -07:00
jp9000 0d482be14a UI: Use std::bind for visibility undo/redo action
This is better and slightly more optimal code over what it was before.
2021-04-27 21:31:07 -07:00
jp9000 78f1983f7d UI: Remove unnecessary Undo/Redo cleanup func
Since fixing the reference holding issue with scene/source deletion, the
undo/redo cleanup function (last param of add_action) is no longer
required.
2021-04-27 20:45:43 -07:00
jp9000 59603f47ad UI: Use scene backup/undo/redo funcs for reordering
Fixes a bug where groups would not be backed up properly
2021-04-23 12:40:33 -07:00
jp9000 4188899194 UI: Add undo/redo for source reordering 2021-04-20 19:38:53 -07:00
jp9000 8175700620 UI: Add Undo/Redo for source visibility
(Author note: This is why I hate supporting undo/redo.)

Fixes obsproject/obs-studio#4447
2021-04-16 20:33:53 -07:00
Clayton Groeneveld 7dfd36f9e8 UI: Force current scene when using undo/redo
The undo/redo functions are setting the current scene. Everytime
it would do this, it would actually transition to the scene.
This forces the current scene, so it fixes a bug where the
transition would be grayed out when undoing/redoing.
2021-04-10 01:49:30 -07:00
wangshaohui 48b779c7b2 UI: Ignore scene source which has been removed
While getting source list, we should ignore scene source which has been
removed. If we don't ignore it, a deleted scene source will be added
later. Besides, signals of that scene have been sent before, such as
"remove" of scene. So we can't remove this scene source by "auto
removeItem" defined in SourceTreeItem::ReconnectSignals().

Fixes obsproject/obs-studio#2602
2021-03-31 02:48:54 -07:00
wangshaohui 81c4750fbf UI: Fix UI deadlock after dragging source
Fixes obsproject/obs-studio#2609
2021-03-30 05:49:00 -07:00
Ford Smith 60d95cb5bd UI/libobs: Undo/Redo Sources and Scenes
Implements the Undo/Redo for scenes and sources, ranging from renaming,
deletion, addition. It also adds several elements to libobs that were
designed to facilitate undo/redo, and should not affect the rest of
libobs.
2021-03-29 03:06:26 -04:00
Kurt Kartaltepe 513bcb8e35 UI: Cleanup Qt for Qt6
This changes cleans up some deprecated functions that were removed in
Qt6. Some are placed behind version ifdefs and others are replaced for
their non-deprecated Qt5 version.
2021-03-08 21:41:13 -08:00
Richard Stanway 38ad3ba18f UI: Add deferred function to update context bar
With the queued connection in d68484e7, the "Deselect" signal for
sources which are being deleted is never fired, as the object is gone by
the time the queued signal is processed. This results in the context bar
not updating.

This commit adds a new UpdateContextBarDeferred function, allowing
queuing of only the context bar update instead of the whole signal
handler.
2020-12-14 11:53:01 -08:00
Exeldro d68484e7b7 UI: Handle (de)select scene items queued
The (de)select signal can come from a obs_scene_enum_items
which locks the scene. The Qt::QueuedConnection makes sure
the (de)select is handled outside of that lock.
Fixes the deadlock from #3673
2020-12-11 17:05:38 -08:00
VodBox 89b4e9136f UI: Various screen reader fixes
This commit fixes various issues with screen readers in the main OBS
interface. These were tested using NVDA on Windows 10 2004.

Audio track selection in Settings now says Track 1, 2, etc, rather than
just the number.

Various checkboxes that just say "Enable" now have accessible text that
says what the enable is for (since it says "checkbox", the fact it's an
enable should hopefully be clear).

Type in the recording tab of output now has accessible text which says
"Recording Type".

Items in the Advanced Audio Properties window now have accessible text
for what they are for. Currently some do not report correct values, but
that will require an accessible interface in Qt to be written
specifically for that, which will be done at a later date.

Buttons in the filters window now have accessible text for what they do.

All the right side buttons in hotkeys now have tooltips, and by
extension, accessible text.
2020-11-25 19:38:05 -08:00
Joshua Berenhaus f56ab9a38b UI: Set focus back to label after source rename
Fixes obsproject/obs-studio#3465
2020-10-09 14:01:25 -07:00
Colin Edwards fddbbe259d UI: Source Toolbar
The source toolbar allows quick and easy access to properties and
filers, and shows common properties/features of a source type.  For
example, when you select a media source, VLC source, or the slideshow
source, you'll get media controls to control playback of the media.  If
you select a text source you can edit the font, color, or text if
applicable.  Or if you select a capture source, you can select the
display/window/etc to capture for that source.

If the source toolbar is not desired and is viewed as taking up valuable
space in the window, it can be disabled via the view menu.

Co-authored-by: Clayton Groeneveld <claytong1214@gmail.com>
Co-authored-by: Jim <obs.jim@gmail.com>
2020-08-17 07:18:18 -07:00