void CUpnpBrowserGui::updateTimes(const bool force) { int top; if (CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) { bool updatePlayed = force; if ((m_time_played != CAudioPlayer::getInstance()->getTimePlayed())) { m_time_played = CAudioPlayer::getInstance()->getTimePlayed(); updatePlayed = true; } printf("updateTimes: force %d updatePlayed %d\n", force, updatePlayed); char play_time[8]; snprintf(play_time, 7, "%ld:%02ld", m_time_played / 60, m_time_played % 60); char tmp_time[] = "000:00"; int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(tmp_time); if (updatePlayed) { paintDetails(NULL, true); top = m_y + (m_height - m_info_height - 1 * m_buttonHeight) + m_buttonHeight + 4; m_frameBuffer->paintBoxRel(m_x + m_width - w - 15, top + 1, w + 4, m_buttonHeight, COL_MENUCONTENTDARK_PLUS_0); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(m_x + m_width - w - 11, top + 1 + m_buttonHeight, w, play_time, COL_MENUCONTENTDARK_TEXT); } } }
void CUpnpBrowserGui::updateTimes(const bool force) { int top; if(CAudioPlayer::getInstance()->getState() != CBaseDec::STOP) { bool updatePlayed = force; if ((m_time_played != CAudioPlayer::getInstance()->getTimePlayed())) { m_time_played = CAudioPlayer::getInstance()->getTimePlayed(); updatePlayed = true; } char play_time[8]; snprintf(play_time, 7, "%ld:%02ld", m_time_played / 60, m_time_played % 60); char tmp_time[] = "000:00"; int w = g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getRenderWidth(tmp_time); if (updatePlayed) { paintDetails(NULL, 0, true); top = m_y + m_height - m_info_height; // refresh box m_frameBuffer->paintBoxRel(m_x + m_width - w - SCROLLBAR_WIDTH, top + 2, w + 4, m_info_height - 4, COL_MENUCONTENTDARK_PLUS_0, NO_RADIUS, CORNER_NONE, g_settings.menu_Head_gradient); g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->RenderString(m_x + m_width - w - 11, top + (m_info_height - g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight())/2 + g_Font[SNeutrinoSettings::FONT_TYPE_INFOBAR_SMALL]->getHeight(), w, play_time, COL_MENUHEAD); } } }
void CListBox::paintItem(unsigned int itemNr, int paintNr, bool _selected) { int ypos = y + theight + paintNr*getItemHeight(); uint8_t color; fb_pixel_t bgcolor; if (_selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; // itemlines paintItem2DetailsLine(paintNr, itemNr); // details paintDetails(itemNr); } else { color = COL_MENUCONTENT; bgcolor = COL_MENUCONTENT_PLUS_0; } frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, getItemHeight(), bgcolor); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + BORDER_LEFT, ypos + fheight, width - (BORDER_LEFT + BORDER_RIGHT), "demo", color); }
void CBEChannelWidget::paintItem(int pos) { uint8_t color; fb_pixel_t bgcolor; int ypos = y + theight + pos*fheight; unsigned int current = liststart + pos; if(current == selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, bgcolor); // itemlines paintItem2DetailsLine(pos, current); // details paintDetails(current); } else { color = COL_MENUCONTENT; bgcolor = COL_MENUCONTENT_PLUS_0; frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, bgcolor); } if ((current == selected) && (state == beMoving)) { int icon_w, icon_h; frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icon_w, &icon_h); frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 8, ypos + (fheight - icon_h)/2); } if(current < Channels->size()) { g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 5 + numwidth + BORDER_LEFT, ypos + (fheight - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight())/2 + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(), width - numwidth - 20 - 15, (*Channels)[current]->getName(), color, 0, true); } //FIXME??? // hd/scrambled icons if (g_settings.channellist_ca) { if(current < Channels->size()) { // scrambled icon if((*Channels)[current]->scrambled) frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED2, x + width - (SCROLLBAR_WIDTH + 2 + icon_w_s), ypos + (fheight - icon_h_s)/2 ); // hd icon if((*Channels)[current]->isHD() ) frameBuffer->paintIcon(NEUTRINO_ICON_RESOLUTION_HD, x + width - (SCROLLBAR_WIDTH + 2 + icon_w_s + 2 + icon_w_hd), ypos + (fheight - icon_h_hd)/2 ); } } }
void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselected) { int ypos = y+ theight + paintNr*iheight; fb_pixel_t color; fb_pixel_t bgcolor; if (pselected) { color = COL_MENUCONTENTSELECTED_TEXT; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if(itemNr < getItemCount()) { initItem2DetailsLine (paintNr, itemNr); paintDetails(itemNr); } frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); } else { color = COL_MENUCONTENT_TEXT; bgcolor = COL_MENUCONTENT_PLUS_0; frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); } if(itemNr < getItemCount()) { if( isChannelInBouquet(itemNr)) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_GREEN, x+10, ypos, iheight); } else { //frameBuffer->paintBoxRel(x+8, ypos+4, NEUTRINO_ICON_BUTTON_GREEN_WIDTH, fheight-4, bgcolor); frameBuffer->paintBoxRel(x+10, ypos, iconoffset, iheight, bgcolor); } //g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 8 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 8, ypos+ fheight, width - (8 + NEUTRINO_ICON_BUTTON_GREEN_WIDTH + 8 + 8), Channels[itemNr]->getName(), color, 0, true); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 20 + iconoffset, ypos + iheight - (iheight-fheight)/2, width - 20 - iconoffset, Channels[itemNr]->getName(), color, 0, true); if(Channels[itemNr]->scrambled) frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight); } }
void CBEChannelWidget::paintItem(int pos) { uint8_t color; fb_pixel_t bgcolor; int ypos = y+ theight+0 + pos*iheight; unsigned int current = liststart + pos; if(current == selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; // clear details frameBuffer->paintBoxRel(x+2, y + height + 2, width-4, info_height - 4, COL_MENUCONTENTDARK_PLUS_0, RADIUS_LARGE); if(current < Channels->size()) { paintItem2DetailsLine (pos, current); paintDetails(current); } frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, RADIUS_LARGE); } else { color = COL_MENUCONTENT; bgcolor = COL_MENUCONTENT_PLUS_0; frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor); } if ((current == selected) && (state == beMoving)) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + 10, ypos, iheight); } if(current < Channels->size()) { //g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color, 0, true); //FIXME numwidth ? we not show chan numbers g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 20 + iconoffset, ypos + iheight - (iheight-fheight)/2, width- iconoffset- 20, (*Channels)[current]->getName(), color, 0, true); if((*Channels)[current]->scrambled) frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x+width- 15 - 28, ypos, fheight); } }
void CUpnpBrowserGui::paintItemPos(std::vector<UPnPEntry> *entry, unsigned int pos, unsigned int selected) { int ypos = m_y + m_title_height + m_theight + pos*m_fheight; uint8_t color; fb_pixel_t bgcolor; if (pos == selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; if ((*entry)[pos].isdir) clearItem2DetailsLine(); // clear it else paintItem2DetailsLine(pos); paintDetails(entry, pos); } else { color = COL_MENUCONTENT; bgcolor = COL_MENUCONTENT_PLUS_0; } // item box m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_fheight, bgcolor); if (pos >= entry->size()) return; int preferred = (*entry)[pos].preferred; std::string info; std::string fileicon; if ((*entry)[pos].isdir) { info = "<DIR>"; fileicon = NEUTRINO_ICON_FOLDER; } else { //FIXME: revise this if (preferred != -1) { info = (*entry)[pos].resources[preferred].duration; // icon std::string protocol, prot, network, mime, additional; protocol = (*entry)[pos].resources[preferred].protocol; splitProtocol(protocol, prot, network, mime, additional); if (mime.substr(0, 6) == "audio/") { fileicon = NEUTRINO_ICON_MP3; } else if (mime.substr(0, 6) == "image/") { fileicon = NEUTRINO_ICON_PICTURE; } else if (mime.substr(0, 6) == "video/") { fileicon = NEUTRINO_ICON_MOVIE; } } else { info = "(none)"; fileicon = NEUTRINO_ICON_FILE; } } std::string name = (*entry)[pos].title; char tmp_time[] = "00:00:00.0"; int w = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getRenderWidth(tmp_time); m_frameBuffer->paintIcon(fileicon, m_x + 5 , ypos + (m_fheight - 16) / 2); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + m_width - 15 - w, ypos + m_fheight, w, info, color, m_fheight); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 30, ypos + m_fheight, m_width - 50 - w, name, color, m_fheight, true); // UTF-8 }
void CBEChannelSelectWidget::paintItem(int pos) { int ypos = cFrameBox.iY + cFrameTitle.iHeight + pos*cFrameItem.iHeight; uint8_t color = COL_MENUCONTENT; fb_pixel_t bgcolor = COL_MENUCONTENT_PLUS_0; unsigned int current = liststart + pos; if (current == selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; // itemlines paintItem2DetailsLine(pos); // details paintDetails(current); } else { color = COL_MENUCONTENT; bgcolor = COL_MENUCONTENT_PLUS_0; } // itemBox frameBuffer->paintBoxRel(cFrameBox.iX, ypos, cFrameBox.iWidth - SCROLLBAR_WIDTH, cFrameItem.iHeight, bgcolor); // itemIcon3.setIcon(NEUTRINO_ICON_BUTTON_MARK); if(current < getItemCount()) { g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(cFrameBox.iX + BORDER_LEFT + itemIcon3.iWidth + ICON_OFFSET, ypos + (cFrameItem.iHeight - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight())/2 + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getHeight(), cFrameBox.iWidth - (BORDER_LEFT + itemIcon3.iWidth + ICON_OFFSET + BORDER_RIGHT), Channels[current]->getName(), color, 0, true); if( isChannelInBouquet(current)) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_MARK, cFrameBox.iX + BORDER_LEFT, ypos + (cFrameItem.iHeight - itemIcon3.iHeight)/2); } else { frameBuffer->paintBoxRel(cFrameBox.iX + BORDER_LEFT, ypos + 4, itemIcon3.iWidth, cFrameItem.iHeight - 4, bgcolor); } //FIXME??? // hd/scrambled icons if (g_settings.channellist_ca) { // scrambled icon if( Channels[current]->scrambled) frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, cFrameBox.iX + cFrameBox.iWidth - (SCROLLBAR_WIDTH + ICON_OFFSET + itemIcon2.iWidth), ypos + (cFrameItem.iHeight - itemIcon2.iHeight)/2 ); // hd icon if( Channels[current]->isHD() ) frameBuffer->paintIcon(NEUTRINO_ICON_HD, cFrameBox.iX + cFrameBox.iWidth - (SCROLLBAR_WIDTH + ICON_OFFSET + itemIcon2.iWidth + ICON_OFFSET + itemIcon1.iWidth), ypos + (cFrameItem.iHeight - itemIcon1.iHeight)/2 ); // uhd icon else if(Channels[current]->isUHD()) frameBuffer->paintIcon(NEUTRINO_ICON_UHD, cFrameBox.iX + cFrameBox.iWidth - (SCROLLBAR_WIDTH + ICON_OFFSET + itemIcon2.iWidth + ICON_OFFSET + itemIcon1.iWidth), ypos + (cFrameItem.iHeight - itemIcon1.iHeight)/2 ); } } }
void CUpnpBrowserGui::paintItem(std::vector<UPnPEntry> *entries, unsigned int pos, unsigned int selected) { int ypos = m_y + m_title_height + m_theight + pos*m_fheight; fb_pixel_t color; fb_pixel_t bgcolor; if (pos == selected) { color = COL_MENUCONTENT_TEXT_PLUS_2; bgcolor = COL_MENUCONTENT_PLUS_2; } else { color = COL_MENUCONTENT_TEXT; bgcolor = COL_MENUCONTENT_PLUS_0; } m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_fheight, bgcolor); if (pos >= (*entries).size()) return; UPnPEntry *entry = &(*entries)[pos]; if (pos == selected) { paintItemInfo(entry); paintDetails(entry); if (entry->isdir) paintItem2DetailsLine (-1); // clear it else paintItem2DetailsLine (pos); } int preferred=entry->preferred; std::string info; std::string fileicon; if (entry->isdir) { info = "<DIR>"; fileicon = NEUTRINO_ICON_FOLDER; } else { if (preferred != -1) { info = entry->resources[preferred].duration; fileicon = NEUTRINO_ICON_MP3; } else { info = "(none)"; fileicon = NEUTRINO_ICON_FILE; } } std::string name = entry->title; char tmp_time[] = "00:00:00.0"; int w = g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->getRenderWidth(tmp_time); m_frameBuffer->paintIcon(fileicon, m_x + 5 , ypos + (m_fheight - 16) / 2); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + m_width - 15 - w, ypos + m_fheight, w, info, color, m_fheight); g_Font[SNeutrinoSettings::FONT_TYPE_FILEBROWSER_ITEM]->RenderString(m_x + 30, ypos + m_fheight, m_width - 50 - w, name, color, m_fheight); }
void CWebTV::paintItem(int pos) { int ypos = y + theight + pos*iheight; uint8_t color; fb_pixel_t bgcolor; unsigned int curr = liststart + pos; if (curr == selected) { color = COL_MENUCONTENTSELECTED; bgcolor = COL_MENUCONTENTSELECTED_PLUS_0; // itemlines paintItem2DetailsLine(pos, curr); // details paintDetails(curr); // itembox frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor); } else { color = COL_MENUCONTENT; bgcolor = COL_MENUCONTENT_PLUS_0; // itembox frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor); } //name and description if(curr < channels.size()) { char tmp[10]; char nameAndDescription[255]; int l = 0; sprintf((char*) tmp, "%d", curr + 1); l = snprintf(nameAndDescription, sizeof(nameAndDescription), "%s", channels[curr]->title.c_str()); // number int numpos = x + BORDER_LEFT + numwidth - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth(tmp); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(numpos, ypos + (iheight - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getHeight())/2 + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getHeight(), numwidth + 5, tmp, color, 0, true); unsigned int ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription, true); // description std::string Descr = channels[curr]->description.c_str(); if(!(Descr.empty())) { snprintf(nameAndDescription + l, sizeof(nameAndDescription) -l, " - "); ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription, true); unsigned int ch_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(channels[curr]->description, true); //channel name g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + BORDER_LEFT + numwidth + 10, ypos + iheight, width - BORDER_LEFT - SCROLLBAR_WIDTH - numwidth - 10 - ch_name_len, nameAndDescription, color, 0, true); g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + BORDER_LEFT + numwidth + 10 + ch_name_len + 5, ypos + iheight, width - BORDER_LEFT - SCROLLBAR_WIDTH - numwidth - ch_name_len - ch_desc_len - 15, channels[curr]->description, (curr == selected)?COL_MENUCONTENTSELECTED : COL_COLORED_EVENTS_CHANNELLIST, 0, true); } else g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + BORDER_LEFT + numwidth + 10, ypos + iheight, width - BORDER_LEFT - SCROLLBAR_WIDTH - numwidth - ch_name_len - 10, nameAndDescription, color, 0, true); } }