2 Copyright 2004-2007 Chris Tallon
4 This file is part of VOMP.
6 VOMP is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 VOMP is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with VOMP; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #include "vrecordinglistclassic.h"
24 #include "directory.h"
25 #include "recording.h"
29 #include "vrecordingmenu.h"
30 #include "vrecording.h"
32 #include "vvideorec.h"
33 #include "vradiorec.h"
41 VRecordingListClassic::VRecordingListClassic()
45 if (Video::getInstance()->getFormat() == Video::PAL)
55 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
57 sl.setPosition(10, 30 + 5);
58 sl.setSize(area.w - 20, area.h - 30 - 15 - 30);
62 VRecordingListClassic::~VRecordingListClassic()
66 void VRecordingListClassic::drawData(bool doIndexPop)
68 int saveIndex = sl.getCurrentOption();
69 int saveTop = sl.getTopOption();
77 char tempA[300]; // FIXME this is guesswork!
78 char tempB[300]; // FIXME
81 Directory* currentSubDir;
82 DirectoryList::iterator i;
83 DirectoryList* dirList = recman->getDirectories();
84 for (i = dirList->begin(); i != dirList->end(); i++)
87 SNPRINTF(tempA, 299, tr("<dir> %lu/%lu\t \t%s"), currentSubDir->getNumNewRecordings(), currentSubDir->getNumRecordings(), currentSubDir->name);
88 currentSubDir->index = sl.addOption(tempA, 0, first);
91 // FIXME convert the whole program to time_t's
93 Recording* currentRec;
94 RecordingList::iterator j;
95 RecordingList* recList = recman->getRecordings();
96 for (j = recList->begin(); j != recList->end(); j++)
99 time_t recStartTime = (time_t)currentRec->getStartTime();
100 btime = localtime(&recStartTime);
101 //NMT does not like this too!
103 // strftime(tempA, 299, "%0d/%0m %0H:%0M ", btime);
105 strftime(tempA, 299, "%d/%m %H:%M ", btime);
107 sprintf(tempB, "%s\t%c\t%s", tempA, (currentRec->getNew() ? '*': ' '), currentRec->getProgName());
109 currentRec->index = sl.addOption(tempB, 0, first);
115 sl.hintSetCurrent(slIndexStack.top());
120 sl.hintSetCurrent(saveIndex);
121 sl.hintSetTop(saveTop);
127 void VRecordingListClassic::draw(bool doIndexPop)
131 if (recman->isSubDir())
134 SNPRINTF(title, 299, tr("Recordings - %s"), recman->getCurDirName());
135 setTitleText(title, 364);
139 setTitleText(tr("Recordings"));
147 drawText(tr("Loading..."), 240, 180, DrawStyle::LIGHTTEXT);
152 int gigFree = recman->getFreeSpace() / 1024;
153 SNPRINTF(freeSpace, 49, tr("%lu%% used, %iGB free"), recman->getUsedPercent(), gigFree);
154 drawTextRJ(freeSpace, 560, 5, DrawStyle::LIGHTTEXT);
159 w.nextSymbol = WSymbol::UP;
160 w.setPosition(20, 385);
162 w.nextSymbol = WSymbol::DOWN;
163 w.setPosition(50, 385);
165 w.nextSymbol = WSymbol::SKIPBACK;
166 w.setPosition(85, 385);
168 w.nextSymbol = WSymbol::SKIPFORWARD;
169 w.setPosition(115, 385);
171 w.nextSymbol = WSymbol::PLAY;
172 w.setPosition(150, 385);
174 drawTextRJ(tr("[ok] = menu"), 560, 385, DrawStyle::LIGHTTEXT);
176 // All static stuff done
177 drawData(doIndexPop);
181 void VRecordingListClassic::doShowingBar()
183 int topOption = sl.getTopOption() + 1;
184 if (sl.getNumOptions() == 0) topOption = 0;
185 #ifndef GRADIENT_DRAWING
186 rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND);
189 sprintf(showing, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
190 drawText(showing, 220, 385, DrawStyle::LIGHTTEXT);
193 void VRecordingListClassic::quickUpdate() { //only quick for plattform that need it!
194 #ifdef GRADIENT_DRAWING