aboutsummaryrefslogtreecommitdiff
path: root/lib/nav
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-02-25 01:46:44 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-02-25 01:46:44 +0000
commit1cdf6cb021fcaa6548b90ba7b6765cf1e8b8b37b (patch)
tree5bd4dbac6538cf499f641849d26193958b48a187 /lib/nav
parente677ac4a7bf81391877c909a703e5918ce4a511b (diff)
downloadenigma2-1cdf6cb021fcaa6548b90ba7b6765cf1e8b8b37b.tar.gz
enigma2-1cdf6cb021fcaa6548b90ba7b6765cf1e8b8b37b.zip
- work on actions
- changed time when screens are acutally constructed - added service name (not working atm) and event info (now&next)
Diffstat (limited to 'lib/nav')
-rw-r--r--lib/nav/core.cpp28
-rw-r--r--lib/nav/core.h4
-rw-r--r--lib/nav/pcore.cpp27
-rw-r--r--lib/nav/pcore.h19
4 files changed, 68 insertions, 10 deletions
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