]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Use vchannelselector on vchannellist
authorChris Tallon <chris@vomp.tv>
Thu, 15 Mar 2007 17:13:55 +0000 (17:13 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 15 Mar 2007 17:13:55 +0000 (17:13 +0000)
vaudioselector.h
vchannellist.cc
vchannellist.h
vchannelselect.cc
vchannelselect.h

index e1efc04019b73e91303224fe3add3a5defc99a96..1eff1b887c51496579f695c33e6197c7635251d5 100644 (file)
@@ -59,7 +59,7 @@ class VAudioSelector : public View
     ~VAudioSelector();
 
     int handleCommand(int command);
-  void processMessage(Message* m);
+    void processMessage(Message* m);
     void draw();
 
   private:
index f9aa5d47bc369d32cb3efa977821458efb2e3201..54a2882c32fd7f05c82f9e85623af750dc4722aa 100644 (file)
@@ -22,6 +22,7 @@
 
 VChannelList::VChannelList(ULONG type)
 {
+  viewman = ViewMan::getInstance();
   create(570, 420);
   if (Video::getInstance()->getFormat() == Video::PAL)
   {
@@ -93,7 +94,7 @@ void VChannelList::highlightChannel(Channel* chan)
   sl.hintSetCurrent(chan->index);
   sl.draw();
   doShowingBar();
-  ViewMan::getInstance()->updateView(this);
+  viewman->updateView(this);
 }
 
 void VChannelList::draw()
@@ -158,7 +159,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      viewman->updateView(this);
       return 2;
     }
     case Remote::DF_DOWN:
@@ -168,7 +169,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      viewman->updateView(this);
       return 2;
     }
     case Remote::SKIPBACK:
@@ -177,7 +178,7 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      viewman->updateView(this);
       return 2;
     }
     case Remote::SKIPFORWARD:
@@ -186,7 +187,24 @@ int VChannelList::handleCommand(int command)
       sl.draw();
 
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      viewman->updateView(this);
+      return 2;
+    }
+    case Remote::ZERO:
+    case Remote::ONE:
+    case Remote::TWO:
+    case Remote::THREE:
+    case Remote::FOUR:
+    case Remote::FIVE:
+    case Remote::SIX:
+    case Remote::SEVEN:
+    case Remote::EIGHT:
+    case Remote::NINE:
+    {
+      VChannelSelect* v = new VChannelSelect(this, command);
+      v->draw();
+      viewman->add(v);
+      viewman->updateView(v);
       return 2;
     }
     case Remote::OK:
@@ -199,8 +217,8 @@ int VChannelList::handleCommand(int command)
       VVideoLive* v = new VVideoLive(chanList, chan->type, this);
 
       v->draw();
-      ViewMan::getInstance()->add(v);
-      ViewMan::getInstance()->updateView(v);
+      viewman->add(v);
+      viewman->updateView(v);
 
       v->channelChange(VVideoLive::NUMBER, chan->number);
 
@@ -223,14 +241,14 @@ void VChannelList::processMessage(Message* m)
     {
       sl.draw();
       doShowingBar();
-      ViewMan::getInstance()->updateView(this);
+      viewman->updateView(this);
     }
   }
   else if (m->message == Message::MOUSE_LBDOWN)
   {
     if (sl.mouseLBDOWN((m->parameter>>16)-getScreenX(),(m->parameter&0xFFFF)-getScreenY()))
     {
-      ViewMan::getInstance()->handleCommand(Remote::OK); //simulate OK press
+      viewman->handleCommand(Remote::OK); //simulate OK press
     }
     else
     { //check if press is outside this view! then simulate cancel
@@ -238,8 +256,29 @@ void VChannelList::processMessage(Message* m)
       int y=(m->parameter&0xFFFF)-getScreenY();
       if (x<0 || y <0 || x>getWidth() || y>getHeight())
       {
-        ViewMan::getInstance()->handleCommand(Remote::BACK); //simulate cancel press
+        viewman->handleCommand(Remote::BACK); //simulate cancel press
+      }
+    }
+  }
+  else if (m->message == Message::CHANNEL_CHANGE)
+  {
+    bool isinlist = false;
+
+    for (UINT i = 0; i < chanList->size(); i++)
+    {
+      if ((*chanList)[i]->number == m->parameter)
+      {
+        isinlist = true;
+        break;
       }
     }
+    if (!isinlist) return;
+
+    VVideoLive* v = new VVideoLive(chanList, VDR::VIDEO, this); // FIXME - what's wrong with it?
+
+    v->draw();
+    viewman->add(v);
+    viewman->updateView(v);
+    v->channelChange(VVideoLive::NUMBER, m->parameter);
   }
 }
index a0b2cbd0d1672cd943e07f49e3bd4fc7e35e9d2e..04215737feffb299f8268d14c520bea997346ceb 100644 (file)
@@ -36,6 +36,7 @@
 #include "colour.h"
 #include "video.h"
 #include "i18n.h"
+#include "message.h"
 
 class VChannelList : public View
 {
@@ -45,12 +46,12 @@ class VChannelList : public View
 
     void setList(ChannelList* chanList);
     void highlightChannel(Channel* channel);
-
     void processMessage(Message* m);
     int handleCommand(int command);
     void draw();
 
   private:
+    ViewMan* viewman;
     ChannelList* chanList;
 
     WSelectList sl;
index 8df54f67528b34c6e619ffcda1bcfc48734ea456..ad1351cfb6b4ff04bebed43531d03be030f3b3ed 100644 (file)
@@ -23,7 +23,7 @@
 // this class only works as it does because the remote command
 // values for the numbers are the numbers themselves !
 
-VChannelSelect::VChannelSelect(VVideoLive* v, int command)
+VChannelSelect::VChannelSelect(View* v, int command)
 {
   create(53, 30);
   setScreenPos(80, 60);
@@ -35,7 +35,7 @@ VChannelSelect::VChannelSelect(VVideoLive* v, int command)
   third = command;
   numGot = 1;
 
-  videoLive = v;
+  parent = v;
 }
 
 VChannelSelect::~VChannelSelect()
@@ -156,7 +156,7 @@ int VChannelSelect::handleCommand(int command)
         {
           Message* m = new Message();
           m->from = this;
-          m->to = videoLive;
+          m->to = parent;
           m->message = Message::CHANNEL_CHANGE;
           m->parameter = (first * 100) + (second * 10) + third;
           Command::getInstance()->postMessageNoLock(m);
@@ -202,7 +202,7 @@ void VChannelSelect::timercall(int clientReference)
 
     m = new Message(); // Must be done after this view deleted
     m->from = this;
-    m->to = videoLive;
+    m->to = parent;
     m->message = Message::CHANNEL_CHANGE;
     m->parameter = newChannel;
     Command::getInstance()->postMessageFromOuterSpace(m);
index a1cc793c55706471e5783766424c55c3cdd1b360..814da3f70d1288bf9e302f7944639911b526abcf 100644 (file)
@@ -38,7 +38,7 @@ class VVideoLive;
 class VChannelSelect : public View, public TimerReceiver
 {
   public:
-    VChannelSelect(VVideoLive* v, int command);
+    VChannelSelect(View* v, int command);
     ~VChannelSelect();
 
     void draw();
@@ -52,7 +52,7 @@ class VChannelSelect : public View, public TimerReceiver
 
     int numGot;
 
-    VVideoLive* videoLive;
+    View* parent;
 };
 
 #endif