aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFelix Domke <tmbinc@elitedvb.net>2005-11-13 15:30:08 +0000
committerFelix Domke <tmbinc@elitedvb.net>2005-11-13 15:30:08 +0000
commit2e2cf81de863a180f7d27dca89e5122e1eb0acaa (patch)
treefd265abbe20eb76d434682a95df9e0f4aea52285 /lib
parentab92ba5e6b439cb9a0aabc8c9330ec7d4ad9b301 (diff)
downloadenigma2-2e2cf81de863a180f7d27dca89e5122e1eb0acaa.tar.gz
enigma2-2e2cf81de863a180f7d27dca89e5122e1eb0acaa.zip
add iMutableServiceList
Diffstat (limited to 'lib')
-rw-r--r--lib/service/iservice.h16
-rw-r--r--lib/service/servicedvb.cpp44
-rw-r--r--lib/service/servicedvb.h12
-rw-r--r--lib/service/servicefs.cpp6
-rw-r--r--lib/service/servicefs.h1
5 files changed, 78 insertions, 1 deletions
diff --git a/lib/service/iservice.h b/lib/service/iservice.h
index 15631fda..5f861899 100644
--- a/lib/service/iservice.h
+++ b/lib/service/iservice.h
@@ -249,6 +249,20 @@ TEMPLATE_TYPEDEF(ePtr<iRecordableService>, iRecordableServicePtr);
// TEMPLATE_TYPEDEF(std::list<eServiceReference>, eServiceReferenceList);
+class iMutableServiceList: public iObject
+{
+public:
+ /* adds a service to a list */
+ virtual RESULT addService(eServiceReference &ref)=0;
+ /* removes a service from a list */
+ virtual RESULT removeService(eServiceReference &ref)=0;
+ /* moves a service in a list, only if list suppports a specific sort method. */
+ /* pos is the new, absolute position from 0..size-1 */
+ virtual RESULT moveService(eServiceReference &ref, int pos)=0;
+};
+
+TEMPLATE_TYPEDEF(ePtr<iMutableServiceList>, iMutableServiceListPtr);
+
class iListableService: public iObject
{
public:
@@ -264,6 +278,8 @@ public:
(as well as a future "active" extension) won't be possible.
*/
virtual int compareLessEqual(const eServiceReference &, const eServiceReference &)=0;
+
+ virtual SWIG_VOID(RESULT) startEdit(ePtr<iMutableServiceList> &SWIG_OUTPUT)=0;
};
TEMPLATE_TYPEDEF(ePtr<iListableService>, iListableServicePtr);
diff --git a/lib/service/servicedvb.cpp b/lib/service/servicedvb.cpp
index 76b0089c..94833f44 100644
--- a/lib/service/servicedvb.cpp
+++ b/lib/service/servicedvb.cpp
@@ -270,6 +270,50 @@ int eDVBServiceList::compareLessEqual(const eServiceReference &a, const eService
return m_query->compareLessEqual((const eServiceReferenceDVB&)a, (const eServiceReferenceDVB&)b);
}
+RESULT eDVBServiceList::startEdit(ePtr<iMutableServiceList> &res)
+{
+ if (m_parent.flags & eServiceReference::flagDirectory) // bouquet
+ {
+ ePtr<iDVBChannelList> db;
+ ePtr<eDVBResourceManager> resm;
+
+ if (eDVBResourceManager::getInstance(resm) || resm->getChannelList(db))
+ return -1;
+
+ // FIXME!
+ if (db->getBouquet(m_parent, (const eBouquet*&)m_bouquet) != 0)
+ return -1;
+
+ res = this;
+
+ return 0;
+ }
+ res = 0;
+ return -1;
+}
+
+RESULT eDVBServiceList::addService(eServiceReference &ref)
+{
+ ASSERT(m_bouquet);
+// return m_bouquet->addService(ref);
+ return -1;
+}
+
+RESULT eDVBServiceList::removeService(eServiceReference &ref)
+{
+ ASSERT(m_bouquet);
+// return m_bouquet->removeService(ref);
+ return -1;
+}
+
+RESULT eDVBServiceList::moveService(eServiceReference &ref, int pos)
+{
+ ASSERT(m_bouquet);
+
+// return m_bouquet->moveService(ref, pos);
+ return -1;
+}
+
RESULT eServiceFactoryDVB::play(const eServiceReference &ref, ePtr<iPlayableService> &ptr)
{
ePtr<eDVBService> service;
diff --git a/lib/service/servicedvb.h b/lib/service/servicedvb.h
index 9ebd2773..165703dd 100644
--- a/lib/service/servicedvb.h
+++ b/lib/service/servicedvb.h
@@ -25,7 +25,9 @@ private:
RESULT lookupService(ePtr<eDVBService> &ptr, const eServiceReference &ref);
};
-class eDVBServiceList: public iListableService
+class eBouquet;
+
+class eDVBServiceList: public iListableService, public iMutableServiceList
{
DECLARE_REF(eDVBServiceList);
public:
@@ -33,12 +35,20 @@ public:
RESULT getContent(std::list<eServiceReference> &list);
RESULT getNext(eServiceReference &ptr);
int compareLessEqual(const eServiceReference &a, const eServiceReference &b);
+
+ RESULT startEdit(ePtr<iMutableServiceList> &);
+ RESULT addService(eServiceReference &ref);
+ RESULT removeService(eServiceReference &ref);
+ RESULT moveService(eServiceReference &ref, int pos);
private:
RESULT startQuery();
eServiceReference m_parent;
friend class eServiceFactoryDVB;
eDVBServiceList(const eServiceReference &parent);
ePtr<iDVBChannelListQuery> m_query;
+
+ /* for editing purposes. WARNING: lifetime issue! */
+ eBouquet *m_bouquet;
};
class eDVBServicePlay: public iPlayableService, public iPauseableService, public iSeekableService, public Object, public iServiceInformation
diff --git a/lib/service/servicefs.cpp b/lib/service/servicefs.cpp
index cf3f31f6..1afdd169 100644
--- a/lib/service/servicefs.cpp
+++ b/lib/service/servicefs.cpp
@@ -176,4 +176,10 @@ int eServiceFS::compareLessEqual(const eServiceReference &a, const eServiceRefer
return a.path < b.path;
}
+RESULT eServiceFS::startEdit(ePtr<iMutableServiceList> &res)
+{
+ res = 0;
+ return -1;
+}
+
eAutoInitPtr<eServiceFactoryFS> init_eServiceFactoryFS(eAutoInitNumbers::service+1, "eServiceFactoryFS");
diff --git a/lib/service/servicefs.h b/lib/service/servicefs.h
index 3400fb85..46e8b890 100644
--- a/lib/service/servicefs.h
+++ b/lib/service/servicefs.h
@@ -37,6 +37,7 @@ public:
RESULT getContent(std::list<eServiceReference> &list);
RESULT getNext(eServiceReference &ptr);
int compareLessEqual(const eServiceReference &, const eServiceReference &);
+ RESULT startEdit(ePtr<iMutableServiceList> &);
};
#endif