]> git.vomp.tv Git - vompclient-marten.git/commitdiff
Minor cleanup changes
authorChris Tallon <chris@vomp.tv>
Thu, 28 Dec 2006 18:42:43 +0000 (18:42 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 28 Dec 2006 18:42:43 +0000 (18:42 +0000)
14 files changed:
command.cc
message.h
viewman.cc
voptions.cc
voptions.h
voptionsmenu.cc
voptionsmenu.h
vrecmove.cc
vrecmove.h
vrecordinglist.cc
vtimerlist.cc
vtimerlist.h
vwelcome.cc
vwelcome.h

index 3aa36726dceefd4db15eaef3f6cde1e41a19d30a..1ab1417793019019fdbad724954e618419ccba51 100644 (file)
@@ -363,6 +363,26 @@ void Command::processMessage(Message* m)
         handleCommand(m->parameter);
         break;
       }
+      case Message::CHANGE_LANGUAGE:
+      {
+        viewman->removeAll();
+        viewman->updateView(wallpaper);
+        I18n::initialize();
+        VWelcome* vw = new VWelcome();
+        vw->draw();
+        viewman->add(vw);
+        viewman->updateView(vw);
+        break;
+      }
+      case Message::LAST_VIEW_CLOSE:
+      {
+//        VWelcome* vw = new VWelcome();
+//        vw->draw();
+//        viewman->add(vw);
+//        viewman->updateView(vw);
+
+        break;
+      }
     }
   }
   else
index a323b231378190771f4a4e2693750e054d22303d..146c89959202e4f9465ff4432ae9a8073f596836 100644 (file)
--- a/message.h
+++ b/message.h
@@ -69,6 +69,8 @@ class Message
     const static ULONG CHILD_CLOSE = 24;
     const static ULONG MOUSE_MOVE = 25;
     const static ULONG MOUSE_LBDOWN = 26;
+    const static ULONG CHANGE_LANGUAGE = 27;
+    const static ULONG LAST_VIEW_CLOSE = 28;
 };
 
 #endif
index 0a15620faa69b0d9e9a5e321767965be2051f903..c3e03a657083d844ead66022db14c5c66728ce0c 100644 (file)
@@ -19,6 +19,7 @@
 */
 
 #include "viewman.h"
+#include "command.h"
 
 ViewMan* ViewMan::instance = NULL;
 
@@ -111,6 +112,15 @@ int ViewMan::removeView(View* toDelete)
   // Delete the view
   delete toDelete;
 
+  // If there is only the wallpaper left signal command
+  if (numViews == 1)
+  {
+    Message* m = new Message();
+    m->to = Command::getInstance();
+    m->message = Message::LAST_VIEW_CLOSE;
+    Command::getInstance()->postMessageNoLock(m);
+  }
+
   return 1;
 }
 
@@ -391,10 +401,6 @@ int ViewMan::handleCommand(UCHAR command)
     retVal2 = 2;
   }
 
-//  Log::getInstance()->log("ViewMan", Log::DEBUG, "out of handlecommand code, now on to messages");
-
-//  processMessageQueue();
-
   return retVal2;
 }
 
@@ -416,7 +422,7 @@ void ViewMan::processMessage(Message* m)
 
   /* Handle mouse events*/
   // They come in with m->to = NULL? and just need to be delivered to top view?
-  if (numViews && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)))
+  if ((numViews > 1) && ((m->message == Message::MOUSE_MOVE) || (m->message == Message::MOUSE_LBDOWN)))
   {
     views[numViews-1]->processMessage(m);
     return;
index 719f56a962d04cce4fc0cedc86c4220b51e27d02..cd27c36434d51f47ec57c6f2f2769f31b748a3ee 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "voptions.h"
 
-VOptions::VOptions(View* tparent, const char* title, const OPTIONDATA* toptionData, const int tnumOptions)
+VOptions::VOptions(void* tparent, const char* title, const OPTIONDATA* toptionData, const int tnumOptions)
 {
   viewman = ViewMan::getInstance();
 
@@ -281,10 +281,8 @@ void VOptions::doSave()
   m->to = parent;
   m->parameter = (ULONG)optionChanges;
   Command::getInstance()->postMessageNoLock(m);
-
 }
 
-
 void VOptions::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_MOVE)
