Merge branch 'bug_486_add_service_event_progress_to_servicelist'
authorghost <andreas.monzner@multimedia-labs.de>
Wed, 6 Oct 2010 09:48:59 +0000 (11:48 +0200)
committerghost <andreas.monzner@multimedia-labs.de>
Wed, 6 Oct 2010 09:48:59 +0000 (11:48 +0200)
data/setup.xml
data/skin_default/Makefile.am
data/skin_default/celserviceeventprogressbar.png [new file with mode: 0644]
lib/python/Components/ServiceList.py [changed mode: 0755->0644]
lib/python/Components/UsageConfig.py
lib/service/listboxservice.cpp
lib/service/listboxservice.h

index 233382543d3a9d61a758e4f99a8e2b17f917a5ba..b920edd669d6a7d958f7f7180a7bd770f8369119 100755 (executable)
@@ -33,6 +33,7 @@
                        <item level="1" text="Action on long powerbutton press">config.usage.on_long_powerpress</item>
                        <item level="0" text="Infobar timeout">config.usage.infobar_timeout</item>
                        <item level="1" text="12V output" requires="12V_Output">config.usage.output_12V</item>
+                       <item level="0" text="Show event-progress in channel selection">config.usage.show_event_progress_in_servicelist</item>
                        <item level="2" text="Show infobar on channel change">config.usage.show_infobar_on_zap</item>
                        <item level="2" text="Show infobar on skip forward/backward">config.usage.show_infobar_on_skip</item>
                        <item level="2" text="Show infobar on event change">config.usage.show_infobar_on_event_change</item>
index 85bb800d6150ac8030f2cbba89d2069add4a2b18..6038c2e9f2816fe9cbce200322360cfd2a9a982d 100755 (executable)
@@ -23,6 +23,7 @@ dist_install_DATA = \
        b_tl.png \
        b_t.png \
        b_tr.png \
+       celserviceeventprogressbar.png \
        div-h.png \
        div-v.png \
        epg_more.png \
diff --git a/data/skin_default/celserviceeventprogressbar.png b/data/skin_default/celserviceeventprogressbar.png
new file mode 100644 (file)
index 0000000..7bf5c65
Binary files /dev/null and b/data/skin_default/celserviceeventprogressbar.png differ
old mode 100755 (executable)
new mode 100644 (file)
index 6095812..3452e27
@@ -7,6 +7,8 @@ from Tools.LoadPixmap import LoadPixmap
 
 from Tools.Directories import resolveFilename, SCOPE_CURRENT_SKIN
 
+from Components.config import config
+
 class ServiceList(HTMLComponent, GUIComponent):
        MODE_NORMAL = 0
        MODE_FAVOURITES = 1
@@ -62,6 +64,18 @@ class ServiceList(HTMLComponent, GUIComponent):
                                        self.l.setColor(eListboxServiceContent.markedBackgroundSelected, parseColor(value))
                                elif attrib == "foregroundColorServiceNotAvail":
                                        self.l.setColor(eListboxServiceContent.serviceNotAvail, parseColor(value))
+                               elif attrib == "colorEventProgressbar":
+                                       self.l.setColor(eListboxServiceContent.serviceEventProgressbarColor, parseColor(value))
+                               elif attrib == "colorEventProgressbarSelected":
+                                       self.l.setColor(eListboxServiceContent.serviceEventProgressbarColorSelected, parseColor(value))
+                               elif attrib == "colorEventProgressbarBorder":
+                                       self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColor, parseColor(value))
+                               elif attrib == "colorEventProgressbarBorderSelected":
+                                       self.l.setColor(eListboxServiceContent.serviceEventProgressbarBorderColorSelected, parseColor(value))
+                               elif attrib == "picServiceEventProgressbar":
+                                       pic = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, value))
+                                       if pic:
+                                               self.l.setPixmap(self.l.picServiceEventProgressbar, pic)
                                elif attrib == "serviceItemHeight":
                                        self.ItemHeight = int(value)
                                elif attrib == "serviceNameFont":
