diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index bb826b324..1c8021e93 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -27,7 +27,7 @@ #include #endif -#include +#include "gui/audioplayer.h" #include #include @@ -1869,6 +1869,42 @@ void CAudioPlayerGui::paintCover() cover_object.paint(); } } +void CAudioPlayerGui::getCurrentCaption(std::string* text) +{ + if (m_inetmode) + { + *text = m_curr_audiofile.MetaData.album; + } + else + { + char sNr[20]; + sprintf(sNr, ": %2d", m_current + 1); + *text = g_Locale->getText(LOCALE_AUDIOPLAYER_PLAYING); + *text += sNr ; + } +} + +void CAudioPlayerGui::getCurrentTitleArtist(std::string* text) +{ + GetMetaData(m_curr_audiofile); + + if (m_curr_audiofile.MetaData.title.empty()) + *text = m_curr_audiofile.MetaData.artist; + else if (m_curr_audiofile.MetaData.artist.empty()) + *text = m_curr_audiofile.MetaData.title; + else if (g_settings.audioplayer_display == TITLE_ARTIST) + { + *text = m_curr_audiofile.MetaData.title; + *text += " - "; + *text += m_curr_audiofile.MetaData.artist; + } + else //if (g_settings.audioplayer_display == ARTIST_TITLE) + { + *text = m_curr_audiofile.MetaData.artist; + *text += " - "; + *text += m_curr_audiofile.MetaData.title; + } +} void CAudioPlayerGui::paintTitleBox() { @@ -1897,17 +1933,7 @@ void CAudioPlayerGui::paintTitleBox() // first line (Track number) std::string tmp; - if (m_inetmode) - { - tmp = m_curr_audiofile.MetaData.album; - } - else - { - char sNr[20]; - sprintf(sNr, ": %2d", m_current + 1); - tmp = g_Locale->getText(LOCALE_AUDIOPLAYER_PLAYING); - tmp += sNr ; - } + getCurrentCaption(&tmp); int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp); int xstart = (m_width - w)/2; @@ -1916,24 +1942,8 @@ void CAudioPlayerGui::paintTitleBox() g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 1*m_item_height, m_width - OFFSET_INNER_MID - xstart, tmp, COL_MENUHEAD_TEXT); //caption "current track" // second line (Artist/Title...) - GetMetaData(m_curr_audiofile); + getCurrentTitleArtist(&tmp); - if (m_curr_audiofile.MetaData.title.empty()) - tmp = m_curr_audiofile.MetaData.artist; - else if (m_curr_audiofile.MetaData.artist.empty()) - tmp = m_curr_audiofile.MetaData.title; - else if (g_settings.audioplayer_display == TITLE_ARTIST) - { - tmp = m_curr_audiofile.MetaData.title; - tmp += " - "; - tmp += m_curr_audiofile.MetaData.artist; - } - else //if (g_settings.audioplayer_display == ARTIST_TITLE) - { - tmp = m_curr_audiofile.MetaData.artist; - tmp += " - "; - tmp += m_curr_audiofile.MetaData.title; - } w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp); xstart = (m_width - w)/2; if (xstart < OFFSET_INNER_MID + m_cover_width) diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 039cf1c71..7fa04706d 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -168,6 +168,9 @@ class CAudioPlayerGui : public CMenuTarget void showMetaData(); bool getNumericInput(neutrino_msg_t& msg, int& val); + void getCurrentCaption(std::string* text); + void getCurrentTitleArtist(std::string* text); + void addToPlaylist(CAudiofileExt &file); void removeFromPlaylist(long pos);