2 Copyright 2004-2020 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, see <https://www.gnu.org/licenses/>.
21 #include "directory.h"
22 #include "recording.h"
26 #include "vrecordingmenu.h"
27 #include "vrecording.h"
29 #include "vvideorec.h"
30 #include "vradiorec.h"
38 #include "vrecordinglistclassic.h"
40 VRecordingListClassic::VRecordingListClassic()
44 if (Video::getInstance()->getFormat() == Video::PAL)
54 setTitleBarColour(DrawStyle::TITLEBARBACKGROUND);
56 sl.setPosition(10, 30 + 5);
57 sl.setSize(area.w - 20, area.h - 30 - 15 - 30);
61 VRecordingListClassic::~VRecordingListClassic()
65 void VRecordingListClassic::drawData(bool doIndexPop)
67 int saveIndex = sl.getCurrentOption();
68 int saveTop = sl.getTopOption();
76 char tempA[300]; // FIXME this is guesswork!
77 char tempB[300]; // FIXME
80 Directory* currentSubDir;
81 DirectoryList::iterator i;
82 DirectoryList* dirList = recman->getDirectories();
83 for (i = dirList->begin(); i != dirList->end(); i++)
86 SNPRINTF(tempA, 300, tr("<dir> %lu/%lu\t \t%s"), currentSubDir->getNumNewRecordings(), currentSubDir->getNumRecordings(), currentSubDir->name);
87 currentSubDir->index = sl.addOption(tempA, 0, first);
90 // FIXME convert the whole program to time_t's
92 Recording* currentRec;
93 RecordingList::iterator j;
94 RecordingList* recList = recman->getRecordings();
95 for (j = recList->begin(); j != recList->end(); j++)
98 time_t recStartTime = static_cast<time_t>(currentRec->getStartTime());
99 LOCALTIME_R(&recStartTime, &btime);
100 strftime(tempA, 300, "%d/%m %H:%M ", &btime);
101 int check = SNPRINTF(tempB, 300, "%s\t%c\t%s", tempA, (currentRec->getNew() ? '*': ' '), currentRec->getProgName());
102 if ((check < 0) || (check > 299)) Log::getInstance()->log("VRecordingListClassic", Log::ERR, "String too big");
104 currentRec->index = sl.addOption(tempB, 0, first);
110 sl.hintSetCurrent(slIndexStack.top());
115 sl.hintSetCurrent(saveIndex);
116 sl.hintSetTop(saveTop);
122 void VRecordingListClassic::draw(bool doIndexPop)
126 if (recman->isSubDir())
129 SNPRINTF(title, 300, tr("Recordings - %s"), recman->getCurDirName());
130 setTitleText(title, 364);
134 setTitleText(tr("Recordings"));
142 drawText(tr("Loading..."), 240, 180, DrawStyle::LIGHTTEXT);
147 int gigFree = recman->getFreeSpace() / 1024;
148 SNPRINTF(freeSpace, 50, tr("%lu%% used, %iGB free"), recman->getUsedPercent(), gigFree);
149 drawTextRJ(freeSpace, 560, 5, DrawStyle::LIGHTTEXT);
154 w.nextSymbol = WSymbol::UP;
155 w.setPosition(20, 385);
157 w.nextSymbol = WSymbol::DOWN;
158 w.setPosition(50, 385);
160 w.nextSymbol = WSymbol::SKIPBACK;
161 w.setPosition(85, 385);
163 w.nextSymbol = WSymbol::SKIPFORWARD;
164 w.setPosition(115, 385);
166 w.nextSymbol = WSymbol::PLAY;
167 w.setPosition(150, 385);
169 drawTextRJ(tr("[ok] = menu"), 560, 385, DrawStyle::LIGHTTEXT);
171 // All static stuff done
172 drawData(doIndexPop);
176 void VRecordingListClassic::doShowingBar()
178 int topOption = sl.getTopOption() + 1;
179 if (sl.getNumOptions() == 0) topOption = 0;
180 #ifndef GRADIENT_DRAWING
181 rectangle(220, 385, 180, 25, DrawStyle::VIEWBACKGROUND);
184 SNPRINTF(showing, 200, tr("%i to %i of %i"), topOption, sl.getBottomOption(), sl.getNumOptions());
185 drawText(showing, 220, 385, DrawStyle::LIGHTTEXT);
188 void VRecordingListClassic::quickUpdate() { //only quick for plattform that need it!
189 #ifdef GRADIENT_DRAWING