@@ -213,17 +227,24 @@ class ServiceList(HTMLComponent, GUIComponent):
 
        def setMode(self, mode):
                self.mode = mode
+               self.l.setItemHeight(self.ItemHeight)
+               self.l.setVisualMode(eListboxServiceContent.visModeComplex)
                if mode == self.MODE_NORMAL:
-                       self.l.setItemHeight(self.ItemHeight)
-                       self.l.setVisualMode(eListboxServiceContent.visModeComplex)
+                       if config.usage.show_event_progress_in_servicelist.value:
+                               self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 52, self.ItemHeight))
+                       else:
+                               self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(0, 0, 0, 0))
                        self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont)
                        self.l.setElementPosition(self.l.celServiceName, eRect(0, 0, self.instance.size().width(), self.ItemHeight))
                        self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont)
                else:
-                       self.l.setItemHeight(self.ItemHeight)
-                       self.l.setVisualMode(eListboxServiceContent.visModeComplex)
+                       if config.usage.show_event_progress_in_servicelist.value:
+                               self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(60, 0, 52, self.ItemHeight))
+                       else:
+                               self.l.setElementPosition(self.l.celServiceEventProgressbar, eRect(60, 0, 0, 0))
                        self.l.setElementFont(self.l.celServiceNumber, self.ServiceNumberFont)
                        self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 0, 50, self.ItemHeight))
                        self.l.setElementFont(self.l.celServiceName, self.ServiceNameFont)
                        self.l.setElementPosition(self.l.celServiceName, eRect(60, 0, self.instance.size().width()-60, self.ItemHeight))
                        self.l.setElementFont(self.l.celServiceInfo, self.ServiceInfoFont)
+
index 6082710768479543100ea036b4584ac788c10d0c..572f47e0fab3b04b7885c657a775ab117e4cae3d 100644 (file)
@@ -61,6 +61,8 @@ def InitUsageConfig():
                ("4", "DVB-T/-C/-S"),
                ("5", "DVB-T/-S/-C") ])
 
+       config.usage.show_event_progress_in_servicelist = ConfigYesNo(default = False)
+
        config.usage.blinking_display_clock_during_recording = ConfigYesNo(default = False)
 
        config.usage.show_message_when_recording_starts = ConfigYesNo(default = True)
index 05aaf73148bbaed3857ddf005f112f406817c912..f8ac0ff2ee904ecefb90e7cd70c886168153a6ba 100644 (file)
@@ -526,7 +526,10 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                ePtr<iStaticServiceInformation> service_info;
                m_service_center->info(*m_cursor, service_info);
                eServiceReference ref = *m_cursor;
-               bool isPlayable = !(ref.flags & eServiceReference::isDirectory || ref.flags & eServiceReference::isMarker);
+               bool isMarker = ref.flags & eServiceReference::isMarker;
+               bool isPlayable = !(ref.flags & eServiceReference::isDirectory || isMarker);
+               bool paintProgress = false;
+               ePtr<eServiceEvent> evt;
 
                if (!marked && isPlayable && service_info && m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
                {
@@ -539,7 +542,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                if (selected && local_style && local_style->m_selection)
                        painter.blit(local_style->m_selection, offset, eRect(), gPainter::BT_ALPHATEST);
 
-               int xoffset=0;  // used as offset when painting the folder/marker symbol
+               int xoffset=0;  // used as offset when painting the folder/marker symbol or the serviceevent progress
 
                for (int e = 0; e < celElements; ++e)
                {
@@ -583,8 +586,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                                }
                                case celServiceInfo:
                                {
-                                       ePtr<eServiceEvent> evt;
-                                       if ( isPlayable && service_info && !service_info->getEvent(*m_cursor, evt) )
+                                       if ( isPlayable && !service_info->getEvent(*m_cursor, evt) )
                                        {
                                                std::string name = evt->getEventName();
                                                if (!name.length())
@@ -608,9 +610,9 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                                {
                                        eRect bbox = para->getBoundBox();
                                        int name_width = bbox.width()+8;
-                                       m_element_position[celServiceInfo].setLeft(area.left()+name_width);
+                                       m_element_position[celServiceInfo].setLeft(area.left()+name_width+xoffs);
                                        m_element_position[celServiceInfo].setTop(area.top());
-                                       m_element_position[celServiceInfo].setWidth(area.width()-name_width);
+                                       m_element_position[celServiceInfo].setWidth(area.width()-(name_width+xoffs));
                                        m_element_position[celServiceInfo].setHeight(area.height());
                                }
 
@@ -678,12 +680,62 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                                        painter.clippop();
                                }
                        }
+                       else if (e == celServiceEventProgressbar)
+                       {
+                               eRect area = m_element_position[celServiceEventProgressbar];
+                               if (area.width() > 0 && (isPlayable || isMarker))
+                               {
+                                       // we schedule it to paint it as last element.. so we dont need to reset fore/background color
+                                       paintProgress = isPlayable;
+                                       xoffset = area.width() + 10;
+                               }
+                       }
                }
-               
                if (selected && (!local_style || !local_style->m_selection))
                        style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry);
