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
Added Dialogs for direct Audiostream and Subtitle switching #16825
base: master
Are you sure you want to change the base?
Conversation
Would you mind adding some screenshots? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a bit more love and I'm not sure the implementation is correct at all. Implementing a dialog which does nothing than to open another dialog from its OnInitWindow
override looks strange.
@@ -241,6 +243,8 @@ void CGUIWindowManager::CreateWindows() | |||
|
|||
Add(new CGUIDialogMediaFilter); | |||
Add(new CGUIDialogSubtitles); | |||
Add(new CGUIDialogSubtitleSelect); | |||
Add(new CGUIDialogAudioSelect); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Destruction of the new dialog instances inCGUIWindowManager::DestroyWindows()
is missing.
#include "utils/URIUtils.h" | ||
#include "utils/Variant.h" | ||
#include "utils/log.h" | ||
#include "video/VideoDatabase.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I doubt that all these headers are actually needed. Example: utils/log.h
included, but I cannot see any use of CLog
if (dialog == NULL) | ||
return false; | ||
|
||
CFileItemList options; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would define vars where they are actually first used.
CGUIDialogSelect* dialog = | ||
CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>( | ||
WINDOW_DIALOG_SELECT); | ||
if (dialog == NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (dialog == nullptr)
or if (!dialog)
for (int i = 0; i < audioStreamCount; ++i) | ||
{ | ||
std::string strItem; | ||
std::string strLanguage; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would define vars where they are actually first used.
if (!g_LangCodeExpander.Lookup(info.language, strLanguage)) | ||
strLanguage = g_localizeStrings.Get(13205); // Unknown | ||
|
||
if (info.name.length() == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (info.name.empty())
CGUIDialogSelect* dialog = | ||
CServiceBroker::GetGUI()->GetWindowManager().GetWindow<CGUIDialogSelect>( | ||
WINDOW_DIALOG_SELECT); | ||
if (dialog == NULL) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (dialog == nullptr)
or if (!dialog)
else | ||
strItem = StringUtils::Format("%s - %s", strLanguage.c_str(), info.name.c_str()); | ||
|
||
CFileItemPtr item(new CFileItem(strItem.c_str())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::make_shared<CFileItem>(strItem);
|
||
void CGUIDialogAudioSelect::OnInitWindow() | ||
{ | ||
ShowAudioSelect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it is correct to show the dialog in OnInitWindow
- while the dialog is not yet fully initialized? Did you copy this pattern from an existing dialog implementation?
|
||
void CGUIDialogSubtitleSelect::OnInitWindow() | ||
{ | ||
ShowSubtitleSelect(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it is correct to show the dialog in OnInitWindow - while the dialog is not yet fully initialized? Did you copy this pattern from an existing dialog implementation?
not against such a dialog in general, but aren't skins already able to add such a dialog/feature using currently available infolabels etc? I remember the balloon OSD popup in Confluence that had a similar feature. And since you mentined Netflix. Netflix uses a combined view to switch audio and subtitle language which I actually like quite a lot. What was your underlying idea for going with two separate dialogs instead of having something like a |
@@ -127,6 +127,8 @@ | |||
#include "dialogs/GUIDialogPlayEject.h" | |||
#include "dialogs/GUIDialogMediaFilter.h" | |||
#include "video/dialogs/GUIDialogSubtitles.h" | |||
#include "video/dialogs/GUIDialogSubtitleSelect.h" | |||
#include "video/dialogs/GUIDialogAudioSelect.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wrong include order
@lobermann this needs a rebase |
strictly by looking at the code, I can't really say if it makes sense to add these dialogs or not. I know for certain that you can cycle through subs and audio streams via builtins that can be triggered by the skin in any way it likes. I however am not sure if skins are currently able to get a list of all available streams/languages for subs, audio tracks and video (in case of multi video stream containers) and then directly select a specific one. This in fact might be a nice addition to have (in case it's currently not yet possible), but I'm not sure if the best/only way to do this will be a new dialog that skins MUST add since it will be new core UI element/dialog that way, or if it would somehow be possible achieve this just by using infolabels and builtins, so that could integrate it in whatever form they like (new dialog or just via a menu that is tightly integrated into the OSD, like in Netflix). @ronie do you know out of the top of your head if a feature like this would be possible via just infolabels and builtins? |
any traction here ? |
Having the ability to open these dialogs directly is a positive imo. |
Agreed it would be nice for the skin to be able to directly call the audio and subtitle selection dialogs. For this skins need window id's to which they can map buttons to open the selection dialog which I presume this PR adds. This would allow an improved version of #22557 where the toggle buttons are replaced by buttons opening the selection dialogs. |
Description
Mentioned this in one of the last PRs I made. This Adds two new dialogs that allow direct switching of audiostream and subtitle.
Motivation and Context
In order not to have to always navigate through the menu if you want to switch the audiostream or subtitle, this two dialogs can be called directly from the OSD and allow quick and easy change of them. (Similar to how it is on netflix for example).
Looking forward for feedback. Might not find it's way into Estuary (as we will not add any new buttons there) but there might be other skins interested in using it.
How Has This Been Tested?
Tested on MacOS and LibreElec.
Types of change
Checklist: