--- /dev/null
+/*
+ Copyright 2004-2005 Chris Tallon
+
+ This file is part of VOMP.
+
+ VOMP is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ VOMP is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with VOMP; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+#include "vtimeredit.h"
+
+VTimerEdit::VTimerEdit(RecTimer* trt)
+{
+ recTimer = trt;
+
+ create(570, 420);
+ if (Video::getInstance()->getFormat() == Video::PAL)
+ {
+ setScreenPos(80, 70);
+ }
+ else
+ {
+ setScreenPos(70, 35);
+ }
+
+
+ setBackgroundColour(Colour::VIEWBACKGROUND);
+ setTitleBarOn(1);
+ setTitleText(tr("Edit Timer"));
+ setTitleBarColour(Colour::TITLEBARBACKGROUND);
+
+
+ // Draw statics
+
+ draw(); // View::draw
+
+ int xpos = 20;
+ int ypos = 50;
+ drawText("Active", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Channel", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Name", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Directory", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ ypos += surface->getFontHeight();
+ drawText("Start", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Stop", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Priority", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Lifetime", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ ypos += surface->getFontHeight();
+ drawText("Current", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Recording", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ drawText("Summary", xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+
+ // Temp
+ char buffer[1000];
+ struct tm* tms;
+ xpos = 150;
+ ypos = 50;
+
+ // Active
+ if (recTimer->active) strcpy(buffer, "Yes");
+ else strcpy(buffer, "No");
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Channel
+ snprintf(buffer, 999, "%lu", recTimer->channelNumber);
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Name
+ snprintf(buffer, 999, "%s", recTimer->getName());
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Directory
+ if (recTimer->getDirectory()) snprintf(buffer, 999, "%s", recTimer->getDirectory());
+ else strcpy(buffer, "");
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ ypos += surface->getFontHeight();
+
+ // Start
+ tms = localtime((time_t*)&recTimer->startTime);
+ strftime(buffer, 999, "%d/%m %H:%M", tms);
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Stop
+ tms = localtime((time_t*)&recTimer->stopTime);
+ strftime(buffer, 999, "%d/%m %H:%M", tms);
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Priority
+ snprintf(buffer, 999, "%lu", recTimer->priority);
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Lifetime
+ snprintf(buffer, 999, "%lu", recTimer->lifeTime);
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+ ypos += surface->getFontHeight();
+
+ // Current
+ if (recTimer->pending) strcpy(buffer, "Yes");
+ else strcpy(buffer, "No");
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Recording now
+ if (recTimer->recording) strcpy(buffer, "Yes");
+ else strcpy(buffer, "No");
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+ // Summary
+ strcpy(buffer, "View summary");
+ drawText(buffer, xpos, ypos, Colour::LIGHTTEXT); ypos += surface->getFontHeight();
+
+
+}
+
+VTimerEdit::~VTimerEdit()
+{
+}
+
+int VTimerEdit::handleCommand(int command)
+{
+ switch(command)
+ {
+ case Remote::DF_UP:
+ case Remote::UP:
+ {
+
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::DF_DOWN:
+ case Remote::DOWN:
+ {
+
+ ViewMan::getInstance()->updateView(this);
+ return 2;
+ }
+ case Remote::OK:
+ {
+
+ return 2;
+ }
+ case Remote::BACK:
+ {
+ return 4;
+ }
+ }
+ // stop command getting to any more views
+ return 1;
+}
sl.setSurfaceOffset(10, 30 + 5);
sl.setDimensions(area.w - 20, area.h - 30 - 15 - 30);
- drawData();
+ // Draw statics
+
+ draw(); // View::draw
+
+ WSymbol w;
+ w.setSurface(surface);
+
+ w.nextSymbol = WSymbol::UP;
+ w.setSurfaceOffset(20, 385);
+ w.draw();
+
+ w.nextSymbol = WSymbol::DOWN;
+ w.setSurfaceOffset(50, 385);
+ w.draw();
+
+ w.nextSymbol = WSymbol::SKIPBACK;
+ w.setSurfaceOffset(85, 385);
+ w.draw();
+
+ w.nextSymbol = WSymbol::SKIPFORWARD;
+ w.setSurfaceOffset(115, 385);
+ w.draw();
+
+ drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
+
+
+ insertData();
+ sl.draw();
+ drawShowing();
+ drawClock();
}
VTimerList::~VTimerList()
}
}
-void VTimerList::drawData()
+void VTimerList::insertData()
{
char strA[300];
char strB[300];
+ char status;
struct tm* btime;
+ // FIXME all drawing stuff in this class and sl.clear somewhere?!
+
sl.addColumn(0);
- sl.addColumn(110);
+ sl.addColumn(130);
RecTimer* recTimer;
int first = 1;
for (UINT i = 0; i < recTimerList->size(); i++)
{
recTimer = (*recTimerList)[i];
+ if (recTimer->recording)
+ {
+ status = 'R';
+ }
+ else if (recTimer->pending)
+ {
+ status = 'X';
+ }
+ else if (recTimer->active == 0)
+ {
+ status = 'N';
+ }
+ else
+ {
+ status = 'O';
+ }
+
btime = localtime((time_t*)&recTimer->startTime);
strftime(strA, 299, "%d/%m %H:%M ", btime);
- snprintf(strB, 299, "%s\t%s", strA, recTimer->getName());
+ snprintf(strB, 299, "%c %s\t%s", status, strA, recTimer->getName());
recTimer->index = sl.addOption(strB, first);
first = 0;
}
Timers::getInstance()->setTimer(this, 1, t + 1);
}
-void VTimerList::draw()
-{
- View::draw();
- sl.draw();
-
- // Put the status stuff at the bottom
-
- WSymbol w;
- w.setSurface(surface);
-
- w.nextSymbol = WSymbol::UP;
- w.setSurfaceOffset(20, 385);
- w.draw();
-
- w.nextSymbol = WSymbol::DOWN;
- w.setSurfaceOffset(50, 385);
- w.draw();
-
- w.nextSymbol = WSymbol::SKIPBACK;
- w.setSurfaceOffset(85, 385);
- w.draw();
-
- w.nextSymbol = WSymbol::SKIPFORWARD;
- w.setSurfaceOffset(115, 385);
- w.draw();
-
- drawTextRJ("[ok] = edit", 560, 385, Colour::LIGHTTEXT);
-
- doShowingBar();
- drawClock();
-}
-
-void VTimerList::doShowingBar()
+void VTimerList::drawShowing()
{
int topOption = sl.getTopOption() + 1;
if (sl.getNumOptions() == 0) topOption = 0;
{
sl.up();
sl.draw();
-
- doShowingBar();
+ drawShowing();
ViewMan::getInstance()->updateView(this);
return 2;
}
{
sl.down();
sl.draw();
-
- doShowingBar();
+ drawShowing();
ViewMan::getInstance()->updateView(this);
return 2;
}
{
sl.pageUp();
sl.draw();
-
- doShowingBar();
+ drawShowing();
ViewMan::getInstance()->updateView(this);
return 2;
}
{
sl.pageDown();
sl.draw();
-
- doShowingBar();
+ drawShowing();
ViewMan::getInstance()->updateView(this);
return 2;
}
if (recTimer == NULL) return 2;
- // recTimer is the one you want FIXME
+ VTimerEdit* v = new VTimerEdit(recTimer);
+ ViewMan::getInstance()->add(v);
+ ViewMan::getInstance()->updateView(v);
return 2;
}