From 6ec0ad1bac0dc793d7961a05e10dd944abe584ab Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Thu, 22 Oct 2020 21:40:18 +0000 Subject: lyrics: show text of the current playing song (widget mode only) git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@9518 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/lyrics/lyrics.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/plugins/General/lyrics/lyrics.cpp') diff --git a/src/plugins/General/lyrics/lyrics.cpp b/src/plugins/General/lyrics/lyrics.cpp index 4ef1fe4e9..dea479ddf 100644 --- a/src/plugins/General/lyrics/lyrics.cpp +++ b/src/plugins/General/lyrics/lyrics.cpp @@ -35,6 +35,7 @@ Lyrics::Lyrics(QPointer *lyricsWidget, QObject *parent) : QObject( m_action->setShortcut(tr("Ctrl+L")); UiHelper::instance()->addAction(m_action, UiHelper::PLAYLIST_MENU); connect(m_action, SIGNAL(triggered ()), SLOT(showLyrics())); + connect(SoundCore::instance(), SIGNAL(trackInfoChanged()), SLOT(onTrackInfoChanged())); } Lyrics::~Lyrics() @@ -61,3 +62,15 @@ void Lyrics::showLyrics() } } } + +void Lyrics::onTrackInfoChanged() +{ + if(!m_lyricsWidget->isNull()) + { + TrackInfo info = SoundCore::instance()->trackInfo(); + if (!info.value(Qmmp::ARTIST).isEmpty() && !info.value(Qmmp::TITLE).isEmpty()) + { + m_lyricsWidget->data()->fetch(&info); + } + } +} -- cgit v1.2.3-13-gbd6f