search inside lyric (user and development question)

Carles Pina i Estany carles at
Wed Nov 8 18:09:29 UTC 2006


This mail is half question about KDE programming, half wishlist :-) (the
topic is related, of course).

Situation+problem: Sometimes I like to listen music and read the lyric.
Then someone, something, interrupts me and then I have to "search"
listening some words and reading to match lyric and song again.

Best solution: to have, in lyric, some time references of "each part" in
the song and then highlight the lyric. But we don't have this
information (as far as I know).

"Workaround"/wishlist: to be able to do incremental search (like Shift+/
in Konqueror) inside lyric tab.
Programming question: 

I have programmed something using Qt, and I have never used KDE libs to
program. I have been learning a bit how to modify Amarok to do this, and
maybe send a patch.

I think that maybe my approach is not correct, so I ask here if there
are a better ways to do it. And also I have a problem (with message bar).

In playlistwindow.cpp, I have added:
+    new KAction ( i18n("Find Text"),Amarok::icon( "burn" ),
")), this, SLOT(slotFindText()), ac, "find_text" );
+    actionCollection()->action("find_text")->setEnabled(true);

(in one menu)

I have also added slotFindText:
+void PlaylistWindow::slotFindText() const //SLOT
+       ContextBrowser::instance()->findText();

And then, in contexbrowser.h:
+void ContextBrowser::findText(QString text)
+       m_lyricsPage->findText2();

Finally in htmlview.cpp:
+void HTMLView::findText2 ()
+       QSignal signal;
+       signal.connect(this,SLOT(slotFindAheadText()));
+       signal.activate();

This works (shortcut, menu). Is it the best way to do it? I have no
idea, so I am sure that no :-D

The problem: in konqueror it appears what user is typing in message bar.
Not in this kHtml_part, even I have tried  setStatusMessagesEnabled( true
);, but nothing...

Where the text that user is typing should appear? In the Amarok general
message bar, maybe?  I have not tried, but it seems that KHtml receives
the text, how KHtml can "send" to "amarok" the current typed text? I
guess that some signal/slot, but I don't know if Khtml is emitting some
signal for user incremental search. I don't know either why khtml_part
is not showing it :-)


Carles Pina i Estany		GPG id: 0x8CBDAE64	Manresa - Barcelona

More information about the Amarok mailing list