Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/gui/channellist.cpp b/src/gui/channellist.cpp
- index 41e7af0..3dcaa1f 100644
- --- a/src/gui/channellist.cpp
- +++ b/src/gui/channellist.cpp
- @@ -103,6 +103,33 @@ static CComponentsChannelLogoScalable* CChannelLogo = NULL;
- static CComponentsHeader *header = NULL;
- extern bool timeset;
- +enum
- +{
- + ICON_RECORD = 0,
- + ICON_TIMESHIFT,
- + ICON_PIP,
- + ICON_STREAMING,
- + ICON_SCRAMBLED,
- + STATUS_ICONS_MAX
- +};
- +
- +struct status_icons
- +{
- + const char * name;
- + int width;
- + int height;
- + bool active;
- +};
- +
- +static struct status_icons status_icon[]=
- +{
- + {NEUTRINO_ICON_REC , 0, 0, false},
- + {NEUTRINO_ICON_AUTO_SHIFT , 0, 0, false},
- + {NEUTRINO_ICON_PIP , 0, 0, false},
- + {NEUTRINO_ICON_STREAMING , 0, 0, false},
- + {NEUTRINO_ICON_SCRAMBLED , 0, 0, false}
- +};
- +
- CChannelList::CChannelList(const char * const pName, bool phistoryMode, bool _vlist)
- {
- frameBuffer = CFrameBuffer::getInstance();
- @@ -530,6 +557,51 @@ void CChannelList::calcSize()
- else
- pig_height = 0;
- infozone_height = height - theight - pig_height - footerHeight;
- +
- + // reset/init status icons struct
- + for (int i = 0; i < STATUS_ICONS_MAX; i++)
- + {
- + frameBuffer->getIconSize(status_icon[i].name, &status_icon[i].width, &status_icon[i].height);
- + status_icon[i].active = false;
- + }
- +
- + /*
- + Check for any record, timeshift, pip, webtv or scrabled channel in
- + this list.
- +
- + This is to get the same space on the right side of whole list for a
- + smoother view.
- +
- + We have 5 icons in 3 'sections'. From left to right these are:
- +
- + * record or timeshift
- + * pip
- + * streaming or scrabled
- + */
- + status_icons_space = 0;
- + for (uint32_t i = 0; i < (*chanlist).size(); i++)
- + {
- + int space = 0;
- +
- + if (CRecordManager::getInstance()->GetRecordMode((*chanlist)[i]->getChannelID()))
- + {
- + space += max(status_icon[ICON_RECORD].width, status_icon[ICON_TIMESHIFT].width) + OFFSET_INNER_MID;
- + }
- +
- +#ifdef ENABLE_PIP
- + if ((*chanlist)[i]->getChannelID() == CZapit::getInstance()->GetPipChannelID())
- + {
- + space += status_icon[ICON_PIP].width + OFFSET_INNER_MID;
- + }
- +#endif
- +
- + if (!(*chanlist)[i]->getUrl().empty() || (*chanlist)[i]->scrambled)
- + {
- + space += max(status_icon[ICON_STREAMING].width, status_icon[ICON_SCRAMBLED].width) + OFFSET_INNER_MID;
- + }
- +
- + status_icons_space = std::max(status_icons_space, space);
- + }
- }
- bool CChannelList::updateSelection(int newpos)
- @@ -1919,7 +1991,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
- CZapitChannel* chan = (*chanlist)[curr];
- int prg_offset = 0;
- int title_offset = 0;
- - int rec_mode;
- +
- if(g_settings.theme.progressbar_design_channellist != CProgressBar::PB_OFF)
- {
- prg_offset = g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST_NUMBER]->getRenderWidth("00:00");
- @@ -1934,75 +2006,42 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
- else
- p_event = &chan->currentEvent;
- - //record check
- - rec_mode = CRecordManager::getInstance()->GetRecordMode((*chanlist)[curr]->getChannelID());
- + // reset active status icons
- + for (int i = 0; i < STATUS_ICONS_MAX; i++)
- + status_icon[i].active = false;
- +
- + // record check
- + int record_mode = CRecordManager::getInstance()->GetRecordMode((*chanlist)[curr]->getChannelID());
- - //set recording icon
- - const char *record_icon = NULL;
- - if (rec_mode & CRecordManager::RECMODE_REC)
- - record_icon = NEUTRINO_ICON_REC;
- - else if (rec_mode & CRecordManager::RECMODE_TSHIFT)
- - record_icon = NEUTRINO_ICON_AUTO_SHIFT;
- + // activate record/timeshift icon
- + if (record_mode & CRecordManager::RECMODE_REC)
- + status_icon[ICON_RECORD].active = true;
- + else if (record_mode & CRecordManager::RECMODE_TSHIFT)
- + status_icon[ICON_TIMESHIFT].active = true;
- - //set pip icon
- - const char *pip_icon = NULL;
- #ifdef ENABLE_PIP
- + // activate pip icon
- if ((*chanlist)[curr]->getChannelID() == CZapit::getInstance()->GetPipChannelID())
- - pip_icon = NEUTRINO_ICON_PIP;
- + status_icon[ICON_PIP].active = true;
- #endif
- - //set webtv icon
- - const char *webtv_icon = NULL;
- + // activate webtv icon
- if (!chan->getUrl().empty())
- - webtv_icon = NEUTRINO_ICON_STREAMING;
- + status_icon[ICON_STREAMING].active = true;
- - //set scramble icon
- - const char *scramble_icon = NULL;
- + // activate scramble icon
- if (chan->scrambled)
- - scramble_icon = NEUTRINO_ICON_SCRAMBLED;
- + status_icon[ICON_SCRAMBLED].active = true;
- - //calculate and paint right status icons
- - int icon_w = 0;
- - int icon_h = 0;
- - int offset_right = OFFSET_INNER_MID;
- - int icon_x_right = x + width - 15 - offset_right;
- -
- - if (scramble_icon)
- - {
- - frameBuffer->getIconSize(scramble_icon, &icon_w, &icon_h);
- - if (frameBuffer->paintIcon(scramble_icon, icon_x_right - icon_w, ypos, fheight))
- - {
- - offset_right += icon_w + OFFSET_INNER_MID;
- - icon_x_right -= icon_w + OFFSET_INNER_MID;
- - }
- - }
- + // calculate and paint right status icons
- + int icon_x_right = x + width - 15 - OFFSET_INNER_MID;
- - if (webtv_icon)
- + for (int i = STATUS_ICONS_MAX - 1; i >= 0; i--)
- {
- - frameBuffer->getIconSize(webtv_icon, &icon_w, &icon_h);
- - if (frameBuffer->paintIcon(webtv_icon, icon_x_right - icon_w, ypos, fheight))
- + if (status_icon[i].active)
- {
- - offset_right += icon_w + OFFSET_INNER_MID;
- - icon_x_right -= icon_w + OFFSET_INNER_MID;
- - }
- - }
- -
- - if (pip_icon)
- - {
- - frameBuffer->getIconSize(pip_icon, &icon_w, &icon_h);
- - if (frameBuffer->paintIcon(pip_icon, icon_x_right - icon_w, ypos, fheight))
- - {
- - offset_right += icon_w + OFFSET_INNER_MID;
- - icon_x_right -= icon_w + OFFSET_INNER_MID;
- - }
- - }
- -
- - if (record_icon)
- - {
- - frameBuffer->getIconSize(record_icon, &icon_w, &icon_h);
- - if (frameBuffer->paintIcon(record_icon, icon_x_right - icon_w, ypos, fheight))
- - {
- - offset_right += icon_w + OFFSET_INNER_MID;
- + if (frameBuffer->paintIcon(status_icon[i].name, icon_x_right - status_icon[i].width, ypos, fheight))
- + icon_x_right -= status_icon[i].width + OFFSET_INNER_MID;
- }
- }
- @@ -2011,6 +2050,8 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
- paintButtonBar(is_available);
- //channel numbers
- + int icon_w = 0;
- + int icon_h = 0;
- if (curr == selected && move_state == beMoving)
- {
- frameBuffer->getIconSize(NEUTRINO_ICON_BUTTON_YELLOW, &icon_w, &icon_h);
- @@ -2060,7 +2101,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 - 2*OFFSET_INNER_MID - offset_right; // 15 = scrollbar
- + int max_desc_len = width - numwidth - prg_offset - ch_name_len - 15 - 3*OFFSET_INNER_MID - status_icons_space; // 15 = scrollbar
- if (max_desc_len < 0)
- max_desc_len = 0;
- @@ -2093,7 +2134,7 @@ void CChannelList::paintItem(int pos, const bool firstpaint)
- g_Font[SNeutrinoSettings::FONT_TYPE_CHANNELLIST]->RenderString(x + OFFSET_INNER_SMALL + numwidth + OFFSET_INNER_MID + prg_offset, ypos + fheight, width - numwidth - 4*OFFSET_INNER_MID - 15 - 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 - 15 - OFFSET_INNER_MID - status_icons_space - ch_desc_len, ypos + fheight, ch_desc_len, p_event->description, ecolor);
- }
- else {
- // align left
- diff --git a/src/gui/channellist.h b/src/gui/channellist.h
- index f5addbe..4feb097 100644
- --- a/src/gui/channellist.h
- +++ b/src/gui/channellist.h
- @@ -118,6 +118,7 @@ private:
- int infozone_width;
- int infozone_height;
- int previous_channellist_additional;
- + int status_icons_space;
- int paint_events_index;
- sem_t paint_events_sem;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement