summaryrefslogtreecommitdiff
path: root/plugin/setup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/setup.cpp')
-rw-r--r--plugin/setup.cpp126
1 files changed, 113 insertions, 13 deletions
diff --git a/plugin/setup.cpp b/plugin/setup.cpp
index e87b7db..99090ed 100644
--- a/plugin/setup.cpp
+++ b/plugin/setup.cpp
@@ -24,6 +24,7 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup)
secondpass=setup->SecondPass;
ac3always=setup->AC3Always;
log2rec=setup->Log2Rec;
+ logoonly=setup->LogoOnly;
processTexts[0]=tr("after");
processTexts[1]=tr("during");
@@ -31,20 +32,26 @@ cSetupMarkAd::cSetupMarkAd(struct setup *Setup)
ioprioTexts[0]=tr("high");
ioprioTexts[1]=tr("normal");
ioprioTexts[2]=tr("low");
+
+ lpos=0;
+
write();
}
void cSetupMarkAd::write(void)
{
-
+ int current=Current();
Clear();
- Add(new cMenuEditStraItem(tr("execution"),&processduring,2,processTexts));
+ cMenuEditStraItem *first=new cMenuEditStraItem(tr("execution"),&processduring,2,processTexts);
+ if (!first) return;
+ Add(first);
if (!processduring)
{
Add(new cMenuEditBoolItem(tr(" during another recording"),&whilerecording));
Add(new cMenuEditBoolItem(tr(" while replaying"),&whilereplaying));
}
-
+ Add(new cMenuEditBoolItem(tr("scan only channels with logo"),&logoonly),true);
+ lpos=Current();
Add(new cMenuEditStraItem(tr("hdd access priority"),&ioprioclass,3,ioprioTexts));
Add(new cMenuEditBoolItem(tr("examine AC3 always"),&ac3always));
Add(new cMenuEditBoolItem(tr("ignore timer margins"),&nomargins));
@@ -57,27 +64,45 @@ void cSetupMarkAd::write(void)
Add(new cMenuEditBoolItem(tr("log to recording directory"),&log2rec));
Add(new cMenuEditBoolItem(tr("hide mainmenu entry"),&hidemainmenuentry));
+ if (current==-1)
+ {
+ SetCurrent(first);
+ }
+ else
+ {
+ SetCurrent(Get(current));
+ }
Display();
}
eOSState cSetupMarkAd::ProcessKey(eKeys Key)
{
-
- eOSState state=osUnknown;
- switch (Key)
+ eOSState state = cOsdMenu::ProcessKey(Key);
+ if (HasSubMenu()) return osContinue;
+ switch (state)
{
- case kLeft:
- state=cMenuSetupPage::ProcessKey(Key);
- if (Current()==0) write();
+ case osContinue:
+ if (((Key==kLeft) || (Key==kRight)) && (Current()==0)) write();
+
+ if ((Key==kDown) || (Key==kUp))
+ {
+ if (Current()==lpos)
+ {
+ SetHelp(NULL,NULL,NULL,tr("show list"));
+ }
+ else
+ {
+ SetHelp(NULL,NULL,NULL,NULL);
+ }
+ }
break;
- case kRight:
- state=cMenuSetupPage::ProcessKey(Key);
- if (Current()==0) write();
+ case osUnknown:
+ if ((Key==kBlue) && (Current()==lpos))
+ return AddSubMenu(new cSetupMarkAdList(setup));;
break;
default:
- state=cMenuSetupPage::ProcessKey(Key);
break;
}
return state;
@@ -98,6 +123,7 @@ void cSetupMarkAd::Store(void)
SetupStore("IOPrioClass",ioprioclass);
SetupStore("AC3Always",ac3always);
SetupStore("Log2Rec",log2rec);
+ SetupStore("LogoOnly",logoonly);
setup->ProcessDuring=(bool) processduring;
setup->whileRecording=(bool) whilerecording;
@@ -112,4 +138,78 @@ void cSetupMarkAd::Store(void)
setup->IOPrioClass=ioprioclass;
setup->AC3Always=ac3always;
setup->Log2Rec=log2rec;
+ setup->LogoOnly=logoonly;
+}
+
+#define CHNUMWIDTH (numdigits(Channels.MaxNumber())+1)
+
+cSetupMarkAdList::cSetupMarkAdList(struct setup *Setup)
+ :cOsdMenu("",CHNUMWIDTH)
+{
+ SetTitle(cString::sprintf("%s - %s '%s' %s",trVDR("Setup"),trVDR("Plugin"),Setup->PluginName,tr("list")));
+ SetHelp(NULL,NULL,NULL,tr("back"));
+
+ DIR *dir=opendir(Setup->LogoDir);
+ if (!dir) return;
+ struct dirent *dirent;
+ while (dirent=readdir(dir))
+ {
+ if (dirent->d_name[0]=='.') continue;
+ if (strstr(dirent->d_name,"-P0.pgm"))
+ {
+ char *name=strdup(dirent->d_name);
+ if (name)
+ {
+ char *m=strchr(name,'-');
+ if (m) *m=0;
+
+ for (cChannel *channel = Channels.First(); channel; channel = Channels.Next(channel))
+ {
+ if (channel->Name())
+ {
+ char *cname=strdup(channel->Name());
+ if (cname)
+ {
+ for (int i=0; i<(int) strlen(cname); i++)
+ {
+ if (cname[i]==' ') cname[i]='_';
+ if (cname[i]=='.') cname[i]='_';
+ if (cname[i]=='/') cname[i]='_';
+ }
+ if (!strcmp(name,cname))
+ {
+ Add(new cOsdItem(cString::sprintf("%i\t%s",channel->Number(),channel->Name())));
+ free(cname);
+ break;
+ }
+ free(cname);
+ }
+ }
+ }
+
+ free(name);
+ }
+ }
+ }
+ closedir(dir);
+}
+
+eOSState cSetupMarkAdList::ProcessKey (eKeys Key)
+{
+ eOSState state = cOsdMenu::ProcessKey(Key);
+ if (HasSubMenu()) return osContinue;
+ if (state==osUnknown)
+ {
+ switch (Key)
+ {
+ case kOk:
+ case kBlue:
+ case kBack:
+ state=osBack;
+ break;
+ default:
+ break;
+ }
+ }
+ return state;
}