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
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
*/
#include "viewman.h"
+#include "command.h"
ViewMan* ViewMan::instance = NULL;
// 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;
}
retVal2 = 2;
}
-// Log::getInstance()->log("ViewMan", Log::DEBUG, "out of handlecommand code, now on to messages");
-
-// processMessageQueue();
-
return retVal2;
}
/* 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;
#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();
m->to = parent;
m->parameter = (ULONG)optionChanges;
Command::getInstance()->postMessageNoLock(m);
-
}
-
void VOptions::processMessage(Message* m)
{
if (m->message == Message::MOUSE_MOVE)
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);
VDR* vdr;
int* optionsAtStart;
ViewMan* viewman;
- View* parent;
+ void* parent;
};
#endif
}
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:
#include "video.h"
#include "wbutton.h"
#include "i18n.h"
-#include "vwelcome.h"
#include "voptions.h"
class VOptionsMenu : public View
{
}
-void VRecMove::setParent(View* tparent)
+void VRecMove::setParent(void* tparent)
{
parent = tparent;
}
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);
#include "vtimerlist.h"
-VTimerList::VTimerList(RecTimerList* trtl)
+VTimerList::VTimerList()
{
- recTimerList = trtl;
+ recTimerList = NULL;
clockRegion.x = 420;
clockRegion.y = 0;
drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
-
- insertData();
- sl.draw();
- drawShowing();
- drawIndicators();
drawClock();
}
}
}
-void VTimerList::insertData()
+bool VTimerList::load()
{
+ recTimerList = VDR::getInstance()->getRecTimersList();
+
+ if (!recTimerList) return false;
+
char strA[300];
char strB[300];
sl.addOption(strB, (ULONG)recTimer, first);
first = 0;
}
+
+ sl.draw();
+ drawShowing();
+ drawIndicators();
+ ViewMan::getInstance()->updateView(this);
+ return true;
}
void VTimerList::drawClock()
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();
#include "vwelcome.h"
-VWelcome* VWelcome::instance = NULL;
-
VWelcome::VWelcome()
{
- instance = this;
-
viewman = ViewMan::getInstance();
clockRegion.x = 400;
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);
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()
return 2;
}
#endif
- }
+ // Test
+// case Remote::BACK:
+// {
+// return 4;
+// }
+
+ }
return 1;
}
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();
}
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)
#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;