New "Music Lyrics View" idea, got a few questions and need some development help...
#16
Cheers spiff, for your help and patience,

ad 1.: it is still not quite clear to me how the controls declared in the skin are accessible from the cpp code, I presume by ID as defined in the xml file. But then, I noticed that the xml file is only read after the INIT message was processed by the base class, e.g. after an ActivateWindow() call. So I need to do my stuff in the OnMessage handler before the call of OnMessage() of the base class, and this somehow confused me.

ad 2.: I wonder how I can debug that, i.e. how can I know whether the control declared in the XML file is actually there (well I iterated through the group and found the ID), but is it displayed, do I have to define a background color, or setVisible(true) ...
I'll have a look what GUIDialogBoxBase offers more than GUIDialog.

Cheers,
peter
Reply
#17
Hello,

My objective is: if some PATH/SONG.mp3|flac is being played, I wanted a dialog to pop up containing the lyrics if a PATH/SONG.txt exists, either automatically or by pressing a key such as 'l'.

In order to obtain the lyrics, I have derived a simple Python script from CU Lyrics that walks through my music collection of the (compulsory) form /artist/album/[CD ?]/SONG.mp3|flac and downloads the lyrics: http://www.wurmsdobler.org/files/getlyrics.py

The patch on http://www.wurmsdobler.org/files/lyrics.patch should in theory provide the desired functionality. However, the GUIDialogLyrics only displays the Artist/Album/title as defined in the DialogLyrics.xml file, but not the lyrics in the textbox neither the background defined in the same file.

I have tried to instantiate a GUITextBox in the code, but no success either. I can see in the log file, that the text has been successfully loaded. How can I debug this rather simple case of displaying a dialog and all its controls? I presume I am missing something conceptually.

I am looking forward to some hints as I am really stuck.

Kind regards,
peter
Reply
#18
Any expert out there who would be willing to look into my patch (http://www.wurmsdobler.org/files/lyrics.patch), perhaps apply it and potentially find the issue in a second. It must be something trivial, a basic misunderstanding on my side. Please.
peter
Reply
#19
Hello,

since I cannot get my CGUIDialogLyrics into displaying the lyrics (text) in its CGUITextBox using a SetText() method, I had a look through the source code, again. First, I found that there is no explicit CGUITextBox instance in the code, but I realised that ./xbmc/lib/libPython/xbmcmodule/controltextbox.cpp , the python wrapper, creates one in ControlTextBox_Create() and performs a GUI_MSG_LABEL_RESET after that.

Interestingly enough, python's ControlTextBox_SetText() method, exposed in Python as setText(), works fine in the CU Lyrics script, and appears to be sending a CGUIMessage msg(GUI_MSG_LABEL_SET,...). CGUITextBox::OnMessage() handles a GUI_MSG_LABEL_SET where it seems to set the m_info's label, in contrast to GUI_MSG_LABEL_RESET, where it appears to reset the CGUITExtLayout and then forwards the GUI_MSG_LABEL_RESET. I could not figure out what happens next.

The point I try to make is, does CGUITextBox:: SetText() was its name alludes to, or do I have to use a SetLabel() in order to set the text, or set the text and then send a GUI_MSG_LABEL_RESET ?

Still confused,
peter
Reply
#20
Hello,

following up, it is interesting to notice that a text is being display using a message approach rather than the obvious SetText():

Code:
void CGUIDialogLyrics::ShowCurrentLyrics()
{
        :
        CGUITextBox* textBox = (CGUITextBox *)(GetControl(100));
        if (textBox)
        {
            //textBox->SetText(&lyricData[0]);//the obvious does not work!
            
            CGUIMessage msg(GUI_MSG_LABEL_SET, GetID(), textBox->GetID());
            msg.SetLabel(&lyricData[0]);
            textBox->OnMessage(msg);
        }
        :
}

Well, at least something. Next step, how to avoid the dialog disappearing when I click on the up/down arrow.
peter
Reply
#21
Finally I succeeded in making the GUIDialogLyrics work. For those interested a patch is available on http://www.wurmsdobler.org/files/lyrics.patch . If you checkout svn revision 27165, apply the patch and recompile, it should work.

The way it is intended to be used is that you have already lyrics as $PATH/$SONG.txt for a $PATH/SONG.mp3 (or any other format). (I have downloaded many lyrics using a script derived from CU Lyrics, http://www.wurmsdobler.org/files/getlyrics.py). When the song is playing, then I press 'l' in the MusicFileView and a dialog appears with the lyrics.

Good luck,
peter
Reply
#22
Glad you got it working.

A couple of notes for your patch:

1. Now that your's using a LABEL_SET message, you don't need to care about what sort of control it is and can send it directly to a CGUIControl (no need for CGUITextBox). In fact, you can just use the SET_CONTROL_LABEL() macro.

2. I suspect you don't need your boolean for active - try IsActive() instead?

3. You don't need the #include in GUIWindowMusicBase (and lots of them elsewhere I suspect)

4. You don't need to set focus to the spinner - do this via the skin file. Also, you shouldn't need to handle the PAGE_CHANGE message I should think - the textbox/spinner combo should handle that for you?

5. Get rid of the tabs Wink

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#23
Hello Jonathan,

thanks for looking at the patch. I have tried to take all your advice into account (http://www.wurmsdobler.org/files/lyrics.patch).

ad 4.: "You don't need to set focus to the spinner - do this via the skin file. "
How can I do that. I grepped a little bit through some xml files and noticed SetFocus(), and <onfocus>. Is there a focus property I can set, or do I have to call SetFocus() somewhere in the xml code, but where?

ad 5. Well, I'll grep through my patch.

peter
Reply
#24
<defaultcontrol>id_of_spinner</defaultcontrol>

There's nothing else that is focusable in your dialog, right?

Cheers,
Jonathan
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#25
OK, I have tried to add "<defaultcontrol>101</defaultcontrol>" in the window and then in the <controls> section, but neither did work.

jmarshall Wrote:There's nothing else that is focusable in your dialog, right?
Well, how can I tell. There is a textbox, a spincontrol, and a group containing 3 labels.
peter
Reply
#26
Only the spinner is focusable in that case.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply

Logout Mark Read Team Forum Stats Members Help
New "Music Lyrics View" idea, got a few questions and need some development help...0