- start on 'favourites' visual design. service listbox now configurable (in complex...
authorFelix Domke <tmbinc@elitedvb.net>
Sun, 28 Aug 2005 22:46:00 +0000 (22:46 +0000)
committerFelix Domke <tmbinc@elitedvb.net>
Sun, 28 Aug 2005 22:46:00 +0000 (22:46 +0000)
keymap.xml
lib/python/Components/ServiceList.py
lib/python/Screens/ChannelSelection.py
lib/python/Screens/InfoBar.py
lib/service/listboxservice.cpp
lib/service/listboxservice.h
skin.py

index 225cee86afdbeb30d691f676034d043a9cd619b3..ec26ccaf924f89806ef136619e54056592f33e27 100644 (file)
@@ -10,6 +10,8 @@
                <key id="KEY_END" mapto="moveEnd" flags="mr" />
                <key id="KEY_PAGEUP" mapto="pageUp" flags="mr" />
                <key id="KEY_PAGEDOWN" mapto="pageDown" flags="mr" />
+               <key id="KEY_LEFT" mapto="pageUp" flags="mr" />
+               <key id="KEY_RIGHT" mapto="pageDown" flags="mr" />
                <key id="1" mapto="moveUp" flags="mr" />
                <key id="2" mapto="moveDown" flags="mr" />
        </map>
                <key id="KEY_C" mapto="contextMenu" flags="m" />
                <key id="KEY_M" mapto="mark" flags="m" />
                <!-- yes, this is flexible as hell. -->
-               <key id="KEY_P" mapto="bouquet:(provider == PREMIERE)" flags="m" />
+               <key id="KEY_RED" mapto="bouquet:(provider == PREMIERE)" flags="m" />
                <key id="KEY_D" mapto="bouquet:(provider == ARD)" flags="m" />
                <key id="KEY_A" mapto="bouquet:" flags="m" />
+               <key id="KEY_BLUE" mapto="showFavourites" flags="m" />
        </map>
        <map context="OkCancelActions">
                <key id="\x0a" mapto="ok" flags="m" />
index 5725871d3307e1278e4053b44c4a02e19d3fc7fa..4c553d9d8eb2d784940d4b1a0710049c28515a1d 100644 (file)
@@ -4,6 +4,10 @@ from GUIComponent import *
 from enigma import *
 
 class ServiceList(HTMLComponent, GUIComponent):
+
+       MODE_NORMAL = 0
+       MODE_FAVOURITES = 1
+       
        def __init__(self):
                GUIComponent.__init__(self)
                self.l = eListboxServiceContent()
@@ -55,3 +59,17 @@ class ServiceList(HTMLComponent, GUIComponent):
                        ref = eServiceReference()
 
                return marked
+
+       def setMode(self, mode):
+               if mode == self.MODE_NORMAL:
+                       self.instance.setItemHeight(20)
+                       self.l.setVisualMode(eListboxServiceContent.visModeSimple)
+               else:
+                       self.instance.setItemHeight(40)
+                       
+                       self.l.setElementFont(self.l.celServiceName, gFont("Arial", 30))
+                       self.l.setElementPosition(self.l.celServiceName, eRect(40, 0, self.instance.size().width(), 40))
+                       self.l.setElementFont(self.l.celServiceNumber, gFont("Arial", 20))
+                       self.l.setElementPosition(self.l.celServiceNumber, eRect(0, 10, 40, 30))
+                       
+                       self.l.setVisualMode(eListboxServiceContent.visModeComplex)
index 465d3de370784ebde4663fe610cee1293725a794..3155c44d9ab2b1f4d7780807e60486049f93781d 100644 (file)
@@ -69,7 +69,9 @@ class ChannelSelection(Screen):
                        def action(self, contexts, action):
                                if action[:7] == "bouquet":
                                        print "setting root to " + action[8:]
-                                       self.csel["list"].setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
+                                       l = self.csel["list"]
+                                       l.setMode(l.MODE_NORMAL)
+                                       l.setRoot(eServiceReference("1:0:1:0:0:0:0:0:0:0:" + action[8:]))
                                else:
                                        ActionMap.action(self, contexts, action)
 
@@ -78,7 +80,8 @@ class ChannelSelection(Screen):
                                "cancel": self.close,
                                "ok": self.channelSelected,
                                "mark": self.doMark,
-                               "contextMenu": self.doContext
+                               "contextMenu": self.doContext,
+                               "showFavourites": self.showFavourites
                        })
                self["actions"].csel = self
 
