just show hdd info when there is one
[enigma2.git] / lib / components / listboxepg.cpp
index a8edd28..0d5c541 100644 (file)
@@ -4,17 +4,22 @@
 
 void eListboxEPGContent::setRoot(const eServiceReference &root)
 {
-       eEPGCache *epg=NULL;
-       if ( !eEPGCache::getInstance(epg) )
+       eEPGCache *epg=eEPGCache::getInstance();
+       if ( epg )
        {
                m_list.clear();
                m_root = root;
 
                epg->Lock();
-               epg->startTimeQuery(root);
-               ePtr<eServiceEvent> ptr;
-               while( !epg->getNextTimeEntry(ptr) )
-                       m_list.push_back(ptr);
+               if (!epg->startTimeQuery(root))
+               {
+                       ePtr<eServiceEvent> ptr;
+                       while( !epg->getNextTimeEntry(ptr) )
+                               m_list.push_back(ptr);
+               }
+               else
+                       eDebug("startTimeQuery failed %s", root.toString().c_str());
+               epg->Unlock();
 
                m_size = m_list.size();
                cursorHome();
@@ -24,12 +29,16 @@ void eListboxEPGContent::setRoot(const eServiceReference &root)
        }
 }
 
-void eListboxEPGContent::getCurrent(ePtr<eServiceEvent>& evt)
+RESULT eListboxEPGContent::getCurrent(ePtr<eServiceEvent> &evt)
 {
        if (cursorValid())
+       {
                evt = *m_cursor;
+               return 0;
+       }
        else
                evt = 0;
+       return -1;
 }
 
 void eListboxEPGContent::setElementPosition(int element, eRect where)
@@ -144,12 +153,12 @@ void eListboxEPGContent::setSize(const eSize &size)
 {
        m_itemsize = size;
        eSize s = m_itemsize;
-       s.setWidth((size.width()/4)-10);
+       s.setWidth(size.width()/20*5);
        m_element_position[celBeginTime] = eRect(ePoint(0, 0), s);
-       m_element_font[celBeginTime] = new gFont("Arial", 14);
-       s.setWidth(size.width()/4*3);
-       m_element_position[celTitle] = eRect(ePoint(size.width()/4, 0), s);
-       m_element_font[celTitle] = new gFont("Arial", 14);
+       m_element_font[celBeginTime] = new gFont("Arial", 22);
+       s.setWidth(size.width()/20*15);
+       m_element_position[celTitle] = eRect(ePoint(size.width()/20*5, 0), s);
+       m_element_font[celTitle] = new gFont("Arial", 22);
 }
 
 void eListboxEPGContent::paint(gPainter &painter, eWindowStyle &style, const ePoint &offset, int selected)
@@ -173,13 +182,7 @@ void eListboxEPGContent::paint(gPainter &painter, eWindowStyle &style, const ePo
                        {
                        case celBeginTime:
                        {
-                               tm t;
-                               localtime_r(&(*m_cursor)->m_begin, &t);
-                               char tmp[13];
-                               snprintf(tmp, 13, "%02d.%02d, %02d:%02d",
-                                       t.tm_mday, t.tm_mon+1,
-                                       t.tm_hour, t.tm_min);
-                               text=tmp;
+                               text=(*m_cursor)->getBeginTimeString();
                                break;
                        }
                        case celTitle: