diff --git a/src/gui/bedit/bouqueteditor_bouquets.cpp b/src/gui/bedit/bouqueteditor_bouquets.cpp index 0109fd340..fc2eb5994 100644 --- a/src/gui/bedit/bouqueteditor_bouquets.cpp +++ b/src/gui/bedit/bouqueteditor_bouquets.cpp @@ -66,7 +66,7 @@ CBEBouquetWidget::CBEBouquetWidget() void CBEBouquetWidget::paintItem(int pos) { - int ypos = y+ theight+0 + pos*iheight; + int ypos = y + theight + pos*iheight; unsigned int current = liststart + pos; bool i_selected = current == selected; @@ -92,8 +92,8 @@ void CBEBouquetWidget::paintItem(int pos) } if (i_radius) - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); if (current < Bouquets->size()) { if ((i_selected) && (state == beMoving)) @@ -125,17 +125,10 @@ void CBEBouquetWidget::paint() paintItem(count); } - int ypos = y+ theight; - int sb = iheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((Bouquets->size()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - - //scrollbar - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Bouquets->size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page); } void CBEBouquetWidget::paintHead() diff --git a/src/gui/bedit/bouqueteditor_channels.cpp b/src/gui/bedit/bouqueteditor_channels.cpp index 5be657afd..1600a59ab 100644 --- a/src/gui/bedit/bouqueteditor_channels.cpp +++ b/src/gui/bedit/bouqueteditor_channels.cpp @@ -121,8 +121,8 @@ void CBEChannelWidget::paintItem(int pos) } if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width- 15, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); if ((current == selected) && (state == beMoving)) { frameBuffer->paintIcon(NEUTRINO_ICON_BUTTON_YELLOW, x + OFFSET_INNER_MID, ypos, iheight); @@ -131,13 +131,12 @@ void CBEChannelWidget::paintItem(int pos) if ((*Channels)[current]->bLocked) { frameBuffer->paintIcon(NEUTRINO_ICON_LOCK, x + OFFSET_INNER_MID + iconoffset, ypos, iheight); } - //g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x+ 5+ numwidth+ 10, ypos+ fheight, width- numwidth- 20- 15, (*Channels)[current]->getName(), color); //FIXME numwidth ? we not show chan numbers g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, (*Channels)[current]->getName(), color); if((*Channels)[current]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!(*Channels)[current]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } @@ -159,19 +158,10 @@ void CBEChannelWidget::paint() paintItem(count); } - int ypos = y+ theight; - int sb = iheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((Channels->size()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - int sbh= (sb- 4)/ sbc; - - if (sbh == 0) - return; - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * sbh, 11, sbh, COL_SCROLLBAR_ACTIVE_PLUS_0); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, Channels->size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, iheight*listmaxshow, total_pages, current_page); } void CBEChannelWidget::paintHead() diff --git a/src/gui/bedit/bouqueteditor_chanselect.cpp b/src/gui/bedit/bouqueteditor_chanselect.cpp index c80a182b2..87227e8df 100644 --- a/src/gui/bedit/bouqueteditor_chanselect.cpp +++ b/src/gui/bedit/bouqueteditor_chanselect.cpp @@ -129,8 +129,8 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec } if (i_radius) - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x,ypos, width- 15, iheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, iheight, bgcolor, i_radius); if(itemNr < getItemCount()) { @@ -141,9 +141,9 @@ void CBEChannelSelectWidget::paintItem(uint32_t itemNr, int paintNr, bool pselec g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 2*OFFSET_INNER_MID + 2*iconoffset, ypos + iheight - (iheight-fheight)/2, width - 3*OFFSET_INNER_MID - 2*iconoffset, Channels[itemNr]->getName(), color); if(Channels[itemNr]->scrambled) - frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_SCRAMBLED, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); else if (!Channels[itemNr]->getUrl().empty()) - frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - 15 - OFFSET_INNER_MID - iconoffset, ypos, fheight); + frameBuffer->paintIcon(NEUTRINO_ICON_STREAMING, x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - iconoffset, ypos, fheight); } } diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp index f3bdecdf7..015da7f1a 100644 --- a/src/gui/channellist.cpp +++ b/src/gui/channellist.cpp @@ -1882,7 +1882,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) color = COL_MENUCONTENTINACTIVE_TEXT; if (!firstpaint || i_selected || getKey(curr) == CNeutrinoApp::getInstance()->channelList->getActiveChannelNumber()) - frameBuffer->paintBoxRel(x,ypos, width- 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, fheight, bgcolor, i_radius); if(curr < (*chanlist).size()) { char nameAndDescription[255]; @@ -1936,7 +1936,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) int icon_w = 0; int icon_h = 0; int offset_right = OFFSET_INNER_MID; - int icon_x_right = x + width - 15 - offset_right; + int icon_x_right = x + width - SCROLLBAR_WIDTH - offset_right; if (scramble_icon) { @@ -2030,7 +2030,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) unsigned int ch_name_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->getRenderWidth(nameAndDescription); unsigned int ch_desc_len = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->getRenderWidth(p_event->description); - int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 3*OFFSET_INNER_MID - offset_right; // 15 = scrollbar + int max_desc_len = width - numwidth - prg_offset - ch_name_len - SCROLLBAR_WIDTH - 3*OFFSET_INNER_MID - offset_right; if (max_desc_len < 0) max_desc_len = 0; @@ -2044,7 +2044,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) struct tm *pStartZeit = localtime(&p_event->startTime); snprintf(tmp, sizeof(tmp), "%02d:%02d", pStartZeit->tm_hour, pStartZeit->tm_min); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 15 - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID, ypos + fheight, width - numwidth - SCROLLBAR_WIDTH - prg_offset - 2*OFFSET_INNER_MID, tmp, ecolor, fheight); } else { @@ -2061,11 +2061,11 @@ void CChannelList::paintItem(int pos, const bool firstpaint) } } - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - SCROLLBAR_WIDTH - prg_offset, nameAndDescription, color); if (g_settings.channellist_epgtext_align_right) { // align right - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - 15 - offset_right - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_DESCR]->RenderString(x + width - SCROLLBAR_WIDTH - offset_right - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor); } else { @@ -2081,7 +2081,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint) pb.paint(); } //name - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - prg_offset, nameAndDescription, color); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID + numwidth + OFFSET_INNER_MID + prg_offset + OFFSET_INNER_MID, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - SCROLLBAR_WIDTH - prg_offset, nameAndDescription, color); } if (!firstpaint && curr == selected) updateVfd(); @@ -2213,16 +2213,11 @@ void CChannelList::paintBody() for(unsigned int count = 0; count < listmaxshow; count++) paintItem(count, true); - const int ypos = y+ theight; - const int sb = height - theight - footerHeight; // paint scrollbar over full height of main box - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int listmaxshow_tmp = listmaxshow ? listmaxshow : 1;//avoid division by zero - int sbc= (((*chanlist).size()- 1)/ listmaxshow_tmp)+ 1; - const int sbs= (selected/listmaxshow_tmp); - if (sbc < 1) - sbc = 1; + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, (*chanlist).size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, height - theight - footerHeight, total_pages, current_page); - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); showChannelLogo(); if ((*chanlist).empty()) paintButtonBar(false); diff --git a/src/gui/components/cc_draw.cpp b/src/gui/components/cc_draw.cpp index c28144444..39ca711d8 100644 --- a/src/gui/components/cc_draw.cpp +++ b/src/gui/components/cc_draw.cpp @@ -729,14 +729,21 @@ void CCDraw::hide() //erase or paint over rendered objects void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const int& fblayer_type /*fbdata_type*/) { + int layers = fblayer_type; + + if (fblayer_type & ~CC_FBDATA_TYPES) + layers = CC_FBDATA_TYPES; + for(size_t i =0; i< v_fbdata.size() ;i++){ - if (fblayer_type == CC_FBDATA_TYPES || v_fbdata[i].fbdata_type & fblayer_type){ -#if 0 - if (bg_color != COL_BACKGROUND_PLUS_0) -#endif - int r = v_fbdata[i].r; - if (corner_radius > -1) - r = corner_radius; + if (v_fbdata[i].fbdata_type & layers){ + + int r = 0; + + if (corner_radius > -1){ + r = v_fbdata[i].r; + if (corner_radius != v_fbdata[i].r) + r = corner_radius; + } if (v_fbdata[i].dx > 0 && v_fbdata[i].dy > 0){ frameBuffer->paintBoxRel(v_fbdata[i].x, @@ -745,31 +752,28 @@ void CCDraw::kill(const fb_pixel_t& bg_color, const int& corner_radius, const in v_fbdata[i].dy, bg_color, r, - corner_type); + v_fbdata[i].rtype); + + if (v_fbdata[i].fbdata_type & CC_FBDATA_TYPE_FRAME){ + if (v_fbdata[i].frame_thickness) + frameBuffer->paintBoxFrame(v_fbdata[i].x, + v_fbdata[i].y, + v_fbdata[i].dx, + v_fbdata[i].dy, + v_fbdata[i].frame_thickness, + bg_color, + v_fbdata[i].r, + v_fbdata[i].rtype); + } }else dprintf(DEBUG_DEBUG, "\033[33m[CCDraw][%s - %d], WARNING! render with bad dimensions [dx = %d dy = %d]\033[0m\n", __func__, __LINE__, v_fbdata[i].dx, v_fbdata[i].dy ); - if (v_fbdata[i].frame_thickness) - frameBuffer->paintBoxFrame(v_fbdata[i].x, - v_fbdata[i].y, - v_fbdata[i].dx, - v_fbdata[i].dy, - v_fbdata[i].frame_thickness, - bg_color, - r, - corner_type); v_fbdata[i].is_painted = false; -#if 0 - else - frameBuffer->paintBackgroundBoxRel(v_fbdata[i].x, v_fbdata[i].y, v_fbdata[i].dx, v_fbdata[i].dy); -#endif } } - if (fblayer_type == CC_FBDATA_TYPES){ - firstPaint = true; - is_painted = false; - } + firstPaint = true; + is_painted = false; } void CCDraw::killShadow(const fb_pixel_t& bg_color, const int& corner_radius) diff --git a/src/gui/components/cc_draw.h b/src/gui/components/cc_draw.h index 0f23e7eb4..ab7400ca8 100644 --- a/src/gui/components/cc_draw.h +++ b/src/gui/components/cc_draw.h @@ -396,7 +396,7 @@ class CCDraw : public COSDFader, public CComponentsSignals * Shadow paint must be reworked, because dimensions of shadow containes not the real defined size. Parts of item are killed too. * */ - virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES); + virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = ~CC_FBDATA_TYPES); /**Erase shadow around rendered item. * This is similar with the kill() member, but shadow will be handled only. diff --git a/src/gui/components/cc_frm_header.cpp b/src/gui/components/cc_frm_header.cpp index 75b14da0b..080b4cf3d 100644 --- a/src/gui/components/cc_frm_header.cpp +++ b/src/gui/components/cc_frm_header.cpp @@ -258,7 +258,7 @@ void CComponentsHeader::initIcon() //set corner mode of icon item int cc_icon_corner_type = CORNER_LEFT; - if (corner_type == CORNER_TOP_LEFT || corner_type == CORNER_TOP) + if (corner_type & CORNER_TOP_LEFT || corner_type & CORNER_TOP) cc_icon_corner_type = CORNER_TOP_LEFT; cch_icon_obj->setCorner(corner_rad-fr_thickness, cc_icon_corner_type); diff --git a/src/gui/components/cc_frm_header.h b/src/gui/components/cc_frm_header.h index 29f8b8315..e1dd05f66 100644 --- a/src/gui/components/cc_frm_header.h +++ b/src/gui/components/cc_frm_header.h @@ -315,7 +315,7 @@ class CComponentsHeader : public CComponentsForm, public CCTextScreen, CCHeaderT ///hides item, arg: no_restore see hideCCItem() void hide(){disableClock(); CComponentsForm::hide();} ///erase current screen without restore of background, it's similar to paintBackgroundBoxRel() from CFrameBuffer - void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = CC_FBDATA_TYPES, bool disable_clock = true); + void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, const int& corner_radius = -1, const int& fblayer_type = ~CC_FBDATA_TYPES, bool disable_clock = true); ///set color gradient on/off, returns true if gradient mode was changed virtual bool enableColBodyGradient(const int& enable_mode, const fb_pixel_t& sec_color = 255 /*=COL_BACKGROUND*/, const int& direction = -1); diff --git a/src/gui/components/cc_item.h b/src/gui/components/cc_item.h index 9d633ad62..d168c3832 100644 --- a/src/gui/components/cc_item.h +++ b/src/gui/components/cc_item.h @@ -100,7 +100,7 @@ class CComponentsItem : public CComponents * gui/color.h * driver/framebuffer.h */ - virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = CC_FBDATA_TYPES); + virtual void kill(const fb_pixel_t& bg_color = COL_BACKGROUND_PLUS_0, bool ignore_parent = false, const int& fblayer_type = ~CC_FBDATA_TYPES); ///get the current item type, see attribute cc_item_type above virtual int getItemType(); diff --git a/src/gui/components/cc_types.h b/src/gui/components/cc_types.h index e24f5cc03..d73bd1549 100644 --- a/src/gui/components/cc_types.h +++ b/src/gui/components/cc_types.h @@ -100,7 +100,7 @@ typedef enum CC_FBDATA_TYPE_FRAME = 8, CC_FBDATA_TYPE_BACKGROUND = 16, - CC_FBDATA_TYPES = 32 + CC_FBDATA_TYPES = CC_FBDATA_TYPE_BOX | CC_FBDATA_TYPE_SHADOW_BOX | CC_FBDATA_TYPE_FRAME }FBDATA_TYPES; //fb color gradient types diff --git a/src/gui/epgview.cpp b/src/gui/epgview.cpp index e211dd68c..159be07cb 100644 --- a/src/gui/epgview.cpp +++ b/src/gui/epgview.cpp @@ -199,7 +199,7 @@ void CEpgData::processTextToArray(std::string text, int screening, bool has_cove // check the wordwidth - add to this line if size ok int aktWordWidth = g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(aktWord); - if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - 15 - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0))) + if ((aktWordWidth+aktWidth)<(ox - 2*OFFSET_INNER_MID - SCROLLBAR_WIDTH - (has_cover ? ((ox/4)+OFFSET_INNER_MID) : 0))) {//space ok, add aktWidth += aktWordWidth; aktLine += aktWord; @@ -270,12 +270,12 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) max_wday_w = std::max(max_wday_w, g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->getRenderWidth(std::string(g_Locale->getText(CLocaleManager::getWeekday(i))) + " ")); } int offs = fullClear ? 0 : cover_offset; - frameBuffer->paintBoxRel(sx+offs, y, ox-15-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box + frameBuffer->paintBoxRel(sx+offs, y, ox-SCROLLBAR_WIDTH-offs, sb, COL_MENUCONTENT_PLUS_0); // background of the text box if (has_cover) { if (!g_PicViewer->DisplayImage(cover ,sx+OFFSET_INNER_MID ,y+OFFSET_INNER_MID+((sb-cover_height)/2), cover_width, cover_height, CFrameBuffer::TM_NONE)) { cover_offset = 0; - frameBuffer->paintBoxRel(sx, y, ox-15, sb, COL_MENUCONTENT_PLUS_0); // background of the text box + frameBuffer->paintBoxRel(sx, y, ox-SCROLLBAR_WIDTH, sb, COL_MENUCONTENT_PLUS_0); // background of the text box } } int logo_offset = 0; @@ -312,7 +312,7 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) offset += digi; break; } - g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox- 15- 15, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT); + g_Font[SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+offset, y+medlineheight, ox - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - offset, epgText[i].first.substr(pos1, pos2 - pos1), (epgText[i].second==2)? COL_MENUCONTENTINACTIVE_TEXT: COL_MENUCONTENT_TEXT); count++; pos1 = epgText[i].first.find_first_not_of(tok, pos2); pos2 = epgText[i].first.find_first_of(tok, pos1); @@ -321,17 +321,14 @@ void CEpgData::showText(int startPos, int ypos, bool has_cover, bool fullClear) count = 0; } else{ - g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox-15-15-cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); + g_Font[( i< info1_lines ) ?SNeutrinoSettings::FONT_TYPE_EPG_INFO1:SNeutrinoSettings::FONT_TYPE_EPG_INFO2]->RenderString(sx+OFFSET_INNER_MID+cover_offset, y+medlineheight, ox - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - cover_offset, epgText[i].first, COL_MENUCONTENT_TEXT); } } - - int sbc = ((textSize - 1)/ medlinecount) + 1; - int sbs= (startPos+ 1)/ medlinecount; - if (sbc < 1) - sbc = 1; - frameBuffer->paintBoxRel(sx+ ox- 15, ypos, 15, sb, COL_SCROLLBAR_PLUS_0); // scrollbar bg - frameBuffer->paintBoxRel(sx+ ox- 13, ypos+ 2+ sbs*(sb-4)/sbc , 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); // scrollbar + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, textSize, medlinecount, startPos + 1); + paintScrollBar(sx + ox - SCROLLBAR_WIDTH, ypos, SCROLLBAR_WIDTH, sb, total_pages, current_page); } #define GENRE_MOVIE_COUNT 9 @@ -1424,9 +1421,9 @@ int CEpgData::FollowScreenings (const t_channel_id /*channel_id*/, const std::st void CEpgData::showProgressBar() { - int w = 104; + int w = ox/10; int x = sx + (ox - w)/2; - int h = botboxheight - 12; + int h = botboxheight - 2*OFFSET_INNER_SMALL; int y = sy + oy - botboxheight + (botboxheight - h)/2; if (!pb){ pb = new CProgressBar(x, y, w, h); diff --git a/src/gui/eventlist.cpp b/src/gui/eventlist.cpp index 9f575f516..2bcd1094b 100644 --- a/src/gui/eventlist.cpp +++ b/src/gui/eventlist.cpp @@ -753,8 +753,8 @@ void CEventList::paintItem(unsigned int pos, t_channel_id channel_idI) i_radius = RADIUS_LARGE; if (i_radius) - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, COL_MENUCONTENT_PLUS_0); - frameBuffer->paintBoxRel(x, ypos, width- 15, fheight, bgcolor, i_radius); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, COL_MENUCONTENT_PLUS_0); + frameBuffer->paintBoxRel(x, ypos, width - SCROLLBAR_WIDTH, fheight, bgcolor, i_radius); if(currposgetText(LOCALE_WORD_IN), seit, unit_short_minute); int w = g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->getRenderWidth(beginnt); - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - 15 - 2*OFFSET_INNER_MID - fwidth2 - w, ypos + OFFSET_INNER_MIN + fheight2, w, beginnt, color); + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID - fwidth2 - w, ypos + OFFSET_INNER_MIN + fheight2, w, beginnt, color); } - g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - 15 - OFFSET_INNER_MID - fwidth2, ypos + OFFSET_INNER_MIN + fheight2, fwidth2, duration_str, color); + g_Font[SNeutrinoSettings::FONT_TYPE_EVENTLIST_ITEMSMALL]->RenderString(x + width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - fwidth2, ypos + OFFSET_INNER_MIN + fheight2, fwidth2, duration_str, color); // 2nd line // set status icons @@ -967,17 +967,10 @@ void CEventList::paint(t_channel_id channel_id) // paint content for right box paintDescription(selected); - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((evtlist.size()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); - + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, evtlist.size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, fheight*listmaxshow, total_pages, current_page); } void CEventList::showFunctionBar(t_channel_id channel_id) diff --git a/src/gui/timerlist.cpp b/src/gui/timerlist.cpp index de18ad296..816bc5116 100644 --- a/src/gui/timerlist.cpp +++ b/src/gui/timerlist.cpp @@ -1135,7 +1135,7 @@ void CTimerList::paintItem(int pos) int real_width=width; if (timerlist.size() > listmaxshow) { - real_width-=15; //scrollbar + real_width -= SCROLLBAR_WIDTH; //scrollbar } unsigned int currpos = liststart + pos; @@ -1426,15 +1426,10 @@ void CTimerList::paint() if (timerlist.size()>listmaxshow) { - int ypos = y+ theight; - int sb = 2*fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int tmp_max = listmaxshow; - if (!tmp_max) - tmp_max = 1; - int sbc = ((timerlist.size()- 1)/ tmp_max)+ 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ page_nr * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_SMALL); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, timerlist.size(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, 2*fheight*listmaxshow, total_pages, current_page); } paintFoot(); diff --git a/src/gui/upnpbrowser.cpp b/src/gui/upnpbrowser.cpp index 7458db5f7..a02596374 100644 --- a/src/gui/upnpbrowser.cpp +++ b/src/gui/upnpbrowser.cpp @@ -966,8 +966,8 @@ void CUpnpBrowserGui::paintDevice(unsigned int _pos) } if (i_radius) - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, COL_MENUCONTENT_PLUS_0); - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, bgcolor, i_radius); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, bgcolor, i_radius); if (pos >= m_devices.size()) return; @@ -976,8 +976,8 @@ void CUpnpBrowserGui::paintDevice(unsigned int _pos) std::string name = m_devices[pos].friendlyname; int w = g_Font[font_item]->getRenderWidth(name); - g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID, ypos + m_item_height, m_width - 15 - OFFSET_INNER_MID - w, num, color, m_item_height); - g_Font[font_item]->RenderString(m_x + m_width - 15 - OFFSET_INNER_MID - w, ypos + m_item_height, w, name, color, m_item_height); + g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID, ypos + m_item_height, m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, num, color, m_item_height); + g_Font[font_item]->RenderString(m_x + m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, ypos + m_item_height, w, name, color, m_item_height); } void CUpnpBrowserGui::paintDevices() @@ -999,18 +999,14 @@ void CUpnpBrowserGui::paintDevices() for (unsigned int count=0; countpaintBoxRel(m_x + m_width - 15, m_item_y, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int tmp_max = m_listmaxshow; - if(!tmp_max) - tmp_max = 1; - int sbc = ((m_devices.size() - 1) / tmp_max) + 1; - int sbs = ((m_selecteddevice) / tmp_max); - - m_frameBuffer->paintBoxRel(m_x + m_width - 13, m_item_y + 2 + sbs*(sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + // scrollbar + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, m_devices.size(), m_listmaxshow, m_selecteddevice); + paintScrollBar(m_x + m_width - SCROLLBAR_WIDTH, m_item_y, SCROLLBAR_WIDTH, m_item_height*m_listmaxshow, total_pages, current_page); //shadow - m_frameBuffer->paintBoxRel(m_x + m_width, m_item_y + OFFSET_SHADOW, OFFSET_SHADOW, sb, COL_SHADOW_PLUS_0); + m_frameBuffer->paintBoxRel(m_x + m_width, m_item_y + OFFSET_SHADOW, OFFSET_SHADOW, m_item_height*m_listmaxshow, COL_SHADOW_PLUS_0); // Foot footer.setCorner(RADIUS_LARGE, CORNER_BOTTOM); @@ -1035,8 +1031,8 @@ void CUpnpBrowserGui::paintItem(std::vector *entries, unsigned int po i_radius = RADIUS_LARGE; if (i_radius) - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, COL_MENUCONTENT_PLUS_0); - m_frameBuffer->paintBoxRel(m_x, ypos, m_width - 15, m_item_height, bgcolor, i_radius); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, COL_MENUCONTENT_PLUS_0); + m_frameBuffer->paintBoxRel(m_x, ypos, m_width - SCROLLBAR_WIDTH, m_item_height, bgcolor, i_radius); if (pos >= (*entries).size()) return; @@ -1088,8 +1084,8 @@ void CUpnpBrowserGui::paintItem(std::vector *entries, unsigned int po icon_o = icon_w + OFFSET_INNER_MID; m_frameBuffer->paintIcon(fileicon, m_x + OFFSET_INNER_MID, ypos + (m_item_height - icon_h)/2); } - g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID + icon_o, ypos + m_item_height, m_width - 15 - OFFSET_INNER_MID - w, name, color, m_item_height); - g_Font[font_item]->RenderString(m_x + m_width - 15 - OFFSET_INNER_MID - w, ypos + m_item_height, w, info, color, m_item_height); + g_Font[font_item]->RenderString(m_x + OFFSET_INNER_MID + icon_o, ypos + m_item_height, m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, name, color, m_item_height); + g_Font[font_item]->RenderString(m_x + m_width - SCROLLBAR_WIDTH - OFFSET_INNER_MID - w, ypos + m_item_height, w, info, color, m_item_height); } void CUpnpBrowserGui::paintItemInfo(UPnPEntry *entry) @@ -1178,16 +1174,11 @@ void CUpnpBrowserGui::paintItems(std::vector *entry, unsigned int sel for (unsigned int count=0; countpaintBoxRel(m_x + m_width - 15, m_item_y, 15, sb, COL_SCROLLBAR_PLUS_0); - unsigned int tmp = m_listmaxshow ? m_listmaxshow : 1;//avoid division by zero - int sbc = ((max + offset - 1) / tmp) + 1; - int sbs = ((selected + offset) / tmp); - - int sbh = 0; - if ((sbc > 0) && (sbc > sb-4)) - sbh = 2; - m_frameBuffer->paintBoxRel(m_x + m_width - 13, m_item_y + 2 + sbs*((sb-4)/sbc+sbh), 11, (sb-4)/sbc + sbh, COL_SCROLLBAR_ACTIVE_PLUS_0); + //scrollbar + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, max + offset, m_listmaxshow, selected + offset); + paintScrollBar(m_x + m_width - SCROLLBAR_WIDTH, m_item_y, SCROLLBAR_WIDTH, m_item_height*m_listmaxshow, total_pages, current_page); // Foot buttons size_t numbuttons = sizeof(BrowseButtons)/sizeof(BrowseButtons[0]); diff --git a/src/gui/widget/listbox.cpp b/src/gui/widget/listbox.cpp index bb3a0a259..ad7c26fb9 100644 --- a/src/gui/widget/listbox.cpp +++ b/src/gui/widget/listbox.cpp @@ -67,16 +67,10 @@ void CListBox::paint() paintItem(count); } - int ypos = y+ theight; - int sb = fheight* listmaxshow; - frameBuffer->paintBoxRel(x+ width- 15,ypos, 15, sb, COL_SCROLLBAR_PLUS_0); - - int sbc= ((getItemCount()- 1)/ listmaxshow)+ 1; - int sbs= (selected/listmaxshow); - if (sbc < 1) - sbc = 1; - - frameBuffer->paintBoxRel(x+ width- 13, ypos+ 2+ sbs * (sb-4)/sbc, 11, (sb-4)/sbc, COL_SCROLLBAR_ACTIVE_PLUS_0); + int total_pages; + int current_page; + getScrollBarData(&total_pages, ¤t_page, getItemCount(), listmaxshow, selected); + paintScrollBar(x + width - SCROLLBAR_WIDTH, y + theight, SCROLLBAR_WIDTH, fheight*listmaxshow, total_pages, current_page); } void CListBox::paintHead() @@ -109,8 +103,9 @@ void CListBox::hide() frameBuffer->paintBackgroundBoxRel(x,y, width,height+ButtonHeight); } -unsigned int CListBox::getItemCount() +unsigned int CListBox::getItemCount() { + // WTF? Why a fixed value? return 10; } @@ -128,8 +123,8 @@ void CListBox::paintItem(unsigned int /*itemNr*/, int paintNr, bool pselected) getItemColors(color, bgcolor, pselected); - frameBuffer->paintBoxRel(x,ypos, width- 15, getItemHeight(), bgcolor); - g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + 10, ypos+ fheight, width-20, "demo", color); + frameBuffer->paintBoxRel(x,ypos, width - SCROLLBAR_WIDTH, getItemHeight(), bgcolor); + g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_MID, ypos + fheight, width - SCROLLBAR_WIDTH - 2*OFFSET_INNER_MID, "demo", color); } void CListBox::updateSelection(unsigned int newpos) diff --git a/src/gui/widget/listframe.cpp b/src/gui/widget/listframe.cpp index 33f76ea43..2ed9085ec 100644 --- a/src/gui/widget/listframe.cpp +++ b/src/gui/widget/listframe.cpp @@ -54,11 +54,10 @@ #include #include #include "listframe.h" +#include #include #include -#define SCROLL_FRAME_WIDTH 10 - #define MAX_WINDOW_WIDTH (frameBuffer->getScreenWidth() - 40) #define MAX_WINDOW_HEIGHT (frameBuffer->getScreenHeight() - 40) @@ -270,9 +269,9 @@ void CListFrame::initFramesRel(void) if(m_nMode & SCROLL) { - m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLL_FRAME_WIDTH; + m_cFrameScrollRel.iX = m_cFrame.iWidth - SCROLLBAR_WIDTH; m_cFrameScrollRel.iY = m_cFrameTitleRel.iHeight; - m_cFrameScrollRel.iWidth = SCROLL_FRAME_WIDTH; + m_cFrameScrollRel.iWidth = SCROLLBAR_WIDTH; m_cFrameScrollRel.iHeight = m_cFrameHeaderListRel.iHeight + m_cFrameListRel.iHeight - m_nBgRadius; } else @@ -384,13 +383,9 @@ void CListFrame::refreshScroll(void) if (m_nNrOfPages > 1) { - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, - m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, COL_SCROLLBAR_PLUS_0, RADIUS_MIN); - unsigned int marker_size = (m_cFrameScrollRel.iHeight - 2*OFFSET_INNER_MIN) / m_nNrOfPages; - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + OFFSET_INNER_MIN+m_cFrame.iX, - m_cFrameScrollRel.iY + OFFSET_INNER_MIN + m_nCurrentPage * marker_size +m_cFrame.iY, - m_cFrameScrollRel.iWidth - (2*OFFSET_INNER_MIN), - marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_MIN); + paintScrollBar(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, + m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, + m_nNrOfPages, m_nCurrentPage); } } diff --git a/src/gui/widget/textbox.cpp b/src/gui/widget/textbox.cpp index 7a9e326b1..587c237d6 100644 --- a/src/gui/widget/textbox.cpp +++ b/src/gui/widget/textbox.cpp @@ -61,6 +61,7 @@ #include #include #include "textbox.h" +#include #include #include #ifdef VISUAL_DEBUG @@ -525,14 +526,9 @@ void CTextBox::refreshScroll(void) if (m_nNrOfPages > 1) { - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, + paintScrollBar(m_cFrameScrollRel.iX+m_cFrame.iX, m_cFrameScrollRel.iY+m_cFrame.iY, m_cFrameScrollRel.iWidth, m_cFrameScrollRel.iHeight, - COL_SCROLLBAR_PLUS_0, RADIUS_MIN); - unsigned int marker_size = (m_cFrameScrollRel.iHeight - 2*SCROLL_MARKER_BORDER) / m_nNrOfPages; - frameBuffer->paintBoxRel(m_cFrameScrollRel.iX + SCROLL_MARKER_BORDER + m_cFrame.iX, - m_cFrameScrollRel.iY + SCROLL_MARKER_BORDER + m_nCurrentPage * marker_size + m_cFrame.iY, - m_cFrameScrollRel.iWidth - 2*SCROLL_MARKER_BORDER, - marker_size, COL_SCROLLBAR_ACTIVE_PLUS_0, RADIUS_MIN); + m_nNrOfPages, m_nCurrentPage); m_has_scrolled = true; } else diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index edff6f910..3f0098aad 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -211,6 +211,7 @@ const CControlAPI::TyCgiCall CControlAPI::yCgiCallList[]= {"crypt", &CControlAPI::CryptCGI, "text/plain"}, // timer {"timer", &CControlAPI::TimerCGI, "text/plain"}, + {"sendalltimers", &CControlAPI::TimerSendCGI, "text/plain"}, // bouquet editing {"setbouquet", &CControlAPI::setBouquetCGI, "text/plain"}, {"savebouquet", &CControlAPI::saveBouquetCGI, "text/plain"}, @@ -337,7 +338,34 @@ void CControlAPI::TimerCGI(CyhookHandler *hh) hh->SendError(); } +void CControlAPI::TimerSendCGI(CyhookHandler *hh) +{ + hh->outStart(); + + if (NeutrinoAPI->Timerd->isTimerdAvailable()) + { + if (!hh->ParamList.empty()) + { + bool force = (hh->ParamList["force"] == "1") || (hh->ParamList["force"] == "true"); + if(!hh->ParamList["ip"].empty()) + { + NeutrinoAPI->SendAllTimers(hh->ParamList["ip"],force); + hh->SendOk(); + } + else if(!hh->ParamList["name"].empty()) + { + NeutrinoAPI->SendAllTimers(NeutrinoAPI->GetRemoteBoxIP(decodeString(hh->ParamList["name"])),force); + hh->SendOk(); + } + else + hh->SendError(); + } + } + else + hh->SendError(); +} //----------------------------------------------------------------------------- + void CControlAPI::SetModeCGI(CyhookHandler *hh) { if (!(hh->ParamList.empty())) diff --git a/src/nhttpd/tuxboxapi/controlapi.h b/src/nhttpd/tuxboxapi/controlapi.h index 36873b8fc..b266e85d4 100644 --- a/src/nhttpd/tuxboxapi/controlapi.h +++ b/src/nhttpd/tuxboxapi/controlapi.h @@ -73,6 +73,7 @@ private: // CGI functions for ExecuteCGI void TimerCGI(CyhookHandler *hh); + void TimerSendCGI(CyhookHandler *hh); void SetModeCGI(CyhookHandler *hh); void GetModeCGI(CyhookHandler *hh); void ExecCGI(CyhookHandler *hh); diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.cpp b/src/nhttpd/tuxboxapi/neutrinoapi.cpp index 4ec8ca05b..20b3f34f9 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.cpp +++ b/src/nhttpd/tuxboxapi/neutrinoapi.cpp @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include #include @@ -530,3 +532,53 @@ std::string CNeutrinoAPI::getLogoFile(t_channel_id channelId) return logoString; return ""; } + +std::string CNeutrinoAPI::GetRemoteBoxIP(std::string _rbname) +{ + std::string c_url = ""; + for (std::vector::iterator it = g_settings.timer_remotebox_ip.begin(); it != g_settings.timer_remotebox_ip.end(); ++it) + { + if (it->rbname == _rbname) + { + if (!it->user.empty() && !it->pass.empty()) + c_url += it->user + ":" + it->pass +"@"; + c_url += it->rbaddress; + c_url += ":" + to_string(it->port); + break; + } + } + return c_url; +} + +void CNeutrinoAPI::SendAllTimers(std::string url, bool force) +{ + CTimerd::TimerList timerlist; + timerlist.clear(); + Timerd->getTimerList(timerlist); + sort(timerlist.begin(), timerlist.end()); + + int pre,post; + Timerd->getRecordingSafety(pre,post); + CHTTPTool httpTool; + std::string r_url; + + for(CTimerd::TimerList::iterator timer = timerlist.begin(); timer != timerlist.end(); ++timer) + { + if (timer->eventType == CTimerd::TIMER_RECORD) { + r_url = "http://"; + r_url += url; + r_url += "/control/timer?action=new"; + r_url += "&alarm=" + to_string((int)timer->alarmTime + pre); + r_url += "&stop=" + to_string((int)timer->stopTime - post); + r_url += "&announce=" + to_string((int)timer->announceTime + pre); + r_url += "&channel_id=" + string_printf(PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer->channel_id); + r_url += "&aj=on"; + r_url += "&rs=on"; + + r_url = httpTool.downloadString(r_url, -1, 300); + + if ((r_url=="ok") || force) + Timerd->removeTimerEvent(timer->eventID); + } + } +} diff --git a/src/nhttpd/tuxboxapi/neutrinoapi.h b/src/nhttpd/tuxboxapi/neutrinoapi.h index 5936e194b..77e51baa0 100644 --- a/src/nhttpd/tuxboxapi/neutrinoapi.h +++ b/src/nhttpd/tuxboxapi/neutrinoapi.h @@ -84,6 +84,8 @@ public: std::string getAudioInfoAsString(void); std::string getCryptInfoAsString(void); std::string getLogoFile(t_channel_id channelId); + std::string GetRemoteBoxIP(std::string _rbname); + void SendAllTimers(std::string url, bool force = false); public: CNeutrinoAPI(); ~CNeutrinoAPI(void);