-
-
Notifications
You must be signed in to change notification settings - Fork 9k
Avoid having two docks with the same object name #7637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
e9a60db to
03a9519
Compare
|
Personally I'd prefer to avoid the whole "function_call[insert integer here]" shenanigans, it always seems half-arsed to me. If code uses the old signature it should break and throw a compile-time error, forcing any authors relying on it to update to the new API, especially as this probably won't end up in a minor version update anyway. Otherwise we're dragging a whole ecosystem of mixed implementations with us until we end up with |
|
Then how should I name it rather than adding a 2, because the old function is deprecated because the custom QAction is no longer created and and the new one require an id. Edit: C does not support having two function named the same even with different parameters and return type. |
03a9519 to
347c807
Compare
|
Is there other code that uses this function? Because if it is only us, then we should fix all invocations of the code, but I'm afraid you might tell me that plugins are allowed to use this function? |
|
If you are talking about |
|
I was afraid you'd say that - internal UI methods shouldn't be exposed as-is to the API, but that's for later to fix. I'd suggest naming the function |
347c807 to
ff91a93
Compare
1038eb8 to
ebd3e60
Compare
80f8041 to
aa98043
Compare
aa98043 to
db0b175
Compare
dbeee22 to
2611e11
Compare
5c1b501 to
5caf6e8
Compare
5caf6e8 to
342d8bd
Compare
|
Renamed |
717c37d to
c75dac5
Compare
c75dac5 to
63052c9
Compare
63052c9 to
2de16d8
Compare
2de16d8 to
2de8ec0
Compare
|
Replace QUuid usage in |
2de8ec0 to
f9bab9d
Compare
|
Added this note to the PR description:
|
44bfb83 to
c0d6ea0
Compare
c0d6ea0 to
b51c07d
Compare
b51c07d to
cb1e0f4
Compare
https://doc.qt.io/qt-6/qmainwindow.html#saveState You should make sure that this property is unique for each QToolBar and QDockWidget you add to the QMainWindow.
obs_frontend_add_dock() is deprecated in favor of obs_frontend_add_dock_by_id()
Some plugin does that by deleting the QAction returned by obs_frontend_add_dock(). Now that obs_frontend_add_dock() is deprecated, obs_frontend_add_custom_qdock() replace this usage.
cb1e0f4 to
92f1c4a
Compare
Description
Depends on:
Dependency of:
https://doc.qt.io/qt-6/qmainwindow.html#saveState
We should avoid letting plugins add docks with the same object name. So to implement that:
obs_frontend_add_dock()is deprecated in favor ofobs_frontend_add_dock_by_id()andobs_frontend_add_custom_qdock()which ask for an unique id (object name). The dock is not added if the id is already used and return false in this case.obs_frontend_add_dock()implements a temporary workaround to avoid this.obs_frontend_add_custom_qdock()replace the usage ofobs_frontend_add_dock()where the returned QAction is deleted (e.g. Sources Dock plugin). The dock is not added if the id is already used and return false in this case.obs_frontend_add_dock()andobs_frontend_add_custom_qdock()happen to be changed, the object name is changed back to its original.obs_frontend_remove_dock()Note: If
obs_frontend_add_custom_qdock()usecase is something we want to avoid, review the code about removing it and deprecate the usecase throughobs_frontend_add_dock()deprecation.Motivation and Context
Fix a potential issue and preparation for PRs that depends on this one.
Also make the API more neutral toward the used dock system for non-custom methods.
How Has This Been Tested?
obs_frontend_add_dock_by_id()orobs_frontend_add_custom_qdock()Types of changes
Checklist: