From 693e723e590ebb3f0425e44f44e55b4d5b79d81f Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Tue, 13 Dec 2005 01:50:01 +0000 Subject: [PATCH] Half way to saying no such channel if there isnt. --- vvideolive.cc | 36 +++++++++++++++++++++--------------- vvideolive.h | 7 +++---- 2 files changed, 24 insertions(+), 19 deletions(-) diff --git a/vvideolive.cc b/vvideolive.cc index a340c96..6a39630 100644 --- a/vvideolive.cc +++ b/vvideolive.cc @@ -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); diff --git a/vvideolive.h b/vvideolive.h index 2d865c6..a6eca71 100644 --- a/vvideolive.h +++ b/vvideolive.h @@ -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; }; -- 2.39.5