#include "vrecordinglist.h"
-VRecordingList::VRecordingList()
+VRecordingList::VRecordingList(VRecordingList* parent)
{
+ myParent = parent;
+ dataInvalid = 0;
+
if (Video::getInstance()->getFormat() == Video::PAL)
{
setScreenPos(80, 70);
void VRecordingList::setDir(Directory* tdir)
{
recDir = tdir;
+
+ drawData();
+
+ char title[300];
+ if (!recDir->isRoot)
+ {
+ snprintf(title, 299, "Recordings - %s", recDir->name);
+ setTitleText(title);
+ }
+ else
+ {
+ setTitleText("Recordings");
+ }
+}
+
+void VRecordingList::drawData()
+{
+ sl.clear();
+
int first = 1;
char tempA[300]; // FIXME this is guesswork!
recDir->dirList->reset();
while((dir = (Directory*)recDir->dirList->getCurrent()))
{
+ if (dir->getNumRecordings() == 0)
+ {
+ recDir->dirList->remove(dir);
+ continue;
+ }
+
strcpy(spaces, " ");
theNumberLength = snprintf(theNumber, 9, "%lu", dir->getNumRecordings());
dir->index = sl.addOption(tempA, first);
first = 0;
+
recDir->dirList->next();
}
recList->next();
}
- if (!recDir->isRoot)
- {
- snprintf(tempA, 299, "Recordings - %s", recDir->name);
- setTitleText(tempA);
- }
- else
- {
- setTitleText("Recordings");
- }
+ dataInvalid = 0;
}
void VRecordingList::draw()
{
View::draw();
+
+ if (dataInvalid) drawData();
+
sl.draw();
// Put the status stuff at the bottom
doResume();
return;
}
+
+ if (m->message == Message::REDRAW_DATA)
+ {
+ dataInvalid = 1;
+ return;
+ }
}
void VRecordingList::doDeleteSelected()
draw();
}
+ if (myParent) // if this is not root send a message to parent to say redraw data
+ {
+ Message* m1 = new Message();
+ m1->to = myParent;
+ m1->message = Message::REDRAW_DATA;
+ ViewMan::getInstance()->postMessage(m1);
+ }
+
Message* m2 = new Message();
m2->from = this;
m2->to = ViewMan::getInstance();
{
if (curDir->index == sl.getCurrentOption())
{
- VRecordingList* sub = new VRecordingList();
+ VRecordingList* sub = new VRecordingList(this);
sub->setDir(curDir);
ViewMan::getInstance()->addNoLock(sub);