@@ -119,6 +122,7 @@ class ChannelSelection(Screen):
        # ...
        def channelSelected(self):
                self.session.nav.playService(self["list"].getCurrent())
+               print "current: " + self["list"].getCurrent().toString()
                self.close()
 
        #called from infoBar
@@ -137,3 +141,7 @@ class ChannelSelection(Screen):
        def setMoveMode(self, mode):
                self.movemode = mode
        
+       def showFavourites(self):
+               l = self["list" ]
+               l.setRoot(eServiceReference('1:0:1:0:0:0:0:0:0:0:(provider == "fav")'))
+               l.setMode(l.MODE_FAVOURITES)
index 6f8dde1b0adfac2916e43f60258a44caff17c137..0ead722134c520850a129b1f5d8a93dedb42f58d 100644 (file)
@@ -6,6 +6,7 @@ from Components.ActionMap import ActionMap
 from Components.Button import Button
 from Components.ServiceName import ServiceName
 from Components.EventInfo import EventInfo
+from Components.ServicePosition import ServicePosition
 
 from Screens.MessageBox import MessageBox
 from Screens.MovieSelection import MovieSelection
@@ -43,7 +44,8 @@ class InfoBar(Screen):
                        })
 #              self["okbutton"] = Button("mainMenu", [self.mainMenu])
                
-               self["CurrentTime"] = Clock()
+               self["CurrentTime"] = ServicePosition(self.session.nav, ServicePosition.TYPE_REMAINING)
+               # Clock()
 
                self["Volume"] = self.volumeBar
                
index 24090f73dcbb1b71896d7b8e4ddbd02cd1e4b2d8..0783872230ed6b5e54fb91279062fd2642e65762 100644 (file)
@@ -80,10 +80,39 @@ int eListboxServiceContent::lookupService(const eServiceReference &ref)
        return index;
 }
 
