mirror of
https://projects.vdr-developer.org/git/vdr-plugin-tvguide.git
synced 2023-10-05 15:01:48 +02:00
Refactor cRecMenuAskFolder
This commit is contained in:
parent
e707ec7d4f
commit
1f1498a734
26
recmenus.c
26
recmenus.c
@ -57,30 +57,32 @@ cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switc
|
|||||||
******************************************************************************************/
|
******************************************************************************************/
|
||||||
|
|
||||||
// --- cRecMenuAskFolder ---------------------------------------------------------
|
// --- cRecMenuAskFolder ---------------------------------------------------------
|
||||||
cRecMenuAskFolder::cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction) {
|
cRecMenuAskFolder::cRecMenuAskFolder(const cEvent *event, eRecMenuState nextAction) { // OK
|
||||||
SetWidthPercent(80);
|
SetWidthPercent(80);
|
||||||
|
|
||||||
NextAction = nextAction;
|
NextAction = nextAction;
|
||||||
cString message = tr("Set Folder for");
|
|
||||||
cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title());
|
const cString line1 = tr("Set Folder for");
|
||||||
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText, true);
|
const cString line2 = (event && event->Title()) ? cString::sprintf("\"%s\"", event->Title()) : "";
|
||||||
infoItem->CalculateHeight(width - 2 * border);
|
|
||||||
SetHeader(infoItem);
|
AddHeader(new cRecMenuItemInfo(*line1, 2, *line2, "", "", width - 2 * border, true));
|
||||||
|
AddFooter(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false, true));
|
||||||
|
|
||||||
AddMenuItemInitial(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false, true));
|
AddMenuItemInitial(new cRecMenuItemButton(tr("root video folder"), nextAction, true, false, true));
|
||||||
|
|
||||||
ReadRecordingDirectories(&folders, NULL, "");
|
ReadRecordingDirectories(&folders, NULL, "");
|
||||||
int numFolders = folders.size();
|
int numFolders = folders.size();
|
||||||
for (int i=0; i < numFolders; i++) {
|
for (int i = 0; i < numFolders; i++) {
|
||||||
if (!AddMenuItemInitial(new cRecMenuItemButton(folders[i].c_str(), nextAction, false, false, true)))
|
if (!AddMenuItemInitial(new cRecMenuItemButton(folders[i].c_str(), nextAction, false, false, true)))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalculateHeight();
|
CalculateHeight();
|
||||||
CreatePixmap();
|
CreatePixmap();
|
||||||
Arrange();
|
Arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
cRecMenuItem *cRecMenuAskFolder::GetMenuItem(int number) {
|
cRecMenuItem *cRecMenuAskFolder::GetMenuItem(int number) {
|
||||||
if (number == 0) {
|
if (number == 0) {
|
||||||
cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false, true);
|
cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false, true);
|
||||||
return result;
|
return result;
|
||||||
@ -92,7 +94,7 @@ cRecMenuItem *cRecMenuAskFolder::GetMenuItem(int number) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int cRecMenuAskFolder::GetTotalNumMenuItems(void) {
|
int cRecMenuAskFolder::GetTotalNumMenuItems(void) {
|
||||||
return folders.size()+1;
|
return folders.size() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string cRecMenuAskFolder::GetFolder(void) {
|
std::string cRecMenuAskFolder::GetFolder(void) {
|
||||||
|
Loading…
Reference in New Issue
Block a user