/* * See the README file for copyright information and how to reach the author. */ #include #include #include "mymenusetup.h" typedef struct { int Width; int Align; } RecListDefaultType; RecListDefaultType recListDefaultValues[MAX_COLTYPES] = { { 0,0}, { 5,0}, { 8,0}, { 5,0}, {14,0}, { 4,2}, { 7,0}, { 5,0}, { 5,0} }; #if VDRVERSNUM > 10713 cNestedItemList RecordingDirCommands; #else cCommands RecordingDirCommands; #endif mySetup::mySetup() { mysetup.HideMainMenuEntry=0; mysetup.PatchNew=1; mysetup.ReplaceOrgRecMenu=0; for(int i=0; i= 10728 mysetup.SetRecordingCat=1; #endif mysetup.UseCutterQueue=1; } mySetup mysetup; /******************** myMenuSetup ********************/ myMenuSetup::myMenuSetup() { SetCols(45); hidemainmenuentry=mysetup.HideMainMenuEntry; patchnew=mysetup.PatchNew; replaceorgrecmenu=mysetup.ReplaceOrgRecMenu; for(int i=0; i= 10728 setrecordingcat=mysetup.SetRecordingCat; #endif usecutterqueue=mysetup.UseCutterQueue; sortingtypetexts[0]=tr("ascending"); sortingtypetexts[1]=tr("descending"); Set(); } void myMenuSetup::Set() { int currentItem = Current(); Clear(); Add(new cMenuEditBoolItem(tr("Show nr. of new recordings of a directory"),&shownewrecs)); Add(new cMenuEditStraItem(tr("Maximum number of recordings per directory"), &recsperdir, 5, RecsPerDir_texts)); Add(SubMenuItem(tr("Items to show in recording list"), osUser1)); Add(new cMenuEditBoolItem(tr("Show alternative to new marker"),&patchnew)); #if VDRVERSNUM >= 10728 Add(new cMenuEditBoolItem(tr("Set menu category"),&setrecordingcat)); if (setrecordingcat == 0) #endif Add(new cMenuEditBoolItem(tr("Show free disk space for each file system"),&filesystemfreemb)); Add(new cMenuEditStraItem(tr("Sorting"),&descendsorting,2,sortingtypetexts)); Add(new cMenuEditBoolItem(tr("Hide main menu entry"),&hidemainmenuentry)); #ifdef MAINMENUHOOKSVERSNUM Add(new cMenuEditBoolItem(tr("Replace original recordings menu"),&replaceorgrecmenu)); #endif Add(new cMenuEditBoolItem(tr("Jump to last replayed recording"),&golastreplayed)); Add(new cMenuEditBoolItem(tr("Call plugin after playback"),&returntoplugin)); Add(new cMenuEditBoolItem(tr("Limit bandwidth for move recordings"),&limitbandwidth)); Add(new cMenuEditBoolItem(tr("Use VDR's recording info menu"),&usevdrsrecinfomenu)); Add(new cMenuEditBoolItem(tr("Use cutter queue"),&usecutterqueue)); SetCurrent(Get(currentItem)); Display(); SetHelp(NULL, NULL, NULL, NULL); } void myMenuSetup::Store() { SetupStore("HideMainMenuEntry",mysetup.HideMainMenuEntry=hidemainmenuentry); SetupStore("PatchNew",mysetup.PatchNew=patchnew); SetupStore("ReplaceOrgRecMenu",mysetup.ReplaceOrgRecMenu=replaceorgrecmenu); char varname[16]; char* tmp=NULL; for(int i=0; i= 10728 SetupStore("SetRecordingCat",mysetup.SetRecordingCat=setrecordingcat); #endif SetupStore("UseCutterQueue",mysetup.UseCutterQueue=usecutterqueue); } eOSState myMenuSetup::ProcessKey(eKeys Key) { #if VDRVERSNUM >= 10728 int oldSetRecordingCat = setrecordingcat; #endif eOSState state = cMenuSetupPage::ProcessKey(Key); #if VDRVERSNUM >= 10728 if (Key != kNone && (oldSetRecordingCat != setrecordingcat) ) { Set(); } #endif switch (state) { case osUser1: return AddSubMenu(new myMenuSetupColumns(&reclistcolumn[0])); default: ; } return state; } /******************** myMenuSetupColumns ********************/ myMenuSetupColumns::myMenuSetupColumns(RecListColumnType *prlcs) : cOsdMenu(tr("Items to show in recording list"), 4) { preclistcolumns = prlcs; #if VDRVERSNUM >= 10728 if(mysetup.SetRecordingCat){ SetMenuCategory(mcPluginSetup); } #endif ColumnType_descriptions[0] = tr("--none--"); ColumnType_descriptions[1] = tr("Blank"); ColumnType_descriptions[2] = tr("Date of Recording"); ColumnType_descriptions[3] = tr("Time of Recording"); ColumnType_descriptions[4] = tr("Date and Time of Recording"); ColumnType_descriptions[5] = tr("Length of Recording"); ColumnType_descriptions[6] = tr("Rating of Recording"); ColumnType_descriptions[7] = tr("Content of File"); ColumnType_descriptions[8] = tr("Content of File, then Result of a Command"); AlignmentType_names[0] = tr("left"); AlignmentType_names[1] = tr("center"); AlignmentType_names[2] = tr("right"); Set(); } void myMenuSetupColumns::Set() { SetCols(30); // build up menu entries // SetHelp(tr("Edit"), NULL, NULL, NULL); //SetHelp(tr("Edit"), NULL, tr("Move Up"), tr("Move down")); // save current postion int current = Current(); // clear entries, if any Clear(); cOsdItem *sItem; char *itemStr; int ret; ret = asprintf(&itemStr, "%s\t%s", tr("Icon"), tr("(fixed to the first position)")); if (ret <= 0) { esyslog("Error allocating linebuffer for cOsdItem."); return; } sItem = new cOsdItem(itemStr); sItem->SetSelectable(false); Add(sItem); // build up setup menu for(int i=0; iSetSelectable(false); Add(sItem); // restore current position SetCurrent(Get(current)); } eOSState myMenuSetupColumns::ProcessKey(eKeys Key) { int iTemp_type [4], i; for (i=0; i= 0) { preclistcolumns[iChanged].Width = recListDefaultValues[preclistcolumns[iChanged].Type].Width; preclistcolumns[iChanged].Align = recListDefaultValues[preclistcolumns[iChanged].Type].Align; Set(); Display(); } if (state == osUnknown) { switch (Key) { case kOk: return osBack; default: break; } } return state; } int msprintf(char **strp, const char *fmt, ...) { va_list ap; va_start (ap, fmt); int res=vasprintf (strp, fmt, ap); va_end (ap); return res; } char* IndentMenuItem(const char* szString, int indentions) { char* szIndented = NULL; msprintf(&szIndented, "%*s", strlen(szString)+indentions*2, szString); return szIndented; }