+               if (paintProgress && evt)
+               {
+                       eRect area = m_element_position[celServiceEventProgressbar];
+                       if (!selected && m_color_set[serviceEventProgressbarBorderColor])
+                               painter.setForegroundColor(m_color[serviceEventProgressbarBorderColor]);
+                       else if (selected && m_color_set[serviceEventProgressbarBorderColorSelected])
+                               painter.setForegroundColor(m_color[serviceEventProgressbarBorderColorSelected]);
+
+                       int border = 1;
+                       int progressH = 6;
+                       int progressX = area.left() + offset.x();
+                       int progressW = area.width() - 2 * border;
+                       int progressT = offset.y() + (m_itemsize.height() - progressH - 2*border) / 2;
+
+                       // paint progressbar frame
+                       painter.fill(eRect(progressX, progressT, area.width(), border));
+                       painter.fill(eRect(progressX, progressT + border, border, progressH));
+                       painter.fill(eRect(progressX, progressT + progressH + border, area.width(), border));
+                       painter.fill(eRect(progressX + area.width() - border, progressT + border, border, progressH));
+
+                       // calculate value
+                       time_t now = time(0);
+                       int value = progressW * (now - evt->getBeginTime()) / evt->getDuration();
+
+                       eRect tmp = eRect(progressX + border, progressT + border, value, progressH);
+                       ePtr<gPixmap> &pixmap = m_pixmaps[picServiceEventProgressbar];
+                       if (pixmap)
+                       {
+                               area.moveBy(offset);
+                               painter.clip(area);
+                               painter.blit(pixmap, ePoint(progressX + border, progressT + border), tmp, gPainter::BT_ALPHATEST);
+                               painter.clippop();
+                       }
+                       else
+                       {
+                               if (!selected && m_color_set[serviceEventProgressbarColor])
+                                       painter.setForegroundColor(m_color[serviceEventProgressbarColor]);
+                               else if (selected && m_color_set[serviceEventProgressbarColorSelected])
+                                       painter.setForegroundColor(m_color[serviceEventProgressbarColorSelected]);
+                               painter.fill(tmp);
+                       }
+               }
        }
-       
        painter.clippop();
 }
 
index 5228a2f212db7aa78046c5059f0ee4ba30e20ad3..982d7e14226521b5414f2e777de8eaa21cacbc1f 100644 (file)
@@ -49,6 +49,7 @@ public:
                celServiceNumber,
                celMarkerPixmap,
                celFolderPixmap,
+               celServiceEventProgressbar,
                celServiceName,
                celServiceTypePixmap,
                celServiceInfo, // "now" event
@@ -62,6 +63,7 @@ public:
                picServiceGroup,
                picFolder,
                picMarker,
+               picServiceEventProgressbar,
                picElements
        };
 
@@ -84,6 +86,10 @@ public:
                markedBackground,
                markedBackgroundSelected,
                serviceNotAvail,
+               serviceEventProgressbarColor,
+               serviceEventProgressbarColorSelected,
+               serviceEventProgressbarBorderColor,
+               serviceEventProgressbarBorderColorSelected,
                colorElements
        };