]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Half way to saying no such channel if there isnt.
authorChris Tallon <chris@vomp.tv>
Tue, 13 Dec 2005 01:50:01 +0000 (01:50 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 13 Dec 2005 01:50:01 +0000 (01:50 +0000)
vvideolive.cc
vvideolive.h

index a340c9633002531938786a2fb3e07d313fc6977e..6a39630264175c9d79caed2eb7f4a8fb6dd2ef6f 100644 (file)
@@ -154,7 +154,21 @@ void VVideoLive::channelChange(UCHAR changeType, UINT newData)
   }
   else if (changeType == NUMBER)
   {
-    newChannel = channelIndexFromNumber(newData);
+    UINT i;
+    for(i = 0; i < chanList->size(); i++)
+    {
+      if ((*chanList)[i]->number == (UINT)newData)
+      {
+        newChannel = i;
+        break;
+      }
+    }
+
+    if (i == chanList->size())
+    {
+      doNoSuchChannel();
+      return;
+    }
   }
   else if (changeType == OFFSET)
   {
@@ -247,6 +261,12 @@ void VVideoLive::doBanner(bool bannerTakesCommands)
   viewman->postMessage(m);
 }
 
+void VVideoLive::doNoSuchChannel()
+{
+  Log::getInstance()->log("VVideoLive", Log::ERR, "No such channel");
+  // FIXME do gui for this
+}
+
 void VVideoLive::showUnavailable(int active)
 {
   if (active == unavailable) return;
@@ -330,20 +350,6 @@ UINT VVideoLive::downChannel()
     return currentChannel - 1;
 }
 
-UINT VVideoLive::channelIndexFromNumber(int number)
-{
-  for(UINT i = 0; i < chanList->size(); i++)
-  {
-    if ((*chanList)[i]->number == (UINT)number) return i;
-  }
-  return 0;
-}
-
-UINT VVideoLive::getCurrentChannelIndex()
-{
-  return channelIndexFromNumber(currentChannel);
-}
-
 void VVideoLive::showEPG()
 {
   if (unavailable) showUnavailable(0);
index 2d865c6265e45282338c392b06443976b005bd5a..a6eca7126cfbc2234bfe623560ea2f859c651fba 100644 (file)
@@ -61,7 +61,6 @@ class VVideoLive : public View
 
     void play(int noShowVLB = 0);
     void stop(int noRemoveVLB = 0);
-    UINT getCurrentChannelIndex();
     void setEpgMode(bool mode);
 
     const static UCHAR INDEX = 1;
@@ -77,8 +76,8 @@ class VVideoLive : public View
     VDR* vdr;
     Player* player;
     ChannelList* chanList;
-    UINT currentChannel;
-    UINT previousChannel;
+    UINT currentChannel;       // index in list
+    UINT previousChannel;      // index in list
     int unavailable;
     VInfo* unavailableView;
     ULONG streamType;
@@ -87,11 +86,11 @@ class VVideoLive : public View
     UINT downChannel();
     void doBanner(bool takesCommands);
     void showUnavailable(int active);
-    UINT channelIndexFromNumber(int number);
     VEpg* vepg;
     int xpos;
     bool epgmode;
     void showEPG();
+    void doNoSuchChannel();
     int videoMode;
 };