logger->log("Timers", Log::DEBUG, "about to un-LOCK -TIMERS- MUTEX (1)");\r
threadWaitForSignalTimed(&nextTime); // FIXME does this work if the time is in the past?\r
logger->log("Timers", Log::DEBUG, "LOCKED -TIMERS- MUTEX 5");\r
- logger->log("Timers", Log::DEBUG, "FIXME CHECK does waitforsignaltimed work for time < now?");\r
\r
// unlocks in the wait\r
}\r
}
}
-/* For later...
-void ViewMan::update(int z)
+// FIXME - make this take a optional region for smaller updates (not whole views)
+void ViewMan::updateView(View* toUpdate, Region* regionToUpdate)
{
+ // Get the z index of the view
+
+ int z;
+ for (z = 0; z < numViews; z++)
+ {
+ if (views[z] == toUpdate) break;
+ }
+
+ if (z == numViews)
+ {
+ // not a View we have!
+ return;
+ }
+
// get the region for the whole view, could be less than that
// for smaller updates
Region r = views[z]->area;
- RegionList rl;
- r.y += 10;
+ if (regionToUpdate)
+ {
+ // Can be null if the whole view should be updated
+ // If this is given the numbers are relative to the size of the view, not the screen
+
+ r.x += regionToUpdate->x;
+ r.y += regionToUpdate->y;
+ r.w = regionToUpdate->w;
+ r.h = regionToUpdate->h;
+ }
+
+ RegionList rl;
Region r2;
boxSplit(r, z+1, numViews, 1, rl);
rl.pop_front();
}
}
-*/
void ViewMan::repaintRevealed(int x, Region r)
{
int add(View* v);
int removeView(View* toRemove);
void removeAll();
+ void updateView(View* toUpdate, Region* regionToUpdate = NULL);
int handleCommand(UCHAR command);
{
instance = this;
+ clockRegion.x = 400;
+ clockRegion.y = 0;
+ clockRegion.w = 60;
+ clockRegion.h = 30;
+
create(460, 200);
if (Video::getInstance()->getFormat() == Video::PAL)
{
VWelcome::~VWelcome()
{
+ Timers::getInstance()->cancelTimer(this, 1);
instance = NULL;
}
{
View::draw();
sl.draw();
+ jpeg.init("/vdr.jpg");
+ jpeg.draw();
+ drawClock();
+}
+
+void VWelcome::drawClock()
+{
+ // Blank the area first
+ rectangle(area.w - 60, 0, 60, 30, titleBarColour);
char timeString[20];
time_t t;
time(&t);
struct tm* tms = localtime(&t);
strftime(timeString, 19, "%H:%M", tms);
-
drawTextRJ(timeString, 450, 5, Colour::LIGHTTEXT);
+ time_t dt = 60 - (t % 60);
+ if (dt == 0) dt = 60;
+ Timers::getInstance()->setTimer(this, 1, (struct timespec){dt, 0});
+}
- jpeg.init("/vdr.jpg");
- jpeg.draw();
+void VWelcome::timercall(int clientReference)
+{
+ drawClock();
+ ViewMan::getInstance()->updateView(this, &clockRegion);
}
int VWelcome::handleCommand(int command)
{
switch(command)
{
+ case Remote::NINE:
+ {
+ VInfo* viewWait = new VInfo();
+ viewWait->create(100, 100);
+ viewWait->setScreenPos(485, 185);
+ viewWait->setTitleBarOn(0);
+ viewWait->setBackgroundColour(Colour::DANGER);
+ viewWait->draw();
+ viewWait->show();
+ ViewMan::getInstance()->add(viewWait);
+
+ return 2;
+ }
+
case Remote::DF_UP:
case Remote::UP:
{
#include "voptions.h"
#include "i18n.h"
-class VWelcome : public View
+class VWelcome : public View, public TimerReceiver
{
public:
VWelcome();
int handleCommand(int command);
void processMessage(Message* m);
void draw();
+ void timercall(int clientReference);
private:
static VWelcome* instance;
void doRadioList();
void doRecordingsList();
void doOptions();
+ void drawClock();
+
+ Region clockRegion;
};
#endif