set foregroundcolor of non tuneable services in servicelist to gray (for linked tuner...
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 2 Dec 2005 14:30:21 +0000 (14:30 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Fri, 2 Dec 2005 14:30:21 +0000 (14:30 +0000)
lib/dvb/dvb.cpp
lib/dvb/dvb.h
lib/dvb/pmt.cpp
lib/dvb/pmt.h
lib/dvb/sec.cpp
lib/service/listboxservice.cpp
lib/service/listboxservice.h

index 4d78292..676c063 100644 (file)
@@ -297,7 +297,7 @@ RESULT eDVBResourceManager::getChannelList(ePtr<iDVBChannelList> &list)
 }
 
 
-RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel)
+RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool fake)
 {
                /* first, check if a channel is already existing. */
        
@@ -334,19 +334,22 @@ RESULT eDVBResourceManager::allocateChannel(const eDVBChannelID &channelid, eUse
        
        if (allocateFrontend(fe, feparm))
                return errNoFrontend;
-       
-       RESULT res;
-       ePtr<eDVBChannel> ch;
-       ch = new eDVBChannel(this, fe);
 
-       res = ch->setChannel(channelid, feparm);
-       if (res)
+       if (!fake)
        {
-               channel = 0;
-               return errChidNotFound;
-       }
+               RESULT res;
+               ePtr<eDVBChannel> ch;
+               ch = new eDVBChannel(this, fe);
+
+               res = ch->setChannel(channelid, feparm);
+               if (res)
+               {
+                       channel = 0;
+                       return errChidNotFound;
+               }
        
-       channel = ch;
+               channel = ch;
+       }
        return 0;
 }
 
index fcfbdfe..355e246 100644 (file)
@@ -156,9 +156,9 @@ public:
                errNoDemux    = -2,
                errChidNotFound = -3
        };
-       
+
                /* allocate channel... */
-       RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel);
+       RESULT allocateChannel(const eDVBChannelID &channelid, eUsePtr<iDVBChannel> &channel, bool fake=false);
        RESULT allocateRawChannel(eUsePtr<iDVBChannel> &channel, int frontend_index);
        RESULT allocatePVRChannel(eUsePtr<iDVBPVRChannel> &channel);
 
index 5a1b7c5..0fc0524 100644 (file)
@@ -9,6 +9,8 @@
 #include <dvbsi++/iso639_language_descriptor.h>
 #include <dvbsi++/component_descriptor.h>
 
+int eDVBServicePMTHandler::m_count;
+
 eDVBServicePMTHandler::eDVBServicePMTHandler(int record)
        :m_ca_servicePtr(0)
 {
@@ -17,6 +19,7 @@ eDVBServicePMTHandler::eDVBServicePMTHandler(int record)
        CONNECT(m_PMT.tableReady, eDVBServicePMTHandler::PMTready);
        CONNECT(m_PAT.tableReady, eDVBServicePMTHandler::PATready);
        eDebug("new PMT handler record: %d", m_record);
+       ++m_count;
 }
 
 eDVBServicePMTHandler::~eDVBServicePMTHandler()
@@ -32,6 +35,7 @@ eDVBServicePMTHandler::~eDVBServicePMTHandler()
                eDVBCAService::unregister_service(m_reference, demux_num, ptr);
                eDVBCIInterfaces::getInstance()->removePMTHandler(this);
        }
+       --m_count;
 }
 
 void eDVBServicePMTHandler::channelStateChanged(iDVBChannel *channel)
index 5f3d477..b8ed76f 100644 (file)
@@ -66,7 +66,9 @@ class eDVBServicePMTHandler: public Object
        void PATready(int error);
        
        int m_record;
+       static int m_count;
 public:
+       static int getCount() { return m_count; }
        eDVBServicePMTHandler(int record);
        ~eDVBServicePMTHandler();
        
index 6444306..4842945 100644 (file)
@@ -184,7 +184,7 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite
                                                it->m_frontend->getData(1, oucsw);
                                                it->m_frontend->getData(2, oToneburst);
                                                it->m_frontend->getData(6, oRotorPos);
