added possibility to choose folder for instant recording

This commit is contained in:
louis 2013-07-18 17:59:59 +02:00
parent 780e17395f
commit 706cf4d8e5
11 changed files with 112 additions and 8 deletions

View File

@ -52,3 +52,5 @@ VDR Plugin 'tvguide' Revision History
- changed channel jump logic
- red button also available in detail view
- page scrolling with keys left and right in detail view
- added possibility to choose folder for instant recording, possible
folders are read from VDRs folders list

View File

@ -60,6 +60,7 @@ cTvguideConfig::cTvguideConfig() {
numAdditionalEPGPictures = 9;
epgImageWidthLarge = 525;
epgImageHeightLarge = 400;
recMenuAskFolder = 0;
fontIndex = 0;
fontNameDefault = "VDRSymbols Sans:Book";
FontButtonDelta = 0;
@ -287,7 +288,8 @@ bool cTvguideConfig::SetupParse(const char *Name, const char *Value) {
else if (strcmp(Name, "displayChannelName") == 0) displayChannelName = atoi(Value);
else if (strcmp(Name, "channelHeaderWidthPercent") == 0) channelHeaderWidthPercent = atoi(Value);
else if (strcmp(Name, "channelHeaderHeightPercent") == 0) channelHeaderHeightPercent = atoi(Value);
else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value);
else if (strcmp(Name, "footerHeight") == 0) footerHeight = atoi(Value);
else if (strcmp(Name, "recMenuAskFolder") == 0) recMenuAskFolder = atoi(Value);
else if (strcmp(Name, "fontIndex") == 0) fontIndex = atoi(Value);
else if (strcmp(Name, "FontButtonDelta") == 0) FontButtonDelta = atoi(Value);
else if (strcmp(Name, "FontDetailViewDelta") == 0) FontDetailViewDelta = atoi(Value);

View File

@ -64,6 +64,7 @@ class cTvguideConfig {
int epgImageHeightLarge;
cString epgImagePath;
cString iconPath;
int recMenuAskFolder;
int fontIndex;
const char *fontNameDefault;
int FontButtonDelta;

View File

@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: vdr-tvguide 0.0.1\n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2013-07-12 16:08+0200\n"
"POT-Creation-Date: 2013-07-18 17:18+0200\n"
"PO-Revision-Date: 2012-08-25 17:49+0200\n"
"Last-Translator: Horst\n"
"Language-Team: \n"
@ -90,6 +90,12 @@ msgstr "In Aufnahmen suchen"
msgid "Check for Timer Conflicts"
msgstr "Auf Timerkoflikte prüfen"
msgid "Set Folder for"
msgstr "Verzeichnis festlegen für"
msgid "root video folder"
msgstr "Video Hauptverzeichnis"
msgid "Timer created"
msgstr "Timer angelegt"
@ -429,6 +435,9 @@ msgstr "Sehr großer Sprung (Tasten 4 / 6) in Stunden"
msgid "Time Format (12h/24h)"
msgstr "Zeitformat (12h/24h)"
msgid "Use folders for instant records"
msgstr "Bei Sofortaufnahmen Verzeichnisse benutzen"
msgid "Display Reruns in detailed EPG View"
msgstr "Wiederholungen in der detailierten EPG Ansicht anzeigen"

View File

@ -30,10 +30,15 @@ void cRecManager::SetEPGSearchPlugin(void) {
}
}
cTimer *cRecManager::createTimer(const cEvent *event) {
cTimer *cRecManager::createTimer(const cEvent *event, std::string path) {
cTimer *timer = new cTimer(event);
Timers.Add(timer);
Timers.SetModified();
if (path.size() > 0) {
std::replace(path.begin(), path.end(), '/', '~');
cString newFileName = cString::sprintf("%s~%s", path.c_str(), timer->File());
timer->SetFile(*newFileName);
}
isyslog("timer %s added (active)", *timer->ToDescr());
return timer;
}

View File

@ -30,7 +30,7 @@ public:
cRecManager (void);
void SetEPGSearchPlugin(void);
bool EpgSearchAvailable(void) {return epgSearchAvailable;};
cTimer *createTimer(const cEvent *event);
cTimer *createTimer(const cEvent *event, std::string path);
void DeleteTimer(const cEvent *event);
void DeleteTimer(int timerID);
void SaveTimer(cTimer *timer, cRecMenu *menu);

View File

@ -10,6 +10,7 @@ enum eRecMenuState {
rmsContinue,
rmsClose,
rmsInstantRecord,
rmsInstantRecordFolder,
rmsIgnoreTimerConflict,
rmsDeleteTimerConflictMenu,
rmsEditTimerConflictMenu,
@ -101,6 +102,7 @@ public:
int GetWidth(void);
void SetPixmaps(void);
void Draw(void);
cString GetStringValue(void) { return text; };
eRecMenuState ProcessKey(eKeys Key);
};

View File

@ -7,6 +7,7 @@ cRecMenuManager::cRecMenuManager(void) {
recManager = new cRecManager();
recManager->SetEPGSearchPlugin();
instantRecord = false;
folderChoosen = false;
currentConflict = -1;
templateID = -1;
timer = NULL;
@ -27,6 +28,7 @@ void cRecMenuManager::Start(const cEvent *event) {
active = true;
activeMenuBuffer = NULL;
instantRecord = false;
folderChoosen = false;
currentConflict = -1;
templateID = -1;
timer = NULL;
@ -76,13 +78,26 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
//Creating timer for active Event
//if no conflict, confirm and exit
instantRecord = true;
cString folder = "";
if (folderChoosen) {
int activeItem = activeMenu->GetActive(false);
if (activeItem > 0)
folder = activeMenu->GetStringValue(activeItem);
}
delete activeMenu;
cTimer *timer = recManager->createTimer(event);
cTimer *timer = recManager->createTimer(event, *folder);
if (!displayTimerConflict(timer)) {
activeMenu = new cRecMenuConfirmTimer(event);
activeMenu->Display();
}
break; }
case rmsInstantRecordFolder:
//Asking for Folder
folderChoosen = true;
delete activeMenu;
activeMenu = new cRecMenuAskFolder(event);
activeMenu->Display();
break;
case rmsIgnoreTimerConflict:
//Confirming created Timer
if (instantRecord) {
@ -385,7 +400,7 @@ eOSState cRecMenuManager::StateMachine(eRecMenuState nextState) {
break;}
case rmsSearchRecord: {
const cEvent *ev = activeMenu->GetEventValue(activeMenu->GetActive(false));
cTimer *timer = recManager->createTimer(ev);
cTimer *timer = recManager->createTimer(ev, "");
activeMenuBuffer = activeMenu;
activeMenuBuffer->Hide();
activeMenu = new cRecMenuSearchConfirmTimer(ev);

View File

@ -12,6 +12,7 @@ private:
std::vector<TVGuideTimerConflict> conflictList;
std::vector<TVGuideEPGSearchTemplate> epgSearchTemplates;
bool instantRecord;
bool folderChoosen;
int currentConflict;
int templateID;
bool searchWithOptions;

View File

@ -5,7 +5,10 @@ class cRecMenuMain : public cRecMenu {
public:
cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switchTimerActive) {
if (!timerActive) {
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), rmsInstantRecord, true));
eRecMenuState action = (tvguideConfig.recMenuAskFolder)
?rmsInstantRecordFolder
:rmsInstantRecord;
AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true));
} else {
AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true));
AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false));
@ -37,6 +40,69 @@ public:
virtual ~cRecMenuMain(void) {};
};
// --- cRecMenuAskFolder ---------------------------------------------------------
class cRecMenuAskFolder: public cRecMenu {
private:
std::vector<cString> folders;
void readFolders(cList<cNestedItem> *rootFolders, cString path) {
cList<cNestedItem> *foldersLevel = NULL;
if (rootFolders) {
foldersLevel = rootFolders;
} else {
foldersLevel = &Folders;
}
for (cNestedItem *folder = foldersLevel->First(); folder; folder = foldersLevel->Next(folder)) {
cString strFolder = cString::sprintf("%s%s", *path, folder->Text());
folders.push_back(strFolder);
cList<cNestedItem> *subItems = folder->SubItems();
if (subItems) {
cString newPath = cString::sprintf("%s%s/", *path, folder->Text());
readFolders(subItems, newPath);
}
}
}
public:
cRecMenuAskFolder(const cEvent *event) {
SetWidthPercent(80);
cString message = tr("Set Folder for");
cString headerText = cString::sprintf("%s\n\"%s\"", *message, event->Title());
cRecMenuItemInfo *infoItem = new cRecMenuItemInfo(*headerText);
infoItem->CalculateHeight(width - 2 * border);
SetHeader(infoItem);
AddMenuItemScroll(new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, true, false));
readFolders(NULL, "");
int numFolders = folders.size();
for (int i=0; i < numFolders; i++) {
AddMenuItemScroll(new cRecMenuItemButton(*folders[i], rmsInstantRecord, false, false));
if (!CheckHeight())
break;
}
CalculateHeight();
CreatePixmap();
Arrange();
};
cRecMenuItem *GetMenuItem(int number) {
if (number == 0) {
cRecMenuItem *result = new cRecMenuItemButton(tr("root video folder"), rmsInstantRecord, false, false);
return result;
} else if ((number > 0) && (number < folders.size()+1)) {
cRecMenuItem *result = new cRecMenuItemButton(*folders[number-1], rmsInstantRecord, false, false);
return result;
}
return NULL;
};
int GetTotalNumMenuItems(void) {
return folders.size()+1;
};
virtual ~cRecMenuAskFolder(void) {};
};
// --- cRecMenuConfirmTimer ---------------------------------------------------------
class cRecMenuConfirmTimer: public cRecMenu {
public:

View File

@ -82,6 +82,7 @@ void cTvguideSetup::Store(void) {
SetupStore("channelHeaderWidthPercent", tvguideConfig.channelHeaderWidthPercent);
SetupStore("channelHeaderHeightPercent", tvguideConfig.channelHeaderHeightPercent);
SetupStore("footerHeight", tvguideConfig.footerHeight);
SetupStore("recMenuAskFolder", tvguideConfig.recMenuAskFolder);
SetupStore("fontIndex", tvguideConfig.fontIndex);
SetupStore("FontButtonDelta", tvguideConfig.FontButtonDelta);
SetupStore("FontDetailViewDelta", tvguideConfig.FontDetailViewDelta);
@ -167,7 +168,7 @@ void cMenuSetupGeneral::Set(void) {
Add(new cMenuEditIntItem(tr("Big Step (Keys 1 / 3) in hours"), &tmpTvguideConfig->bigStepHours, 1, 12));
Add(new cMenuEditIntItem(tr("Huge Step (Keys 4 / 6) in hours"), &tmpTvguideConfig->hugeStepHours, 13, 48));
Add(new cMenuEditStraItem(tr("Time Format (12h/24h)"), &tmpTvguideConfig->timeFormat, 2, timeFormatItems));
Add(new cMenuEditBoolItem(tr("Use folders for instant records"), &tmpTvguideConfig->recMenuAskFolder));
Add(new cMenuEditBoolItem(tr("Display Reruns in detailed EPG View"), &tmpTvguideConfig->displayRerunsDetailEPGView));
if (tmpTvguideConfig->displayRerunsDetailEPGView) {
Add(new cMenuEditIntItem(cString::sprintf("%s%s", indent, tr("Number of reruns to display")), &tmpTvguideConfig->numReruns, 1, 10));