+void eListboxServiceContent::setVisualMode(int mode)
+{
+       m_visual_mode = mode;
+       
+       if (m_visual_mode == visModeSimple)
+       {
+               m_element_position[celServiceName] = eRect(ePoint(0, 0), m_itemsize);
+               m_element_font[celServiceName] = new gFont("Arial", 14);
+               m_element_position[celServiceNumber] = eRect();
+               m_element_font[celServiceNumber] = 0;
+               m_element_position[celIcon] = eRect();
+               m_element_position[celServiceInfo] = eRect();
+               m_element_font[celServiceInfo] = 0;
+       }
+}
+
+void eListboxServiceContent::setElementPosition(int element, eRect where)
+{
+       if ((element >= 0) && (element < celElements))
+               m_element_position[element] = where;
+}
+
+void eListboxServiceContent::setElementFont(int element, gFont *font)
+{
+       if ((element >= 0) && (element < celElements))
+               m_element_font[element] = font;
+}
+
 DEFINE_REF(eListboxServiceContent);
 
 eListboxServiceContent::eListboxServiceContent()
 {
+       m_visual_mode = visModeSimple;
        m_size = 0;
        cursorHome();
        eServiceCenter::getInstance(m_service_center);
@@ -162,11 +191,11 @@ int eListboxServiceContent::size()
 void eListboxServiceContent::setSize(const eSize &size)
 {
        m_itemsize = size;
+       setVisualMode(m_visual_mode);
 }
 
 void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
 {
-       ePtr<gFont> fnt = new gFont("Arial", 14);
        painter.clip(eRect(offset, m_itemsize));
        if (cursorValid() && isMarked(*m_cursor))
                style.setStyle(painter, eWindowStyle::styleListboxMarked);
@@ -176,19 +205,47 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
        
        if (cursorValid())
        {
-               painter.setFont(fnt);
-               
-               ePoint text_offset = offset + (selected ? ePoint(2, 2) : ePoint(1, 1));
-               
-                       /* get name of service */
+                       /* get service information */
                ePtr<iStaticServiceInformation> service_info;
                m_service_center->info(*m_cursor, service_info);
-               std::string name = "<n/a>";
-               
-               if (service_info)
-                       service_info->getName(*m_cursor, name);
                
-               painter.renderText(eRect(text_offset, m_itemsize), name);
+               for (int e = 0; e < celElements; ++e)
+               {
+                       if (!m_element_font[e])
+                               continue;
+                       painter.setFont(m_element_font[e]);
+                       
+                       std::string text = "<n/a>";
+                       
+                       switch (e)
+                       {
+                       case celServiceName:
+                       {
+                               if (service_info)
+                                       service_info->getName(*m_cursor, text);
+                               break;
+                       }
+                       case celServiceNumber:
+                       {
+                               char bla[10];
+                               sprintf(bla, "%d", m_cursor_number + 1);
+                               text = bla;
+                               break;
+                       }
+                       case celServiceInfo:
+                       {
+                               text = "now&next";
+                               break;
+                       }
+                       case celIcon:
+                               continue;
+                       }
+                       
+                       eRect area = m_element_position[e];
+                       area.moveBy(offset.x(), offset.y());
+                       
+                       painter.renderText(area, text);
+               }
                
                if (selected)
                        style.drawFrame(painter, eRect(offset, m_itemsize), eWindowStyle::frameListboxEntry);
index 36bb5bb4fb8da71711893f32737c3d13f2738604..f32e08658ea3c5604bbe7cfcc3d6acc2aac80a05 100644 (file)
@@ -27,6 +27,25 @@ public:
 
        int lookupService(const eServiceReference &ref);
        
+       enum {
+               visModeSimple,
+               visModeComplex
+       };
+       
+       void setVisualMode(int mode);
+       
+               /* only in complex mode: */
+       enum {
+               celServiceName,
+               celServiceNumber,
+               celIcon,
+               celServiceInfo, // "now" event
+               celElements
+       };
+       
+       void setElementPosition(int element, eRect where);
+       void setElementFont(int element, gFont *font);
+       
 protected:
        void cursorHome();
        void cursorEnd();
@@ -44,6 +63,11 @@ protected:
        
                /* the following functions always refer to the selected item */
        void paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected);
+       
+       int m_visual_mode;
+               /* for complex mode */
+       eRect m_element_position[celElements];
+       ePtr<gFont> m_element_font[celElements];
 private:
        typedef std::list<eServiceReference> list;
        
diff --git a/skin.py b/skin.py
index 2c1778e4d07f5d361f8f854e3016c5029eef4917..7d24441dbb7a26a9b4548c52aeca681316d633fb 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -97,7 +97,7 @@ dom = xml.dom.minidom.parseString(
 <!--                   <eLabel position="70,0" size="300,30" text=".oO skin Oo." font="Arial;20" /> -->
                </screen>
                <screen name="ChannelSelection" position="90,100" size="560,420" title="Channel Selection">
-                       <widget name="list" position="0,50" size="560,340" />
+                       <widget name="list" position="0,50" size="560,320" />
 <!--                   <widget name="okbutton" position="340,50" size="140,30" />-->
                        <widget name="key_red" position="0,0" size="140,40" backgroundColor="red" />
                        <widget name="key_green" position="140,0" size="140,40" backgroundColor="green" />