-
+#if 0
                                                eDebug("compare csw %02x == lcsw %02x",
                                                        csw, ocsw);
                                                if ( diseqc )
@@ -193,16 +193,16 @@ int eDVBSatelliteEquipmentControl::canTune(const eDVBFrontendParametersSatellite
                                                if ( rotor )
                                                        eDebug("compare pos %d == current pos %d",
                                                                sat.orbital_position, oRotorPos);
-
+#endif
                                                if ( (csw != ocsw) ||
                                                        ( diseqc && (ucsw != oucsw || toneburst != oToneburst) ) ||
                                                        ( rotor && oRotorPos != sat.orbital_position ) )
                                                {
-                                                       eDebug("can not tune this transponder with linked tuner in use!!");
+//                                                     eDebug("can not tune this transponder with linked tuner in use!!");
                                                        ret=0;
                                                }
-                                               else
-                                                       eDebug("OK .. can tune this transponder with linked tuner in use :)");
+//                                             else
+//                                                     eDebug("OK .. can tune this transponder with linked tuner in use :)");
                                        }
                                }
                        }
index 0b2e621..9d68a5e 100644 (file)
@@ -2,6 +2,7 @@
 #include <lib/service/service.h>
 #include <lib/gdi/font.h>
 #include <lib/dvb/epgcache.h>
+#include <lib/dvb/pmt.h>
 
 void eListboxServiceContent::setRoot(const eServiceReference &root)
 {
@@ -165,10 +166,12 @@ void eListboxServiceContent::sort()
 DEFINE_REF(eListboxServiceContent);
 
 eListboxServiceContent::eListboxServiceContent()
-       :epgcache(eEPGCache::getInstance()), m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_numberoffset(0)
+       :m_epgcache(eEPGCache::getInstance()), m_visual_mode(visModeSimple), m_size(0), m_current_marked(false), m_numberoffset(0)
 {
        cursorHome();
        eServiceCenter::getInstance(m_service_center);
+       if (eDVBResourceManager::getInstance(m_res_mgr))
+               eDebug("no resource manager");
 }
 
 void eListboxServiceContent::cursorHome()
@@ -334,12 +337,30 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
 {
        painter.clip(eRect(offset, m_itemsize));
 
+       bool tuneable=true;
+
+       if (m_res_mgr && cursorValid() && !((m_cursor->flags & eServiceReference::flagDirectory) == eServiceReference::flagDirectory))
+       {
+               if ( eDVBServicePMTHandler::getCount() > 1 )
+               {
+                       eServiceReferenceDVB &ref = (eServiceReferenceDVB&) *m_cursor;
+                       eUsePtr<iDVBChannel> channel;
+                       eDVBChannelID chid;
+                       ref.getChannelID(chid);
+                       tuneable = !m_res_mgr->allocateChannel(chid, channel, true);  // no real allocate channel..just fake
+               }
+       }
+
        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())
@@ -381,7 +402,7 @@ void eListboxServiceContent::paint(gPainter &painter, eWindowStyle &style, const
                        {
                                ePtr<eServiceEvent> evt;
                                time_t t=-1;
-                               if ( !epgcache->lookupEventTime(*m_cursor, t, evt) )
+                               if ( !m_epgcache->lookupEventTime(*m_cursor, t, evt) )
                                        text = '(' + evt->getEventName() + ')';
                                else
                                        continue;
index ae0ec5a..6e8d501 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef __lib_service_listboxservice_h
 #define __lib_service_listboxservice_h
 
+#include <lib/dvb/dvb.h>
 #include <lib/gui/elistbox.h>
 #include <lib/service/iservice.h>
 #include <set>
@@ -10,7 +11,8 @@ class eEPGCache;
 class eListboxServiceContent: public virtual iListboxContent
 {
        DECLARE_REF(eListboxServiceContent);
-       eEPGCache *epgcache;
+       eEPGCache *m_epgcache;
+       ePtr<eDVBResourceManager> m_res_mgr;
 public:
        eListboxServiceContent();
        void setRoot(const eServiceReference &ref);