diff --git a/src/gui/audioplayer.cpp b/src/gui/audioplayer.cpp index 6596d959b..03edd14c6 100644 --- a/src/gui/audioplayer.cpp +++ b/src/gui/audioplayer.cpp @@ -296,6 +296,7 @@ int CAudioPlayerGui::exec(CMenuTarget* parent, const std::string &actionKey) m_meta_height = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(); m_title_height = 3*OFFSET_INNER_SMALL + 2*m_item_height + m_meta_height; + m_cover_width = 0; m_info_height = 2*OFFSET_INNER_SMALL + 2*g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_INFO]->getHeight(); m_button_height = ::paintButtons(AudioPlayerButtons[0], 4, 0, 0, 0, 0, 0, false, NULL, NULL); @@ -1700,7 +1701,21 @@ void CAudioPlayerGui::paintCover() cover = meta.cover; if (access(cover.c_str(), F_OK) == 0) - g_PicViewer->DisplayImage(cover, m_x + OFFSET_INNER_MID, m_y + OFFSET_INNER_SMALL, m_title_height - 2*OFFSET_INNER_SMALL, m_title_height - 2*OFFSET_INNER_SMALL, m_frameBuffer->TM_NONE); + { + int cover_x = m_x + OFFSET_INNER_MID; + int cover_y = m_y + OFFSET_INNER_SMALL; + m_cover_width = 0; + CComponentsPicture *cover_object = new CComponentsPicture(cover_x, cover_y, cover); + if (cover_object) + { + cover_object->doPaintBg(false); + cover_object->SetTransparent(CFrameBuffer::TM_BLACK); + cover_object->setHeight(m_title_height - 2*OFFSET_INNER_SMALL, true); + cover_object->paint(); + + m_cover_width = cover_object->getWidth() + OFFSET_INNER_MID; + } + } } void CAudioPlayerGui::paintTitleBox() @@ -1742,13 +1757,11 @@ void CAudioPlayerGui::paintTitleBox() tmp += sNr ; } - // FIXME - there's no cover-check; so we maybe paint over the cover - int w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp); int xstart = (m_width - w)/2; - if (xstart < OFFSET_INNER_MID) - xstart = OFFSET_INNER_MID; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 1*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); //caption "current track" + if (xstart < OFFSET_INNER_MID + m_cover_width) + xstart = OFFSET_INNER_MID + m_cover_width; + 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); @@ -1771,9 +1784,9 @@ void CAudioPlayerGui::paintTitleBox() } w = g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->getRenderWidth(tmp); xstart = (m_width - w)/2; - if (xstart < OFFSET_INNER_MID) - xstart = OFFSET_INNER_MID; - g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height, m_width - 2*OFFSET_INNER_MID, tmp, COL_MENUHEAD_TEXT); //artist - title + if (xstart < OFFSET_INNER_MID + m_cover_width) + xstart = OFFSET_INNER_MID + m_cover_width; + g_Font[SNeutrinoSettings::FONT_TYPE_MENU]->RenderString(m_x + xstart, m_y + OFFSET_INNER_SMALL + 2*m_item_height, m_width - OFFSET_INNER_MID - xstart, tmp, COL_MENUHEAD_TEXT); //artist - title // reset so fields get painted always m_metainfo.clear(); @@ -2112,8 +2125,7 @@ void CAudioPlayerGui::updateMetaData() if (updateMeta || updateScreen) { - int cover_width = m_title_height + 2*OFFSET_INNER_MID; - m_frameBuffer->paintBoxRel(m_x + cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - OFFSET_INNER_MID - cover_width, m_meta_height, m_titlebox->getColorBody()); + m_frameBuffer->paintBoxRel(m_x + OFFSET_INNER_MID + m_cover_width, m_y + OFFSET_INNER_SMALL + 2*m_item_height + OFFSET_INNER_SMALL, m_width - 2*OFFSET_INNER_MID - m_cover_width, m_meta_height, m_titlebox->getColorBody()); int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(m_metainfo); int xstart = (m_width - w)/2; diff --git a/src/gui/audioplayer.h b/src/gui/audioplayer.h index 8cb914a12..86810d109 100644 --- a/src/gui/audioplayer.h +++ b/src/gui/audioplayer.h @@ -98,6 +98,7 @@ class CAudioPlayerGui : public CMenuTarget int m_meta_height; int m_button_height; int m_title_height; + int m_cover_width; int m_info_height; int m_key_level; bool m_visible;