diff options
author | Midas <vdrportal_midas@gmx.de> | 2010-06-08 12:52:10 +0200 |
---|---|---|
committer | Midas <vdrportal_midas@gmx.de> | 2010-06-08 12:52:10 +0200 |
commit | 891bfb5ba9f052f9a97ef0abedeb039236701755 (patch) | |
tree | 839838706677c12ff9f0b9a6a1ee0bdd5926fba3 | |
parent | 4753e96fbaaf0ac96ea8a8512e90819591cdc723 (diff) | |
download | vdr-plugin-block-891bfb5ba9f052f9a97ef0abedeb039236701755.tar.gz vdr-plugin-block-891bfb5ba9f052f9a97ef0abedeb039236701755.tar.bz2 |
This version completes the basic parental guidance
functions. I will update README soon.
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | COPYING | 18 | ||||
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | README | 17 | ||||
-rw-r--r-- | block.c | 16 | ||||
-rw-r--r-- | config.c | 21 | ||||
-rw-r--r-- | config.h | 7 | ||||
-rw-r--r-- | control.c | 155 | ||||
-rw-r--r-- | control.h | 22 | ||||
-rw-r--r-- | event.c | 106 | ||||
-rw-r--r-- | event.h | 18 | ||||
-rw-r--r-- | i18n.c | 53 | ||||
-rw-r--r-- | setup.c | 65 | ||||
-rw-r--r-- | setup.h | 2 | ||||
-rw-r--r-- | status.c | 9 |
15 files changed, 286 insertions, 230 deletions
@@ -1,2 +1,2 @@ #ignore backup files -*~
\ No newline at end of file +*~ @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to +the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not @@ -55,7 +55,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions: License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) - + These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in @@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. - + 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is @@ -225,7 +225,7 @@ impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - + 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License @@ -278,7 +278,7 @@ PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest @@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. @@ -336,5 +336,5 @@ necessary. Here is a sample; alter the names: This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General +library. If this is what you want to do, use the GNU Library General Public License instead of this License. @@ -41,7 +41,7 @@ APIVERSION = $(shell sed -ne '/define APIVERSION/s/^.*"\(.*\)".*$$/\1/p' $(VDRDI ### The name of the distribution archive: ARCHIVE = $(PLUGIN)-$(VERSION) -PACKAGE = vdr-plugin-$(ARCHIVE) +PACKAGE = vdr-$(ARCHIVE) ### Includes and Defines (add further entries here): @@ -110,11 +110,10 @@ dist: clean @-rm -rf $(TMPDIR)/$(ARCHIVE) @mkdir $(TMPDIR)/$(ARCHIVE) @cp -a * $(TMPDIR)/$(ARCHIVE) - @tar czf $(PACKAGE).tgz -C $(TMPDIR) --exclude debian --exclude .git $(ARCHIVE) + @tar czf $(PACKAGE).tgz -C $(TMPDIR) --exclude debian --exclude CVS --exclude .svn $(ARCHIVE) @-rm -rf $(TMPDIR)/$(ARCHIVE) @echo Distribution package created as $(PACKAGE).tgz clean: @-rm -f $(PODIR)/*.mo $(PODIR)/*.pot @-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~ $(PODIR)/*.mo $(PODIR)/*.pot - @@ -15,21 +15,7 @@ Contact information (taste plugin): Written by: Sascha Volkenandt <sascha at akv-soft dot de> Project homepage: http://www.magoa.net/linux/index.php?view=taste -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along -with this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -See the file COPYING for the full license information. +See the file COPYING for license information. Description: @@ -60,3 +46,4 @@ For VDR versions <= 1.3.16 you will have to apply the included patch to the VDR source in order to have multiple channels being blocked in a row. Otherwise the block plugin will only skip the first channel. The patch originates from the taste plugin and was written by Sascha Volkenandt. + @@ -102,7 +102,7 @@ bool cPluginBlock::SetupParse(const char *Name, const char *Value) void cPluginBlock::MainThreadHook() { - if (SetupBlock.DetectionMethod!=1) return;//other detection method active in setup + if (cSetupBlock::DetectionMethod!=1) return;//other detection method active in setup channelnumber=cDevice::PrimaryDevice()->CurrentChannel(); if (channelnumber==0) return; //switch in progress @@ -113,26 +113,26 @@ void cPluginBlock::MainThreadHook() { cSchedulesLock schedLock; const cSchedules *scheds = cSchedules::Schedules(schedLock); - + if (scheds == NULL) { return; } - + const cSchedule *sched = scheds->GetSchedule(channel->GetChannelID()); if (sched == NULL) { return; } - + const cEvent *present = sched->GetPresentEvent(); const cEvent *follow = sched->GetFollowingEvent(); - + if (present == NULL) { return; } - + //TODO: check if isrequested is still necessary // if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) const char* title=present->Title(); @@ -145,9 +145,9 @@ void cPluginBlock::MainThreadHook() cControl::Launch(new cControlBlock(channel, present, follow)); } } -} - +} + VDRPLUGINCREATOR(cPluginBlock); // Don't touch this! @@ -13,19 +13,28 @@ cSetupBlock SetupBlock; int cSetupBlock::LastChannel=0; +int cSetupBlock::DetectionMethod=0; +int cSetupBlock::OkAllowed=1; cSetupBlock::cSetupBlock(void): - HideMenuEntry(0), - MessageTimeout(2), - DetectionMethod(0) + HideMenuEntry(0), + MessageTimeout(2), + ExtraOptionsVisible(1) { } bool cSetupBlock::Parse(const char *Name, const char *Value) { if (strcmp(Name, "HideMenuEntry") == 0) HideMenuEntry = atoi(Value); - else if (strcmp(Name, "MessageTimeout") == 0) MessageTimeout = atoi(Value); - else if (strcmp(Name, "DetectionMethod") == 0) DetectionMethod = atoi(Value); - else return false; + else if (strcmp(Name, "MessageTimeout") == 0) MessageTimeout = atoi(Value); + else if (strcmp(Name, "DetectionMethod") == 0) DetectionMethod = atoi(Value); + + //if you want to make use of the following you have to manually add Block.ExtraOptionsVisible to your setup.conf + //0 means options 'Detection Method' and 'Ok temporarily deblocks' are not visible (eg for parental guidance) + //1 means the options are visible in the setup of vdr and everybody could alter the values + else if (strcmp(Name, "ExtraOptionsVisible") == 0) ExtraOptionsVisible = atoi(Value); + + else if (strcmp(Name, "OkAllowed")==0) OkAllowed = atoi(Value); + else return false; return true; } @@ -12,9 +12,12 @@ class cSetupBlock { public: int HideMenuEntry; int MessageTimeout; - int DetectionMethod; + static int DetectionMethod; static int LastChannel; - + int ExtraOptionsVisible; + static int OkAllowed; + + cSetupBlock(void); bool Parse(const char *Name, const char *Value); }; @@ -17,18 +17,18 @@ bool cControlBlock::mRequested = false; cControlBlock::cControlBlock(const cChannel *Channel, const cEvent *Present, const cEvent *Following): cControl(new cPlayer), - mChannel(Channel), - mPresent(Present), - mFollowing(Following), - mStart(0), - mSwitch(true), - mOsd(NULL), - direction(0) + mChannel(Channel), + mPresent(Present), + mFollowing(Following), + mStart(0), + mSwitch(true), + mOsd(NULL), + direction(0) { #if APIVERSNUM >= 10500 - SetNeedsFastResponse(true); + SetNeedsFastResponse(true); #else - needsFastResponse = true; + needsFastResponse = true; #endif cRemote::Put(kBack,true); //Hide OSD new version @@ -36,8 +36,8 @@ cControlBlock::cControlBlock(const cChannel *Channel, const cEvent *Present, con cControlBlock::~cControlBlock() { - if (mOsd != NULL) - delete mOsd; + if (mOsd != NULL) + delete mOsd; if (mRequested) { #ifdef LOGGING @@ -57,92 +57,106 @@ cControlBlock::~cControlBlock() } } - if (mSwitch) { - int lastchannel=cSetupBlock::LastChannel; - // possibly first or last available channel, fall back to old channel + if (mSwitch) { + int lastchannel=cSetupBlock::LastChannel; + // possibly first or last available channel, fall back to old channel - if (direction == 0) - direction = 1; - if (!cDevice::SwitchChannel(direction) && (lastchannel != 0)) - Channels.SwitchTo(lastchannel); + if (direction == 0) + direction = 1; + if (!cDevice::SwitchChannel(direction) && (lastchannel != 0)) + Channels.SwitchTo(lastchannel); - } + } } void cControlBlock::Show(void) { - if (mOsd == NULL) - mOsd = Skins.Current()->DisplayChannel(true); + if (mOsd == NULL) + mOsd = Skins.Current()->DisplayChannel(true); - mOsd->SetChannel(mChannel, 0); - mOsd->SetEvents(mPresent, mFollowing); - mOsd->SetMessage(mtError, tr("Channel not acceptable!")); - mOsd->Flush(); + mOsd->SetChannel(mChannel, 0); + mOsd->SetEvents(mPresent, mFollowing); + mOsd->SetMessage(mtError, tr("Channel not acceptable!")); + mOsd->Flush(); - mStart = time_ms(); + mStart = time_ms(); } eOSState cControlBlock::ProcessKey(eKeys Key) { #ifdef LOGGING - dsyslog("plugin-block: userint cControlBlock::ProcessKey(%d) this = %p", Key, this); + dsyslog("plugin-block: userint cControlBlock::ProcessKey(%d) this = %p", Key, this); #endif switch (Key) { - case kOk: + case kOk: #ifdef LOGGING - dsyslog("plugin-block: userint Processing 'Ok' event"); -#endif - mRequested = true; - mSwitch = false; - return osEnd; - - case kNone: + dsyslog("plugin-block: userint Processing 'Ok' event"); +#endif + if (cSetupBlock::OkAllowed==1) + { + mRequested = true; + mSwitch = false; + return osEnd; + } + else + { + mRequested = false; + mSwitch = true; + if (mOsd != NULL) + { + mOsd->SetMessage(mtError, tr("No Permission!")); + mOsd->Flush(); + } + } + return osContinue; + + case kNone: #ifdef LOGGING dsyslog("plugin-block: userint Processing kNone (no user interaction)"); #endif - if (mStart == 0) - Show(); - else if (time_ms() - mStart > BlockTimeout()) { - direction = mChannel->Number() - cSetupBlock::LastChannel; - mSwitch = true; - return osEnd; - } - return osContinue; - - - - case kUp: - case kChanUp: + if (mStart == 0) + Show(); + else if (time_ms() - mStart > BlockTimeout()) { + direction = mChannel->Number() - cSetupBlock::LastChannel; + mSwitch = true; + return osEnd; + } + return osContinue; + + + + case kUp: + case kChanUp: #ifdef LOGGING dsyslog("plugin-block: userint Processing up event (userrequest)"); #endif - if (mStart == 0) - Show(); - else - { - mRequested=false;//TODO:necessary? as below - direction = 1; - mSwitch = true; - return osEnd; - } - break; - case kDown: - case kChanDn: + if (mStart == 0) + Show(); + else + { + mRequested=false;//TODO:necessary? as below + direction = 1; + mSwitch = true; + return osEnd; + } + break; + case kDown: + case kChanDn: #ifdef LOGGING dsyslog("plugin-block: userint Processing down event (userrequest)"); #endif - if (mStart == 0) - Show(); - else - { - mRequested=false;//TODO:necessary? as below - direction = -1; - mSwitch = true; - return osEnd; - } - break; + if (mStart == 0) + Show(); + else + { + mRequested=false;//TODO:necessary? as below + direction = -1; + mSwitch = true; + return osEnd; + } + break; default: @@ -150,3 +164,4 @@ dsyslog("plugin-block: userint Processing down event (userrequest)"); } return osContinue; } + @@ -13,18 +13,18 @@ class cControlBlock : public cControl { private: - static bool mRequested; - - const cChannel *mChannel; - const cEvent *mPresent; - const cEvent *mFollowing; - uint64_t mStart; - bool mSwitch; - cSkinDisplayChannel *mOsd; - int direction; + static bool mRequested; + + const cChannel *mChannel; + const cEvent *mPresent; + const cEvent *mFollowing; + uint64_t mStart; + bool mSwitch; + cSkinDisplayChannel *mOsd; + int direction; protected: - virtual void Show(void); + virtual void Show(void); virtual void Hide(void) {} public: @@ -33,7 +33,7 @@ public: virtual eOSState ProcessKey(eKeys Key); - static bool IsRequested(void) { bool r = mRequested; mRequested = false; return r; } + static bool IsRequested(void) { bool r = mRequested; mRequested = false; return r; } }; #endif // VDR_BLOCK_CONTROL_H @@ -10,94 +10,94 @@ #include <ctype.h> static char *duptolower(const char *s) { - char *c = strdup(s); - char *p = c; - for (; *p; ++p) - *p = tolower(*p); - return c; + char *c = strdup(s); + char *p = c; + for (; *p; ++p) + *p = tolower(*p); + return c; } cEventsBlock EventsBlock; cEventBlock::cEventBlock(void): - mRegularExp(false), - mIgnoreCase(false), - mCompiled(false) + mRegularExp(false), + mIgnoreCase(false), + mCompiled(false) { strncpy(mPattern, tr("New Entry"), sizeof(mPattern)); } cEventBlock::cEventBlock(const char *Pattern): - mRegularExp(false), - mIgnoreCase(false), - mCompiled(false) + mRegularExp(false), + mIgnoreCase(false), + mCompiled(false) { strncpy(mPattern, Pattern, sizeof(mPattern)); } cEventBlock::cEventBlock(const cEventBlock &Src) { - operator=(Src); + operator=(Src); } cEventBlock &cEventBlock::operator=(const cEventBlock &Src) { - printf("copy construct\n"); - strcpy(mPattern, Src.mPattern); - mRegularExp = Src.mRegularExp; - mIgnoreCase = Src.mIgnoreCase; - mCompiled = false; - Compile(); - return *this; + printf("copy construct\n"); + strcpy(mPattern, Src.mPattern); + mRegularExp = Src.mRegularExp; + mIgnoreCase = Src.mIgnoreCase; + mCompiled = false; + Compile(); + return *this; } cEventBlock::~cEventBlock() { - if (mRegularExp) - regfree(&mExpression); + if (mRegularExp) + regfree(&mExpression); } bool cEventBlock::Acceptable(const char *Event) const { - if (mRegularExp) - return regexec(&mExpression, Event, 0, NULL, 0) != 0; - else if (mIgnoreCase) { - char *ev = duptolower(Event); - char *pa = duptolower(mPattern); - printf("check for %s in %s\n", pa, ev); - bool res = strstr(ev, pa) == NULL; - free(ev); free(pa); - return res; - } else - return strstr(Event, mPattern) == NULL; + if (mRegularExp) + return regexec(&mExpression, Event, 0, NULL, 0) != 0; + else if (mIgnoreCase) { + char *ev = duptolower(Event); + char *pa = duptolower(mPattern); + printf("check for %s in %s\n", pa, ev); + bool res = strstr(ev, pa) == NULL; + free(ev); free(pa); + return res; + } else + return strstr(Event, mPattern) == NULL; } bool cEventBlock::Parse(char *s) { - char *patternbuf = NULL; - int fields = sscanf(s, "%d:%d:%a[^\n]", &mRegularExp, &mIgnoreCase, &patternbuf); - - if (fields == 3) { - strncpy(mPattern, skipspace(stripspace(patternbuf)), sizeof(mPattern)); - free(patternbuf); - } else { // backward compatibility - strncpy(mPattern, skipspace(stripspace(s)), sizeof(mPattern)); - mRegularExp = false; - mIgnoreCase = false; - } + char *patternbuf = NULL; + int fields = sscanf(s, "%d:%d:%a[^\n]", &mRegularExp, &mIgnoreCase, &patternbuf); + + if (fields == 3) { + strncpy(mPattern, skipspace(stripspace(patternbuf)), sizeof(mPattern)); + free(patternbuf); + } else { // backward compatibility + strncpy(mPattern, skipspace(stripspace(s)), sizeof(mPattern)); + mRegularExp = false; + mIgnoreCase = false; + } return Compile(); } bool cEventBlock::Compile(void) { - mCompiled = false; - if (mRegularExp) { - if (regcomp(&mExpression, mPattern, REG_EXTENDED | (mIgnoreCase ? REG_ICASE : 0)) != 0) { - esyslog("ERROR: malformed regular expression: %s", mPattern); - return false; - } else - mCompiled = true; - } - return true; + mCompiled = false; + if (mRegularExp) { + if (regcomp(&mExpression, mPattern, REG_EXTENDED | (mIgnoreCase ? REG_ICASE : 0)) != 0) { + esyslog("ERROR: malformed regular expression: %s", mPattern); + return false; + } else + mCompiled = true; + } + return true; } bool cEventBlock::Save(FILE *f) { @@ -116,7 +116,7 @@ bool cEventsBlock::Acceptable(const char *Event) { cEventsBlock &cEventsBlock::operator=(const cEventsBlock &Source) { cList<cEventBlock>::Clear(); - + const cEventBlock *event = Source.First(); while (event != NULL) { printf("transfering %p\n", event); @@ -10,7 +10,7 @@ #include <sys/types.h> #include <regex.h> - + #include <vdr/tools.h> #include <vdr/config.h> @@ -21,24 +21,24 @@ class cEventBlock : public cListObject { private: char mPattern[EVLINELENGTH]; - int mRegularExp; - int mIgnoreCase; - bool mCompiled; + int mRegularExp; + int mIgnoreCase; + bool mCompiled; - regex_t mExpression; + regex_t mExpression; public: cEventBlock(void); cEventBlock(const char *Pattern); - cEventBlock(const cEventBlock &Src); - ~cEventBlock(); + cEventBlock(const cEventBlock &Src); + ~cEventBlock(); - cEventBlock &operator=(const cEventBlock &Src); + cEventBlock &operator=(const cEventBlock &Src); bool Acceptable(const char *Event) const ; bool Parse(char *s); - bool Compile(void); + bool Compile(void); bool Save(FILE *f); const char *Pattern(void) const { return mPattern; } @@ -9,7 +9,7 @@ #if VDRVERSNUM < 10507 const tI18nPhrase Phrases[] = { - /* + /* { "English", "Deutsch", "Slovenski", @@ -31,7 +31,7 @@ const tI18nPhrase Phrases[] = { "Eesti", "Dansk", }, - */ + */ { "Block broadcast", "Sendung sperren", "", @@ -82,8 +82,8 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Channel not acceptable!", - "Aktuelle Sendung unzumutbar!", + { "Channel not acceptable", + "Aktuelle Sendung unzumutbar", "", "", "", @@ -181,7 +181,32 @@ const tI18nPhrase Phrases[] = { #if VDRVERSNUM >= 10316 "", #endif - }, + }, + { "Ok deblocks temporarily", + "Ok entsperrt temporär", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", + "", +#if VDRVERSNUM >= 10313 + "", +#endif +#if VDRVERSNUM >= 10316 + "", +#endif + }, { "On Switch", "Beim Umschalten", "", @@ -282,7 +307,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "New", + { "New", "Neu", "", "", @@ -307,7 +332,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Delete keyword?", + { "Delete keyword?", "Schlagwort löschen?", "", "", @@ -332,7 +357,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Pattern", + { "Pattern", "Suchmuster", "", "", @@ -357,7 +382,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "--- Keywords -------------------------------------------------------------------", + { "--- Keywords -------------------------------------------------------------------", "--- Schlagworte ----------------------------------------------------------------", "", "", @@ -382,7 +407,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Regular Expression", + { "Regular Expression", "Regulärer Ausdruck", "", "", @@ -407,7 +432,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Ignore Case", + { "Ignore Case", "Groß/Kleinschreibung ignorieren", "", "", @@ -432,7 +457,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Malformed regular expression!", + { "Malformed regular expression!", "Ungültiger regulärer Ausdruck!", "", "", @@ -457,7 +482,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { "Message Timeout [s]", + { "Message Timeout [s]", "Wartezeit bis Umschalten [s]", "", "", @@ -482,7 +507,7 @@ const tI18nPhrase Phrases[] = { "", #endif }, - { NULL } + { NULL } }; #endif @@ -29,8 +29,24 @@ void cMenuSetupBlock::Set(void) { DetectionMethods[0] = tr("On Switch"); DetectionMethods[1] = tr("Channel EPG"); - Add(new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods)); - + if(mSetupData.ExtraOptionsVisible==1) + { + Add(new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods)); + Add(new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.OkAllowed)); + } + else + { + cMenuEditStraItem *methoditem = new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods); + cMenuEditBoolItem *okitem = new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.OkAllowed); + methoditem->SetSelectable(false); + okitem->SetSelectable(false); + Add(methoditem); + Add(okitem); +// Add((new cMenuEditStraItem(tr("Detection Method"), &mSetupData.DetectionMethod, 2, DetectionMethods))::SetSelectable(false)); +// Add(new cMenuEditBoolItem(tr("Ok deblocks temporarily"), &mSetupData.ExtraOptionsVisible)); + } + + item = new cOsdItem(""); item->SetSelectable(false); Add(item); @@ -39,7 +55,7 @@ void cMenuSetupBlock::Set(void) { item->SetSelectable(false); Add(item); -#define NONKEYWORDITEMS 5 +#define NONKEYWORDITEMS 6 int index = 0; cEventBlock *event = mEventsData.First(); @@ -62,8 +78,8 @@ void cMenuSetupBlock::SetHelpKeys(void) printf("sethelpkeys, current = %d\n", Current()); if (Current() >= NONKEYWORDITEMS) { - red = trVDR("Button$Edit"); - yellow = trVDR("Button$Delete"); + red = trVDR("Button$Edit"); + yellow = trVDR("Button$Delete"); } SetHelp(red, trVDR("Button$New"), yellow, NULL); } @@ -77,6 +93,7 @@ void cMenuSetupBlock::Store(void) SetupStore("HideMenuEntry", SetupBlock.HideMenuEntry); SetupStore("MessageTimeout", SetupBlock.MessageTimeout); SetupStore("DetectionMethod", SetupBlock.DetectionMethod); + SetupStore("OkAllowed", SetupBlock.OkAllowed); } eOSState cMenuSetupBlock::Edit(void) @@ -104,11 +121,11 @@ eOSState cMenuSetupBlock::Delete(void) { if (HasSubMenu() || Current() < NONKEYWORDITEMS) return osContinue; - + cEventBlock *event = mEventsData.Get(Current() - NONKEYWORDITEMS); if (event != NULL) { - if (Interface->Confirm(tr("Delete keyword?"))) - mEventsData.Del(event); + if (Interface->Confirm(tr("Delete keyword?"))) + mEventsData.Del(event); } Set(); return osContinue; @@ -119,16 +136,16 @@ eOSState cMenuSetupBlock::ProcessKey(eKeys Key) { eOSState state = cMenuSetupPage::ProcessKey(Key); if (hadSubMenu && !HasSubMenu()) { - Set(); - return state; + Set(); + return state; } switch (state) { case osUnknown: // normal key handling switch (Key) { - case kRed: return Edit(); + case kRed: if (mSetupData.ExtraOptionsVisible==1) return Edit(); case kGreen: return New(); - case kYellow: return Delete(); + case kYellow: if (mSetupData.ExtraOptionsVisible==1) return Delete(); default: break; @@ -138,9 +155,9 @@ eOSState cMenuSetupBlock::ProcessKey(eKeys Key) { default: break; } - - if (!HasSubMenu()) - Set(); + + if (!HasSubMenu()) + Set(); return state; } @@ -156,8 +173,8 @@ cMenuSetupEditBlock::cMenuSetupEditBlock(cEventBlock *Event): snprintf(buf, sizeof(buf), "%s - %s '%s'", trVDR("Setup"), trVDR("Plugin"), "block"); SetTitle(buf); Add(new cMenuEditStrItem(tr("Pattern"), mData.mPattern, sizeof(mData.mPattern), tr(ALLOWEDCHARS))); - Add(new cMenuEditBoolItem(tr("Regular Expression"), &mData.mRegularExp)); - Add(new cMenuEditBoolItem(tr("Ignore Case"), &mData.mIgnoreCase)); + Add(new cMenuEditBoolItem(tr("Regular Expression"), &mData.mRegularExp)); + Add(new cMenuEditBoolItem(tr("Ignore Case"), &mData.mIgnoreCase)); } eOSState cMenuSetupEditBlock::ProcessKey(eKeys Key) @@ -167,13 +184,13 @@ eOSState cMenuSetupEditBlock::ProcessKey(eKeys Key) if (state == osUnknown) { switch (Key) { case kOk: - if (!mData.Compile()) { - Skins.Message(mtError, tr("Malformed regular expression!")); - state = osContinue; - } else { - *mEvent = mData; - state = osBack; - } + if (!mData.Compile()) { + Skins.Message(mtError, tr("Malformed regular expression!")); + state = osContinue; + } else { + *mEvent = mData; + state = osBack; + } break; default: @@ -18,7 +18,7 @@ private: cEventsBlock mEventsData; cSetupBlock mSetupData; const char *DetectionMethods[2]; - + protected: virtual void Store(void); virtual eOSState ProcessKey(eKeys Key); @@ -29,8 +29,8 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) cSetupBlock::LastChannel=cDevice::CurrentChannel(); return; //Switch in progress; } - - if (SetupBlock.DetectionMethod!=0) return; + + if (cSetupBlock::DetectionMethod!=0) return; #ifdef LOGGING dsyslog("plugin-block: cStatusBlock was informed about channel switch at device %d, channel no %d",Device->DeviceNumber(),ChannelNumber); @@ -59,7 +59,7 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) #endif return; } - + if (Device->Replaying()) { #ifdef LOGGING @@ -81,7 +81,7 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) const cEvent *present = sched->GetPresentEvent(); const cEvent *follow = sched->GetFollowingEvent(); if (present == NULL) return; - + if (!cControlBlock::IsRequested() && !EventsBlock.Acceptable(present->Title())) { isyslog("plugin-block: channel %d is not acceptable at present", ChannelNumber); @@ -89,3 +89,4 @@ void cStatusBlock::ChannelSwitch(const cDevice *Device, int ChannelNumber) } } } + |