index 897b945a73d6901d0c60fbb503b0f5f34c6534de..9aec6b7f96a5fb4774a3c20f4a8156063cb391c1 100644 (file)
@@ -49,7 +49,7 @@ typedef struct
 class VOptions : public View
 {
   public:
-    VOptions(View* tparent, const char* title, const OPTIONDATA* toptionData, const int tnumOptions);
+    VOptions(void* tparent, const char* title, const OPTIONDATA* toptionData, const int tnumOptions);
     ~VOptions();
 
     int handleCommand(int command);
@@ -66,7 +66,7 @@ class VOptions : public View
     VDR* vdr;
     int* optionsAtStart;
     ViewMan* viewman;
-    View* parent;
+    void* parent;
 };
 
 #endif
index aeea3e6940b4cfe790abbd26effc356deebb4eb1..d5d90dff8a38ff7764008df25a1d56dbd1d21239 100644 (file)
@@ -217,8 +217,10 @@ void VOptionsMenu::doApplyChanges(map<int,int>* changedOptions)
       }
       case 2:
       {
-        I18n::initialize();
-        VWelcome::getInstance()->redrawLang();
+        Message* m = new Message();
+        m->message = Message::CHANGE_LANGUAGE;
+        m->to = Command::getInstance();
+        Command::getInstance()->postMessageNoLock(m);
         break;
       }
       case 3:
index f8cf20e0561edaa35b669a3e4d0b90494c19e828..7c2931563a143bae83f37f994931feab53929bc1 100644 (file)
@@ -31,7 +31,6 @@
 #include "video.h"
 #include "wbutton.h"
 #include "i18n.h"
-#include "vwelcome.h"
 #include "voptions.h"
 
 class VOptionsMenu : public View
index cfb7bc1ce483f96c31d4ad47b57daade0d3aeba2..8f410800ca28cbfb8eb0a0a3c6579037258daaec 100644 (file)
@@ -53,7 +53,7 @@ VRecMove::~VRecMove()
 {
 }
 
-void VRecMove::setParent(View* tparent)
+void VRecMove::setParent(void* tparent)
 {
   parent = tparent;
 }
index 183a21a681c3de4e70e8f5e103a59737fd0a2c0c..58d4a822c51452824816c9e8dd48c98b91d4029f 100644 (file)
@@ -43,14 +43,14 @@ class VRecMove : public View
   public:
     VRecMove(RecMan* recman);
     ~VRecMove();
-    void setParent(View* parent);
+    void setParent(void* parent);
 
     int handleCommand(int command);
     void draw();
     void processMessage(Message* m);
 
   private:
-    View* parent;
+    void* parent;
     RecMan* recman;
     WSelectList sl;
     void addDirs(Directory* dir, char* prefix);
index 3829d354ce2eeec1f6430d22040cf01d76b9fcd1..8c821fd49f8d65a914b8ce4cf9807e7b3da89aad 100644 (file)
@@ -484,4 +484,3 @@ bool VRecordingList::load()
 
   return success;
 }
-
index d616ccceca7b3711e2bc220a9266ee64e5550446..cccf503bf90a2412328a3684b783695b577adab8 100644 (file)
@@ -20,9 +20,9 @@
 
 #include "vtimerlist.h"
 
-VTimerList::VTimerList(RecTimerList* trtl)
+VTimerList::VTimerList()
 {
-  recTimerList = trtl;
+  recTimerList = NULL;
 
   clockRegion.x = 420;
   clockRegion.y = 0;
@@ -81,11 +81,6 @@ VTimerList::VTimerList(RecTimerList* trtl)
 
   drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
 
-
-  insertData();
-  sl.draw();
-  drawShowing();
-  drawIndicators();
   drawClock();
 }
 
@@ -104,8 +99,12 @@ VTimerList::~VTimerList()
   }
 }
 
-void VTimerList::insertData()
+bool VTimerList::load()
 {
+  recTimerList = VDR::getInstance()->getRecTimersList();
+
+  if (!recTimerList) return false;
+
   char strA[300];
   char strB[300];
 
@@ -129,6 +128,12 @@ void VTimerList::insertData()
     sl.addOption(strB, (ULONG)recTimer, first);
     first = 0;
   }
+
+  sl.draw();
+  drawShowing();
+  drawIndicators();
+  ViewMan::getInstance()->updateView(this);
+  return true;
 }
 
 void VTimerList::drawClock()
