diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/base/smartptr.h | 8 | ||||
| -rw-r--r-- | lib/components/scan.cpp | 26 | ||||
| -rw-r--r-- | lib/components/scan.h | 2 | ||||
| -rw-r--r-- | lib/driver/rcconsole.cpp | 2 | ||||
| -rw-r--r-- | lib/dvb/scan.cpp | 6 | ||||
| -rw-r--r-- | lib/dvb/scan.h | 2 | ||||
| -rw-r--r-- | lib/gui/elistbox.cpp | 16 | ||||
| -rw-r--r-- | lib/gui/elistbox.h | 14 | ||||
| -rw-r--r-- | lib/gui/ewidget.h | 2 | ||||
| -rw-r--r-- | lib/gui/ewindowstyle.cpp | 28 | ||||
| -rw-r--r-- | lib/nav/core.cpp | 28 | ||||
| -rw-r--r-- | lib/nav/core.h | 4 | ||||
| -rw-r--r-- | lib/nav/pcore.cpp | 27 | ||||
| -rw-r--r-- | lib/nav/pcore.h | 19 | ||||
| -rw-r--r-- | lib/python/enigma_python.i | 19 | ||||
| -rw-r--r-- | lib/service/event.h | 6 | ||||
| -rw-r--r-- | lib/service/iservice.h | 10 | ||||
| -rw-r--r-- | lib/service/servicedvb.cpp | 6 | ||||
| -rw-r--r-- | lib/service/servicedvb.h | 1 |
20 files changed, 178 insertions, 50 deletions
diff --git a/lib/Makefile.am b/lib/Makefile.am index 72efc401..72679b68 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -1 +1 @@ -SUBDIRS = base dvb dvb_si gdi network service driver nav gui python components +SUBDIRS = actions base components dvb dvb_si gdi network service driver nav gui python diff --git a/lib/base/smartptr.h b/lib/base/smartptr.h index 906bba69..159eeb2c 100644 --- a/lib/base/smartptr.h +++ b/lib/base/smartptr.h @@ -4,6 +4,14 @@ #include "object.h" #include <stdio.h> +#ifdef SWIG +#define TEMPLATE_TYPEDEF(x, y) \ +%template(y) x; \ +typedef x y +#else +#define TEMPLATE_TYPEDEF(x, y) typedef x y +#endif + template<class T> class ePtr { diff --git a/lib/components/scan.cpp b/lib/components/scan.cpp index 4d8d8b78..8fb60b58 100644 --- a/lib/components/scan.cpp +++ b/lib/components/scan.cpp @@ -20,23 +20,29 @@ void eComponentScan::scanEvent(int evt) if ((err = eDVBResourceManager::getInstance(res)) != 0) { eDebug("no resource manager"); - return; - } - if ((err = res->getChannelList(db)) != 0) + m_failed = 2; + } else if ((err = res->getChannelList(db)) != 0) { + m_failed = 3; eDebug("no channel list"); - return; + } else + { + m_scan->insertInto(db); + eDebug("scan done!"); } - - m_scan->insertInto(db); - - eDebug("scan done!"); + } + + if (evt == eDVBScan::evtFail) + { + eDebug("scan failed."); + m_failed = 1; + m_done = 1; } statusChanged(); } -eComponentScan::eComponentScan(): m_done(-1) +eComponentScan::eComponentScan(): m_done(-1), m_failed(0) { } @@ -77,8 +83,8 @@ int eComponentScan::start() list.push_back(fe); m_scan = new eDVBScan(channel); - m_scan->start(list); m_scan->connectEvent(slot(*this, &eComponentScan::scanEvent), m_scan_event_connection); + m_scan->start(list); return 0; } diff --git a/lib/components/scan.h b/lib/components/scan.h index afa68689..073919c7 100644 --- a/lib/components/scan.h +++ b/lib/components/scan.h @@ -13,7 +13,7 @@ private: ePtr<eConnection> m_scan_event_connection; ePtr<eDVBScan> m_scan; - int m_done; + int m_done, m_failed; public: eComponentScan(); ~eComponentScan(); diff --git a/lib/driver/rcconsole.cpp b/lib/driver/rcconsole.cpp index f662b2b1..3b5397b1 100644 --- a/lib/driver/rcconsole.cpp +++ b/lib/driver/rcconsole.cpp @@ -78,7 +78,7 @@ void eRCConsoleDriver::keyPressed(int) #endif if (code != -1) for (std::list<eRCDevice*>::iterator i(listeners.begin()); i!=listeners.end(); ++i) - (*i)->handleCode(code); + (*i)->handleCode(code | 0x8000); } } diff --git a/lib/dvb/scan.cpp b/lib/dvb/scan.cpp index 65eb053c..b6d0575b 100644 --- a/lib/dvb/scan.cpp +++ b/lib/dvb/scan.cpp @@ -96,11 +96,17 @@ RESULT eDVBScan::nextChannel() m_ch_toScan.pop_front(); if (m_channel->getFrontend(fe)) + { + m_event(evtFail); return -ENOTSUP; + } m_channel_state = iDVBChannel::state_idle; if (fe->tune(*m_ch_current)) + { + m_event(evtFail); return -EINVAL; + } m_event(evtUpdate); return 0; diff --git a/lib/dvb/scan.h b/lib/dvb/scan.h index 3556eb20..96264e88 100644 --- a/lib/dvb/scan.h +++ b/lib/dvb/scan.h @@ -65,7 +65,7 @@ public: void start(const std::list<ePtr<iDVBFrontendParameters> > &known_transponders); - enum { evtUpdate, evtFinish }; + enum { evtUpdate, evtFinish, evtFail }; RESULT connectEvent(const Slot1<void,int> &event, ePtr<eConnection> &connection); void insertInto(iDVBChannelList *db); diff --git a/lib/gui/elistbox.cpp b/lib/gui/elistbox.cpp index 361d7b99..1dae137f 100644 --- a/lib/gui/elistbox.cpp +++ b/lib/gui/elistbox.cpp @@ -1,9 +1,22 @@ #include <lib/gui/elistbox.h> #include <lib/gui/elistboxcontent.h> +#include <lib/actions/action.h> eListbox::eListbox(eWidget *parent): eWidget(parent) { setContent(new eListboxStringContent()); + + ePtr<eActionMap> ptr; + eActionMap::getInstance(ptr); + + ptr->bindAction("ListboxActions", 0, 0, this); +} + +eListbox::~eListbox() +{ + ePtr<eActionMap> ptr; + eActionMap::getInstance(ptr); + ptr->unbindAction(this, 0); } void eListbox::setContent(iListboxContent *content) @@ -108,6 +121,9 @@ int eListbox::event(int event, void *data, void *data2) return 0; } + case evtAction: + moveSelection((int)data2); + return 1; default: return eWidget::event(event, data, data2); } diff --git a/lib/gui/elistbox.h b/lib/gui/elistbox.h index 9ec94665..78e0fbe9 100644 --- a/lib/gui/elistbox.h +++ b/lib/gui/elistbox.h @@ -50,14 +50,26 @@ class eListbox: public eWidget { public: eListbox(eWidget *parent); + ~eListbox(); void setContent(iListboxContent *content); +/* enum Movement { + moveUp, + moveDown, + moveTop, + moveEnd, + justCheck + }; */ + void moveSelection(int how); - enum { + + enum ListboxActions { moveUp, moveDown, moveTop, moveEnd, + pageUp, + pageDown, justCheck }; protected: diff --git a/lib/gui/ewidget.h b/lib/gui/ewidget.h index fa8cd8ca..12d2e743 100644 --- a/lib/gui/ewidget.h +++ b/lib/gui/ewidget.h @@ -73,6 +73,8 @@ public: evtWillChangePosition, /* new size is eRect *data */ evtWillChangeSize, + evtAction, + evtUserWidget, }; virtual int event(int event, void *data = 0, void *data2 = 0); diff --git a/lib/gui/ewindowstyle.cpp b/lib/gui/ewindowstyle.cpp index a5ace37a..ccf7299f 100644 --- a/lib/gui/ewindowstyle.cpp +++ b/lib/gui/ewindowstyle.cpp @@ -10,16 +10,16 @@ DEFINE_REF(eWindowStyleSimple); eWindowStyleSimple::eWindowStyleSimple() { - m_border_left = m_border_right = m_border_bottom = 1; + m_border_left = m_border_right = m_border_bottom = 2; m_border_top = 30; m_fnt = new gFont("Arial", 25); - m_border_color_tl = gColor(0x14); - m_border_color_br = gColor(0x1c); + m_border_color_tl = gColor(0x1f); + m_border_color_br = gColor(0x14); m_title_color_back = gColor(0x20); m_title_color = gColor(0x2f); - m_background_color = gColor(0x18); + m_background_color = gColor(0x19); } void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size) @@ -36,19 +36,27 @@ void eWindowStyleSimple::handleNewSize(eWindow *wnd, const eSize &size) void eWindowStyleSimple::paintWindowDecoration(eWindow *wnd, gPainter &painter, const std::string &title) { + painter.setForegroundColor(m_title_color_back); + painter.fill(eRect(2, 2, wnd->size().width() - 4, m_border_top - 4)); painter.setBackgroundColor(m_title_color_back); painter.setForegroundColor(m_title_color); - painter.clear(); painter.setFont(m_fnt); - painter.renderText(eRect(1, 1, wnd->size().width() - 2, m_border_top - 2), title); + painter.renderText(eRect(3, 3, wnd->size().width() - 6, m_border_top - 6), title); eRect frame(ePoint(0, 0), wnd->size()); - painter.setForegroundColor(m_border_color_tl); + + painter.setForegroundColor(m_background_color); painter.line(frame.topLeft1(), frame.topRight1()); - painter.line(frame.topRight1(), frame.bottomRight1()); + painter.line(frame.topLeft1(), frame.bottomLeft1()); + painter.setForegroundColor(m_border_color_tl); + painter.line(frame.topLeft1()+eSize(1,1), frame.topRight1()+eSize(0,1)); + painter.line(frame.topLeft1()+eSize(1,1), frame.bottomLeft1()+eSize(1,0)); + painter.setForegroundColor(m_border_color_br); - painter.line(frame.bottomRight1(), frame.bottomLeft1()); - painter.line(frame.bottomLeft1(), frame.topLeft1()); + painter.line(frame.bottomLeft()+eSize(1,-1), frame.bottomRight()+eSize(0,-1)); + painter.line(frame.topRight1()+eSize(-1,1), frame.bottomRight1()+eSize(-1, 0)); + painter.line(frame.bottomLeft()+eSize(1,-2), frame.bottomRight()+eSize(0,-2)); + painter.line(frame.topRight1()+eSize(-0,1), frame.bottomRight1()+eSize(-0, 0)); } void eWindowStyleSimple::paintBackground(gPainter &painter, const ePoint &offset, const eSize &size) diff --git a/lib/nav/core.cpp b/lib/nav/core.cpp index 10d18e32..99dcf2ec 100644 --- a/lib/nav/core.cpp +++ b/lib/nav/core.cpp @@ -14,11 +14,10 @@ void eNavigation::serviceEvent(iPlayableService* service, int event) case iPlayableService::evEnd: assert(m_playlist); /* we need to have a playlist */ - /* at first, kill the running service */ - m_event(this, evStopService); - m_runningService = 0; - m_service_event_conn = 0; - /* our running main service stopped. identify what to do next. */ + /* at first, kill the running service */ + stopService(); + + /* our running main service stopped. identify what to do next. */ /* unless the playlist current position is invalid (because there was */ /* playlist, for example when the service was engaged with playService */ @@ -41,6 +40,9 @@ void eNavigation::serviceEvent(iPlayableService* service, int event) case iPlayableService::evStart: m_event(this, evNewService); break; + case iPlayableService::evUpdatedEventInfo: + m_event(this, evUpdatedEventInfo); + break; default: break; } @@ -48,6 +50,8 @@ void eNavigation::serviceEvent(iPlayableService* service, int event) RESULT eNavigation::playService(const eServiceReference &service) { + stopService(); + assert(m_servicehandler); RESULT res = m_servicehandler->play(service, m_runningService); if (m_runningService) @@ -97,6 +101,20 @@ RESULT eNavigation::getPlaylist(ePtr<ePlaylist> &playlist) return 0; } +RESULT eNavigation::stopService(void) +{ + /* check if there is a running service... */ + if (!m_runningService) + return 1; + /* send stop event */ + m_event(this, evStopService); + + /* kill service. */ + m_runningService = 0; + m_service_event_conn = 0; + return 0; +} + RESULT eNavigation::pause(int dop) { if (!m_runningService) diff --git a/lib/nav/core.h b/lib/nav/core.h index db438412..c049e43d 100644 --- a/lib/nav/core.h +++ b/lib/nav/core.h @@ -23,7 +23,8 @@ public: evStopService, /** the "current" service was just stopped and likes to be deallocated (clear refs!) */ evNewService, /** a new "current" service was just started */ evPlayFailed, /** the next service (in playlist) or the one given in playService failed to play */ - evPlaylistDone /** the last service in the playlist was just played */ + evPlaylistDone, /** the last service in the playlist was just played */ + evUpdatedEventInfo /** the "currently running" event info was updated */ }; RESULT playService(const eServiceReference &service); @@ -32,6 +33,7 @@ public: /* int connectServiceEvent(const Slot1<void,iPlayableService*,int> &event, ePtr<eConnection> &connection); */ RESULT getCurrentService(ePtr<iPlayableService> &service); RESULT getPlaylist(ePtr<ePlaylist> &playlist); + RESULT stopService(void); RESULT pause(int p); eNavigation(iServiceHandler *serviceHandler); diff --git a/lib/nav/pcore.cpp b/lib/nav/pcore.cpp index 7b61ce5c..2d036a1e 100644 --- a/lib/nav/pcore.cpp +++ b/lib/nav/pcore.cpp @@ -1,5 +1,7 @@ #include <lib/nav/pcore.h> #include <lib/service/service.h> +#include <lib/service/event.h> +#include <lib/base/eerror.h> DEFINE_REF(pNavigation); @@ -10,6 +12,8 @@ pNavigation::pNavigation() assert(service_center); m_core = new eNavigation(service_center); + + m_core->connectEvent(slot(*this, &pNavigation::navEvent), m_nav_event_connection); } RESULT pNavigation::playService(const eServiceReference &service) @@ -36,3 +40,26 @@ RESULT pNavigation::pause(int p) { return m_core->pause(p); } + +void pNavigation::navEvent(eNavigation *nav, int event) +{ + /* just relay the events here. */ + switch (event) + { + case eNavigation::evStopService: + m_event(evStopService); + break; + case eNavigation::evNewService: + m_event(evNewService); + break; + case eNavigation::evPlayFailed: + m_event(evPlayFailed); + break; + case eNavigation::evPlaylistDone: + m_event(evPlaylistDone); + break; + case eNavigation::evUpdatedEventInfo: + m_event(evUpdatedEventInfo); + break; + } +} diff --git a/lib/nav/pcore.h b/lib/nav/pcore.h index 3bb8f4ef..004bab27 100644 --- a/lib/nav/pcore.h +++ b/lib/nav/pcore.h @@ -6,13 +6,20 @@ /* a subset of eNavigation */ -class pNavigation: public iObject +class pNavigation: public iObject, public Object { DECLARE_REF; -private: - ePtr<eNavigation> m_core; public: - PSignal1<void, int> event; + PSignal1<void, int> m_event; + + enum + { + evStopService, /** the "current" service was just stopped and likes to be deallocated (clear refs!) */ + evNewService, /** a new "current" service was just started */ + evPlayFailed, /** the next service (in playlist) or the one given in playService failed to play */ + evPlaylistDone, /** the last service in the playlist was just played */ + evUpdatedEventInfo /** the "currently running" event info was updated */ + }; pNavigation(); @@ -22,6 +29,10 @@ public: RESULT getPlaylist(ePtr<ePlaylist> &playlist); RESULT pause(int p); +private: + ePtr<eNavigation> m_core; + ePtr<eConnection> m_nav_event_connection; + void navEvent(eNavigation *nav, int event); }; #endif diff --git a/lib/python/enigma_python.i b/lib/python/enigma_python.i index 3562c3e9..33fc0a14 100644 --- a/lib/python/enigma_python.i +++ b/lib/python/enigma_python.i @@ -29,8 +29,7 @@ Oh, things like "operator= is private in this context" etc. -is usually caused by not marking PSignals as immutable. - +is usually caused by not marking PSignals as immutable. */ %define RefCount(...) @@ -48,6 +47,7 @@ is usually caused by not marking PSignals as immutable. #include <lib/base/econfig.h> #include <lib/service/iservice.h> #include <lib/service/service.h> +#include <lib/service/event.h> #include <lib/gui/ewidget.h> #include <lib/gui/elabel.h> @@ -61,6 +61,7 @@ is usually caused by not marking PSignals as immutable. #include <lib/service/listboxservice.h> #include <lib/components/scan.h> #include <lib/nav/pcore.h> +#include <lib/actions/action.h> extern void runMainloop(); extern void quitMainloop(); @@ -73,6 +74,7 @@ RefCount(eListboxServiceContent) RefCount(eComponentScan) #define DEBUG +%include "typemaps.i" %include "stl.i" %include <lib/base/object.h> %include <lib/base/eerror.h> @@ -81,12 +83,13 @@ RefCount(eComponentScan) %include <lib/service/iservice.h> %include <lib/service/service.h> %template(eServiceCenterPtr) ePtr<eServiceCenter>; +%include <lib/service/event.h> // TODO: embed these... %immutable eButton::selected; %immutable eComponentScan::statusChanged; -%immutable pNavigation::event; +%immutable pNavigation::m_event; %include <lib/gdi/epoint.h> %include <lib/gdi/erect.h> @@ -103,6 +106,16 @@ RefCount(eComponentScan) %include <lib/service/listboxservice.h> %include <lib/components/scan.h> %include <lib/nav/pcore.h> +%include <lib/actions/action.h> + +/************** eptr **************/ + +%template(eActionMapPtr) ePtr<eActionMap>; +RefCount(eActionMap) +%apply eActionMapPtr OUTPUT { eActionMapPtr &ptr } +%apply eActionMap* *OUTPUT { eActionMap **ptr } + +/************** signals **************/ template<class R> class PSignal0 { diff --git a/lib/service/event.h b/lib/service/event.h index 967f9efa..094b080a 100644 --- a/lib/service/event.h +++ b/lib/service/event.h @@ -1,5 +1,5 @@ -#ifndef __service_ievent_h -#define __service_ievent_h +#ifndef __lib_service_event_h +#define __lib_service_event_h #include <time.h> #include <lib/base/object.h> @@ -18,4 +18,6 @@ public: RESULT parseFrom(Event *evt); }; +TEMPLATE_TYPEDEF(ePtr<eServiceEvent>, eServiceEventPtr); + #endif diff --git a/lib/service/iservice.h b/lib/service/iservice.h index f699bdb9..c58421ed 100644 --- a/lib/service/iservice.h +++ b/lib/service/iservice.h @@ -6,14 +6,6 @@ #include <connection.h> #include <list> -#ifdef SWIG -#define TEMPLATE_TYPEDEF(x, y) \ -%template(y) x; \ -typedef x y -#else -#define TEMPLATE_TYPEDEF(x, y) typedef x y -#endif - class eServiceReference { public: @@ -184,7 +176,7 @@ public: evEnd, // when iServiceInformation is implemented: - evNewEvent + evUpdatedEventInfo }; virtual RESULT connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection)=0; virtual RESULT start()=0; diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp index 06b6d97f..48d00d65 100644 --- a/lib/service/servicedvb.cpp +++ b/lib/service/servicedvb.cpp @@ -146,6 +146,7 @@ eDVBServicePlay::~eDVBServicePlay() void eDVBServicePlay::gotNewEvent() { +#if 0 // debug only ePtr<eServiceEvent> m_event_now, m_event_next; getEvent(m_event_now, 0); @@ -155,6 +156,8 @@ void eDVBServicePlay::gotNewEvent() eDebug("now running: %s (%d seconds :)", m_event_now->m_event_name.c_str(), m_event_now->m_duration); if (m_event_next) eDebug("next running: %s (%d seconds :)", m_event_next->m_event_name.c_str(), m_event_next->m_duration); +#endif + m_event((iPlayableService*)this, evUpdatedEventInfo); } void eDVBServicePlay::serviceEvent(int event) @@ -254,7 +257,8 @@ RESULT eDVBServicePlay::stop() RESULT eDVBServicePlay::connectEvent(const Slot2<void,iPlayableService*,int> &event, ePtr<eConnection> &connection) { - return -1; + connection = new eConnection((iPlayableService*)this, m_event.connect(event)); + return 0; } RESULT eDVBServicePlay::pause(ePtr<iPauseableService> &ptr) diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h index 941ad7bd..2e8d899a 100644 --- a/lib/service/servicedvb.h +++ b/lib/service/servicedvb.h @@ -51,6 +51,7 @@ private: void gotNewEvent(); void serviceEvent(int event); + Signal2<void,iPlayableService*,int> m_event; public: virtual ~eDVBServicePlay(); |
