Skip to content

Commit

Permalink
Add option for crypto icon in servicelist
Browse files Browse the repository at this point in the history
  • Loading branch information
littlesat committed May 1, 2014
1 parent 358ab64 commit 2b30bd7
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
1 change: 1 addition & 0 deletions data/setup.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<item level="1" text="Alternative numbering mode" description="When enabled, channel numbering will start at '1' for each bouquet.">config.usage.alternative_number_mode</item>
<item level="1" text="Hide number markers" description="When enabled, number markers will be hiden.">config.usage.hide_number_markers</item>
<item level="1" text="Show service type icons" description="Configure if and how service type icons will be shown in the channel selection list.">config.usage.servicetype_icon_mode</item>
<item level="1" text="Show crypto icons" description="Configure if and how crypto icons will be shown in the channel selection list.">config.usage.crypto_icon_mode</item>
<item level="1" text="Show picons in channel list" description="Configure if service picons will be shown in the channel selection list.">config.usage.service_icon_enable</item>
<item level="1" text="Customize channel list cursor behavior" description="Configure the cursor behaviour in the channel selection list. When opening the channel selection list you can keep on the current service or already select up/down and you are able to revert the B+/B- buttons.">config.usage.servicelist_cursor_behavior</item>
<item level="1" text="Change bouquets in quickzap" description="When enabled, continue to the next bouquet when the last channel of the current bouquet is reached while changing channels.">config.usage.quickzap_bouquet_change</item>
Expand Down
5 changes: 5 additions & 0 deletions lib/python/Components/ServiceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ def __init__(self, serviceList):
if pic:
self.l.setPixmap(self.l.picServiceGroup, pic)

pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/icon_crypt.png"))
if pic:
self.l.setPixmap(self.l.picCrypto, pic)

self.root = None
self.mode = self.MODE_NORMAL
self.ItemHeight = 28
Expand Down Expand Up @@ -319,3 +323,4 @@ def setMode(self, mode):
self.l.setElementFont(self.l.celServiceEventProgressbar, self.ServiceInfoFont)
self.l.setHideNumberMarker(config.usage.hide_number_markers.value)
self.l.setServiceTypeIconMode(int(config.usage.servicetype_icon_mode.value))
self.l.setCryptoIconMode(int(config.usage.crypto_icon_mode.value))
2 changes: 2 additions & 0 deletions lib/python/Components/UsageConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ def alternativeNumberModeChange(configElement):

config.usage.servicetype_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
config.usage.servicetype_icon_mode.addNotifier(refreshServiceList)
config.usage.crypto_icon_mode = ConfigSelection(default = "0", choices = [("0", _("None")), ("1", _("Left from servicename")), ("2", _("Right from servicename"))])
config.usage.crypto_icon_mode.addNotifier(refreshServiceList)

config.usage.service_icon_enable = ConfigYesNo(default = False)
config.usage.service_icon_enable.addNotifier(refreshServiceList)
Expand Down
33 changes: 32 additions & 1 deletion lib/service/listboxservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ void eListboxServiceContent::sort()
DEFINE_REF(eListboxServiceContent);

eListboxServiceContent::eListboxServiceContent()
:m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_itemheight(25), m_hide_number_marker(false), m_servicetype_icon_mode(0)
:m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_itemheight(25), m_hide_number_marker(false), m_servicetype_icon_mode(0), m_crypto_icon_mode(0)
{
memset(m_color_set, 0, sizeof(m_color_set));
cursorHome();
Expand Down Expand Up @@ -512,6 +512,11 @@ void eListboxServiceContent::setServiceTypeIconMode(int mode)
m_servicetype_icon_mode = mode;
}

void eListboxServiceContent::setCryptoIconMode(int mode)
{
m_crypto_icon_mode = mode;
}

void eListboxServiceContent::setGetPiconNameFunc(ePyObject func)
{
if (m_GetPiconNameFunc)
Expand Down Expand Up @@ -778,13 +783,39 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
offs = xoffs;
xoffs += pixmap_size.width() + 8;
}
else if (m_crypto_icon_mode == 1 && m_pixmaps[picCrypto])
offs = offs + m_pixmaps[picCrypto]->size().width() + 8;
int correction = (area.height() - pixmap_size.height()) / 2;
area.moveBy(offset);
painter.clip(area);
painter.blit(pixmap, offset+ePoint(area.left() + offs, correction), area, gPainter::BT_ALPHATEST);
painter.clippop();
}
}

//crypto icon stuff
if (m_crypto_icon_mode && m_pixmaps[picCrypto])
{
eSize pixmap_size = m_pixmaps[picCrypto]->size();
eRect area = m_element_position[celServiceInfo];
m_element_position[celServiceInfo].setLeft(area.left() + pixmap_size.width() + 8);
m_element_position[celServiceInfo].setWidth(area.width() - pixmap_size.width() - 8);
int offs = 0;
if (m_crypto_icon_mode == 1)
{
area = m_element_position[celServiceName];
offs = xoffs;
xoffs += pixmap_size.width() + 8;
}
int correction = (area.height() - pixmap_size.height()) / 2;
area.moveBy(offset);
if (service_info->isCrypted(*m_cursor))
{
painter.clip(area);
painter.blit(m_pixmaps[picCrypto], offset+ePoint(area.left() + offs, correction), area, gPainter::BT_ALPHATEST);
painter.clippop();
}
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions lib/service/listboxservice.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class eListboxServiceContent: public virtual iListboxContent
picFolder,
picMarker,
picServiceEventProgressbar,
picCrypto,
picElements
};

Expand All @@ -82,6 +83,8 @@ class eListboxServiceContent: public virtual iListboxContent
void setItemHeight(int height);
void setHideNumberMarker(bool doHide);
void setServiceTypeIconMode(int mode);
void setCryptoIconMode(int mode);

static void setGetPiconNameFunc(SWIG_PYOBJECT(ePyObject) func);

enum {
Expand Down Expand Up @@ -157,6 +160,7 @@ class eListboxServiceContent: public virtual iListboxContent
int m_itemheight;
bool m_hide_number_marker;
int m_servicetype_icon_mode;
int m_crypto_icon_mode;
};

#endif

0 comments on commit 2b30bd7

Please sign in to comment.