index f988f797917f74e16250118a2265e59558b65b87..2a251684fdfba1b7636d89fd3e40c59085f32c3b 100644 (file)
 class VTimerList : public View, public TimerReceiver
 {
   public:
-    VTimerList(RecTimerList* rtl);
+    VTimerList();
     ~VTimerList();
 
     int handleCommand(int command);
     void timercall(int clientReference);
     void processMessage(Message* m);
+    bool load();
 
   private:
     RecTimerList* recTimerList;
 
     WSelectList sl;
 
-    void insertData();
     void drawClock();
     void drawShowing();
     void drawData();
index 573b6ca085c628145bd309c0a09820536eb272ee..8ba5d7489b7b081ea95eb40e9c7c290e5d727fbc 100644 (file)
 
 #include "vwelcome.h"
 
-VWelcome* VWelcome::instance = NULL;
-
 VWelcome::VWelcome()
 {
-  instance = this;
-
   viewman = ViewMan::getInstance();
 
   clockRegion.x = 400;
@@ -51,26 +47,6 @@ VWelcome::VWelcome()
   sl.setSurfaceOffset(20, 40);
   sl.setDimensions(170, 140);
 
-  jpeg.setSurface(surface);
-  jpeg.setSurfaceOffset(240, 60);
-
-  setup();
-}
-
-VWelcome::~VWelcome()
-{
-  instance = NULL;
-  Timers::getInstance()->cancelTimer(this, 1);
-}
-
-VWelcome* VWelcome::getInstance()
-{
-  return instance;
-}
-
-void VWelcome::setup()
-{
-  sl.clear();
   setTitleText(tr("Welcome"));
   sl.addOption(tr("1. Live TV"), 1, 1);
   sl.addOption(tr("2. Radio"), 2, 0);
@@ -78,6 +54,14 @@ void VWelcome::setup()
   sl.addOption(tr("4. Timers"), 4, 0);
   sl.addOption(tr("5. Options"), 5, 0);
   sl.addOption(tr("6. Reboot"), 6, 0);
+
+  jpeg.setSurface(surface);
+  jpeg.setSurfaceOffset(240, 60);
+}
+
+VWelcome::~VWelcome()
+{
+  Timers::getInstance()->cancelTimer(this, 1);
 }
 
 void VWelcome::draw()
@@ -205,8 +189,14 @@ int VWelcome::handleCommand(int command)
       return 2;
     }
 #endif
-  }
 
+    // Test
+//    case Remote::BACK:
+//    {
+//      return 4;
+//    }
+
+  }
   return 1;
 }
 
@@ -263,16 +253,11 @@ void VWelcome::doRecordingsList()
 
 void VWelcome::doTimersList()
 {
-  RecTimerList* recTimerList = VDR::getInstance()->getRecTimersList();
-
-  if (recTimerList)
-  {
-    VTimerList* vtl = new VTimerList(recTimerList);
+  VTimerList* vtl = new VTimerList();
+  viewman->add(vtl);
+  viewman->updateView(vtl);
 
-    viewman->add(vtl);
-    viewman->updateView(vtl);
-  }
-  else
+  if (!vtl->load())
   {
     Command::getInstance()->connectionLost();
   }
@@ -286,13 +271,6 @@ void VWelcome::doOptions()
   viewman->updateView(voptionsmenu);
 }
 
-void VWelcome::redrawLang()
-{
-  Log::getInstance()->log("VWelcome", Log::DEBUG, "Got redraw lang message");
-  setup();
-  draw();
-}
-
 void VWelcome::processMessage(Message* m)
 {
   if (m->message == Message::MOUSE_MOVE)
index d2fce20b99bb39d49062ecc6254c5aefb4346bdd..258c04715b329aece40b475ea633a3ca184c4c05 100644 (file)
 #include "i18n.h"
 #include "timers.h"
 
-// FIXME - take out singleton when broadcast messages exist
-
 class VWelcome : public View, public TimerReceiver
 {
   public:
     VWelcome();
     ~VWelcome();
-    static VWelcome* getInstance();
 
-    void setup();
     int handleCommand(int command);
     void processMessage(Message* m);
     void draw();
     void timercall(int clientReference);
-    void redrawLang();
 
   private:
-    static VWelcome* instance;
-
     WSelectList sl;
     WJpeg jpeg;