From cc9862b55b147eb78581813ba70d574940ac103d Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Sat, 14 Jan 2006 17:59:32 +0000 Subject: [PATCH 1/1] display last 7 services during scan --- data/skin.xml | 4 ++-- lib/components/scan.cpp | 13 +++++++++++++ lib/components/scan.h | 4 ++++ lib/dvb/scan.cpp | 17 ++++++++++++++++- lib/dvb/scan.h | 4 +++- lib/python/Components/FIFOList.py | 12 ++++++++++++ lib/python/Components/Makefile.am | 3 ++- 7 files changed, 52 insertions(+), 5 deletions(-) create mode 100644 lib/python/Components/FIFOList.py diff --git a/data/skin.xml b/data/skin.xml index 5c4482b5..a9398fd7 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -184,7 +184,6 @@ - @@ -276,9 +275,10 @@ - + + diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp index bfbb02da..c21e8f4b 100644 --- a/lib/components/scan.cpp +++ b/lib/components/scan.cpp @@ -33,6 +33,12 @@ void eComponentScan::scanEvent(int evt) } } + if (evt == eDVBScan::evtNewService) + { + newService(); + return; + } + if (evt == eDVBScan::evtFail) { eDebug("scan failed."); @@ -137,3 +143,10 @@ int eComponentScan::getError() { return m_failed; } + +void eComponentScan::getLastServiceName(std::string &string) +{ + if (!m_scan) + return; + m_scan->getLastServiceName(string); +} diff --git a/lib/components/scan.h b/lib/components/scan.h index eb18f104..9ce6539f 100644 --- a/lib/components/scan.h +++ b/lib/components/scan.h @@ -23,6 +23,7 @@ public: ~eComponentScan(); PSignal0 statusChanged; + PSignal0 newService; /* progress between 0 and 100 */ int getProgress(); @@ -33,6 +34,9 @@ public: /* true when done or error */ int isDone(); + /* get last added service */ + void getLastServiceName(std::string &SWIG_OUTPUT); + int getError(); void clear(); diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index ba63ed9f..7f4f6b10 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -375,6 +375,7 @@ void eDVBScan::start(const eSmartPtrList &known_transpon m_ch_unavailable.clear(); m_new_channels.clear(); m_new_services.clear(); + m_last_service = m_new_services.end(); for (eSmartPtrList::const_iterator i(known_transponders.begin()); i != known_transponders.end(); ++i) { @@ -469,7 +470,13 @@ RESULT eDVBScan::processSDT(eDVBNamespace dvbnamespace, const ServiceDescription } } - m_new_services.insert(std::pair >(ref, service)); + std::pair >::iterator, bool> i = m_new_services.insert(std::pair >(ref, service)); + + if (i.second) + { + m_last_service = i.first; + m_event(evtNewService); + } } return 0; } @@ -486,3 +493,11 @@ void eDVBScan::getStats(int &transponders_done, int &transponders_total, int &se transponders_total = m_ch_toScan.size() + transponders_done; services = m_new_services.size(); } + +void eDVBScan::getLastServiceName(std::string &last_service_name) +{ + if (m_last_service == m_new_services.end()) + last_service_name = ""; + else + last_service_name = m_last_service->second->m_service_name; +} diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 11d0efdc..2756fb12 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -40,6 +40,7 @@ private: std::map > m_new_channels; std::map > m_new_services; + std::map >::iterator m_last_service; std::list > m_ch_toScan, m_ch_scanned, m_ch_unavailable; ePtr m_ch_current; @@ -70,11 +71,12 @@ public: enum { scanNetworkSearch = 1, scanSearchBAT = 2 }; void start(const eSmartPtrList &known_transponders, int flags); - enum { evtUpdate, evtFinish, evtFail }; + enum { evtUpdate, evtNewService, evtFinish, evtFail }; RESULT connectEvent(const Slot1 &event, ePtr &connection); void insertInto(iDVBChannelList *db); void getStats(int &transponders_done, int &transponders_total, int &services); + void getLastServiceName(std::string &name); }; #endif diff --git a/lib/python/Components/FIFOList.py b/lib/python/Components/FIFOList.py new file mode 100644 index 00000000..16b51c89 --- /dev/null +++ b/lib/python/Components/FIFOList.py @@ -0,0 +1,12 @@ +from Components.MenuList import MenuList + +class FIFOList(MenuList): + def __init__(self, list = [ ], len = 10): + self.len = len + self.list = list + MenuList.__init__(self, self.list) + + def addItem(self, item): + self.list.append(item) + self.list = self.list[-self.len:] + self.l.setList(self.list) diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am index 9826daab..fcb5f8fd 100644 --- a/lib/python/Components/Makefile.am +++ b/lib/python/Components/Makefile.am @@ -11,4 +11,5 @@ install_PYTHON = \ AVSwitch.py Network.py RFmod.py DiskInfo.py NimManager.py Lcd.py \ EpgList.py ScrollLabel.py Timezones.py Language.py HelpMenuList.py \ BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py \ - PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py + PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py \ + FIFOList.py -- 2.30.2