better error/retry handling for recorder
[enigma2.git] / lib / service / listboxservice.cpp
index 4e20fcb7f53e70cd4125c036faaf92a59664d180..866963fb352e90b5e0ec8a57c73e8a4a3d073454 100644 (file)
@@ -3,12 +3,29 @@
 #include <lib/gdi/font.h>
 #include <lib/dvb/epgcache.h>
 #include <lib/dvb/pmt.h>
+#include <lib/python/connections.h>
 
-void eListboxServiceContent::setRoot(const eServiceReference &root)
+void eListboxServiceContent::addService(const eServiceReference &service)
+{
+       m_list.push_back(service);
+}
+
+void eListboxServiceContent::FillFinished()
+{
+       m_size = m_list.size();
+       cursorHome();
+
+       if (m_listbox)
+               m_listbox->entryReset();
+}
+
+void eListboxServiceContent::setRoot(const eServiceReference &root, bool justSet)
 {
        m_list.clear();
        m_root = root;
-       
+
+       if (justSet)
+               return;
        assert(m_service_center);
        
        ePtr<iListableService> lst;
@@ -18,11 +35,7 @@ void eListboxServiceContent::setRoot(const eServiceReference &root)
                if (lst->getContent(m_list))
                        eDebug("getContent failed");
 
-       m_size = m_list.size();
-       cursorHome();
-       
-       if (m_listbox)
-               m_listbox->entryReset();
+       FillFinished();
 }
 
 void eListboxServiceContent::setCurrent(const eServiceReference &ref)
@@ -35,6 +48,8 @@ void eListboxServiceContent::setCurrent(const eServiceReference &ref)
                        m_cursor_number = index;
                        break;
                }
+       if (m_listbox)
+               m_listbox->moveSelectionTo(index);
 }
 
 void eListboxServiceContent::getCurrent(eServiceReference &ref)
@@ -129,7 +144,7 @@ void eListboxServiceContent::setVisualMode(int mode)
        if (m_visual_mode == visModeSimple)
        {
                m_element_position[celServiceName] = eRect(ePoint(0, 0), m_itemsize);
-               m_element_font[celServiceName] = new gFont("Arial", 23);
+               m_element_font[celServiceName] = new gFont("Regular", 23);
                m_element_position[celServiceNumber] = eRect();
                m_element_font[celServiceNumber] = 0;
                m_element_position[celIcon] = eRect();
@@ -335,28 +350,12 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
 {
        painter.clip(eRect(offset, m_itemsize));
 
-       bool tuneable=true;
-
-#if 0
-       if (m_res_mgr && cursorValid() && !((m_cursor->flags & eServiceReference::flagDirectory) == eServiceReference::flagDirectory))
-       {
-               eServiceReferenceDVB &ref = (eServiceReferenceDVB&) *m_cursor;
-               eDVBChannelID chid;
-               ref.getChannelID(chid);
-               tuneable = m_res_mgr->canAllocateChannel(chid);
-       }
-#endif
-
        if (m_current_marked && selected)
                style.setStyle(painter, eWindowStyle::styleListboxMarked);
        else if (cursorValid() && isMarked(*m_cursor))
                style.setStyle(painter, eWindowStyle::styleListboxMarked);
        else
-       {
                style.setStyle(painter, selected ? eWindowStyle::styleListboxSelected : eWindowStyle::styleListboxNormal);
-               if (!tuneable)
-                       painter.setForegroundColor(gRGB(0xbbbbbb));
-       }
        painter.clear();
        
        if (cursorValid())
@@ -364,7 +363,10 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                        /* get service information */
                ePtr<iStaticServiceInformation> service_info;
                m_service_center->info(*m_cursor, service_info);
-               
+
+               if (m_is_playable_ignore.valid() && !service_info->isPlayable(*m_cursor, m_is_playable_ignore))
+                       painter.setForegroundColor(gRGB(0xbbbbbb));
+
                for (int e = 0; e < celElements; ++e)
                {
                        if (!m_element_font[e])
@@ -447,3 +449,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
        painter.clippop();
 }
 
+void eListboxServiceContent::setIgnoreService( const eServiceReference &service )
+{
+       m_is_playable_ignore=service;
+}