diff options
author | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2015-02-09 21:10:31 +0100 |
---|---|---|
committer | Martin Schirrmacher <vdr.skinflatplus@schirrmacher.eu> | 2015-02-09 21:10:31 +0100 |
commit | 9f184bb3e2c975fa71dad5a65a7e267ea2b7b424 (patch) | |
tree | 2bd9f7bbd5a06075822c8e23c300b23f6cd3c481 | |
parent | d7635ebd99454747c26d8ddd067858af75e57de2 (diff) | |
download | skin-flatplus-9f184bb3e2c975fa71dad5a65a7e267ea2b7b424.tar.gz skin-flatplus-9f184bb3e2c975fa71dad5a65a7e267ea2b7b424.tar.bz2 |
add remote timers support
-rw-r--r-- | HISTORY | 5 | ||||
-rw-r--r-- | config.c | 8 | ||||
-rw-r--r-- | config.h | 3 | ||||
-rw-r--r-- | displaymenu.c | 174 | ||||
-rw-r--r-- | displaymenu.h | 1 | ||||
-rw-r--r-- | flat.c | 1 | ||||
-rw-r--r-- | flat.h | 2 | ||||
-rw-r--r-- | po/de_DE.po | 17 | ||||
-rw-r--r-- | setup.c | 11 |
9 files changed, 166 insertions, 56 deletions
@@ -19,6 +19,11 @@ VDR Plugin 'skinflatplus' Revision History - [add] provide support for new SetMenuSortMode function, to show sort in menus - [add] recording menu, progressbar icon to show how much seen from the recording - [add] option to allways show date in schedule menu +- [add] timer widget + remote timer support. If you have remote timers installed and activate it in setup you'll get local timer with 'L' and remote timer with 'R'. + Remote timers will be refreshed every 30 minutes. Every refresh cost several seconds when opening main menu. + You can adjust the time with the hidden setting 'MainMenuWidgetActiveTimerShowRemoteRefreshTime' in setup.conf + 2014-12-04: Version 0.5.0 - [fix] femon receiver - do not get data from previous channel @@ -95,6 +95,10 @@ cFlatConfig::cFlatConfig(void) { MainMenuWidgetActiveTimerHideEmpty = false; MainMenuWidgetActiveTimerShowActive = true; MainMenuWidgetActiveTimerShowRecording = true; + MainMenuWidgetActiveTimerShowRemoteActive = false; + MainMenuWidgetActiveTimerShowRemoteRecording = false; + + MainMenuWidgetActiveTimerShowRemoteRefreshTime = 60 * 30; // every 30 minutes MainMenuWidgetLastRecShow = false; MainMenuWidgetLastRecPosition = 4; @@ -366,7 +370,9 @@ bool cFlatConfig::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "MainMenuWidgetActiveTimerShowActive") == 0) MainMenuWidgetActiveTimerShowActive = atoi(Value); else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRecording") == 0) MainMenuWidgetActiveTimerShowRecording = atoi(Value); else if (strcmp(Name, "MenuEventViewAllwaysWithDate") == 0) MenuEventViewAllwaysWithDate = atoi(Value); - + else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRemoteActive") == 0) MainMenuWidgetActiveTimerShowRemoteActive = atoi(Value); + else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRemoteRecording") == 0) MainMenuWidgetActiveTimerShowRemoteRecording = atoi(Value); + else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRemoteRefreshTime") == 0) MainMenuWidgetActiveTimerShowRemoteRefreshTime = atoi(Value); else return false; return true; @@ -273,6 +273,9 @@ class cFlatConfig int MainMenuWidgetActiveTimerMaxCount; int MainMenuWidgetActiveTimerShowActive; int MainMenuWidgetActiveTimerShowRecording; + int MainMenuWidgetActiveTimerShowRemoteActive; + int MainMenuWidgetActiveTimerShowRemoteRecording; + int MainMenuWidgetActiveTimerShowRemoteRefreshTime; // in seconds int MainMenuWidgetActiveTimerHideEmpty; int MainMenuWidgetLastRecShow; diff --git a/displaymenu.c b/displaymenu.c index 2609191a..37972447 100644 --- a/displaymenu.c +++ b/displaymenu.c @@ -1,6 +1,7 @@ #include "displaymenu.h" #include "services/scraper2vdr.h" #include "services/epgsearch.h" +#include "services/remotetimers.h" #include <utility> #include <fstream> #include <iostream> @@ -4222,74 +4223,153 @@ int cFlatDisplayMenu::DrawMainMenuWidgetActiveTimers(int wLeft, int wWidth, int contentWidget.AddRect(cRect(0, ContentTop, wWidth, 3), Theme.Color(clrMenuEventTitleLine)); ContentTop += 6; + //check if remotetimers plugin is available + static cPlugin* pRemoteTimers = cPluginManager::GetPlugin("remotetimers"); + cSchedulesLock SchedulesLock; + const cSchedules *Schedules = cSchedules::Schedules(SchedulesLock); + + time_t now; + time(&now); + if( (Config.MainMenuWidgetActiveTimerShowRemoteActive || Config.MainMenuWidgetActiveTimerShowRemoteRecording) && pRemoteTimers && (now - remoteTimersLastRefresh) > Config.MainMenuWidgetActiveTimerShowRemoteRefreshTime ) { + remoteTimersLastRefresh = now; + cString errorMsg; + pRemoteTimers->Service("RemoteTimers::RefreshTimers-v1.0", &errorMsg); + } + // look for timers - int numRec = 0, numActive = 0; + cVector<const cTimer *> timerRec; + cVector<const cTimer *> timerActive; + cVector<const cTimer *> timerRemoteRec; + cVector<const cTimer *> timerRemoteActive; + for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti) ) { if( ti->HasFlags(tfRecording) && Config.MainMenuWidgetActiveTimerShowRecording ) - numRec++; - if( ti->HasFlags(tfActive) && Config.MainMenuWidgetActiveTimerShowActive ) - numActive++; + timerRec.Append(ti); + if( ti->HasFlags(tfActive) && !ti->HasFlags(tfRecording) && Config.MainMenuWidgetActiveTimerShowActive ) + timerActive.Append(ti); - if( numRec + numActive >= Config.MainMenuWidgetActiveTimerMaxCount ) + if( timerRec.Size() + timerActive.Size() >= Config.MainMenuWidgetActiveTimerMaxCount ) break; } - if( (numRec == 0 && numActive == 0) && Config.MainMenuWidgetActiveTimerHideEmpty ) + if( (Config.MainMenuWidgetActiveTimerShowRemoteActive || Config.MainMenuWidgetActiveTimerShowRemoteRecording) && pRemoteTimers && + timerRec.Size() + timerActive.Size() < Config.MainMenuWidgetActiveTimerMaxCount ) { + cTimer* remoteTimer = NULL; + while( pRemoteTimers->Service("RemoteTimers::ForEach-v1.0", &remoteTimer) && remoteTimer != NULL ) { + remoteTimer->SetEventFromSchedule(Schedules); // make sure the event is current + if( remoteTimer->HasFlags(tfRecording) && Config.MainMenuWidgetActiveTimerShowRemoteRecording ) + timerRemoteRec.Append(remoteTimer); + if( remoteTimer->HasFlags(tfActive) && !remoteTimer->HasFlags(tfRecording) && Config.MainMenuWidgetActiveTimerShowRemoteActive ) + timerRemoteActive.Append(remoteTimer); + } + } + + if( (timerRec.Size() == 0 && timerActive.Size() == 0 && timerRemoteRec.Size() == 0 && timerRemoteActive.Size() == 0) && Config.MainMenuWidgetActiveTimerHideEmpty ) return 0; - else if( numRec == 0 && numActive == 0 ) { + else if( timerRec.Size() == 0 && timerActive.Size() == 0 && timerRemoteRec.Size() == 0 && timerRemoteActive.Size() == 0 ) { contentWidget.AddText(tr("no active/recording timer"), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); } else { int count = -1; + int remotecount = -1; // first recording timer if( Config.MainMenuWidgetActiveTimerShowRecording ) { - for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) { - if( ti->HasFlags(tfRecording) ) { - count++; - if( ContentTop + marginItem > menuPixmap->ViewPort().Height() ) - break; - if( count >= Config.MainMenuWidgetActiveTimerMaxCount ) - break; - const cChannel *Channel = ti->Channel(); - //const cEvent *Event = Timer->Event(); - std::stringstream strTimer; - strTimer << count+1 << ": "; - if( Channel ) - strTimer << Channel->Name() << " - "; - else - strTimer << tr("Unknown") << " - "; - strTimer << ti->File(); + for(int i = 0; i < timerRec.Size(); i++) { + count++; + if( ContentTop + marginItem > menuPixmap->ViewPort().Height() ) + break; + if( count >= Config.MainMenuWidgetActiveTimerMaxCount ) + break; + const cChannel *Channel = (timerRec[i])->Channel(); + //const cEvent *Event = Timer->Event(); + std::stringstream strTimer; + if( (Config.MainMenuWidgetActiveTimerShowRemoteActive || Config.MainMenuWidgetActiveTimerShowRemoteRecording) && pRemoteTimers && + (timerRemoteRec.Size() > 0 || timerRemoteActive.Size() > 0) ) + strTimer << "L"; + strTimer << count+1 << ": "; + if( Channel ) + strTimer << Channel->Name() << " - "; + else + strTimer << tr("Unknown") << " - "; + strTimer << (timerRec[i])->File(); - contentWidget.AddText(strTimer.str().c_str(), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), - Theme.Color(clrTopBarRecordingActiveFg), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); + contentWidget.AddText(strTimer.str().c_str(), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), + Theme.Color(clrTopBarRecordingActiveFg), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); - ContentTop += fontSmlHeight; - } + ContentTop += fontSmlHeight; } } if( Config.MainMenuWidgetActiveTimerShowActive ) { - for(cTimer *ti = Timers.First(); ti; ti = Timers.Next(ti)) { - if( ti->HasFlags(tfActive) && !ti->HasFlags(tfRecording) ) { - count++; - if( ContentTop + marginItem > menuPixmap->ViewPort().Height() ) - break; - if( count >= Config.MainMenuWidgetActiveTimerMaxCount ) - break; + for(int i = 0; i < timerActive.Size(); i++) { + count++; + if( ContentTop + marginItem > menuPixmap->ViewPort().Height() ) + break; + if( count >= Config.MainMenuWidgetActiveTimerMaxCount ) + break; + + const cChannel *Channel = (timerActive[i])->Channel(); + //const cEvent *Event = Timer->Event(); + std::stringstream strTimer; + if( (Config.MainMenuWidgetActiveTimerShowRemoteActive || Config.MainMenuWidgetActiveTimerShowRemoteRecording) && pRemoteTimers && + (timerRemoteRec.Size() > 0 || timerRemoteActive.Size() > 0) ) + strTimer << "L"; + strTimer << count+1 << ": "; + if( Channel ) + strTimer << Channel->Name() << " - "; + else + strTimer << tr("Unknown") << " - "; + strTimer << (timerActive[i])->File(); - const cChannel *Channel = ti->Channel(); - //const cEvent *Event = Timer->Event(); - std::stringstream strTimer; - strTimer << count+1 << ": "; - if( Channel ) - strTimer << Channel->Name() << " - "; - else - strTimer << tr("Unknown") << " - "; - strTimer << ti->File(); + contentWidget.AddText(strTimer.str().c_str(), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), + Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); - contentWidget.AddText(strTimer.str().c_str(), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), - Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); + ContentTop += fontSmlHeight; + } + } + if( Config.MainMenuWidgetActiveTimerShowRemoteRecording ) { + for(int i = 0; i < timerRemoteRec.Size(); i++) { + remotecount++; + if( ContentTop + marginItem > menuPixmap->ViewPort().Height() ) + break; + if( count + remotecount >= Config.MainMenuWidgetActiveTimerMaxCount ) + break; + const cChannel *Channel = (timerRemoteRec[i])->Channel(); + //const cEvent *Event = Timer->Event(); + std::stringstream strTimer; + strTimer << "R" << remotecount+1 << ": "; + if( Channel ) + strTimer << Channel->Name() << " - "; + else + strTimer << tr("Unknown") << " - "; + strTimer << (timerRemoteRec[i])->File(); - ContentTop += fontSmlHeight; - } + contentWidget.AddText(strTimer.str().c_str(), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), + Theme.Color(clrTopBarRecordingActiveFg), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); + + ContentTop += fontSmlHeight; + } + } + if( Config.MainMenuWidgetActiveTimerShowRemoteActive ) { + for(int i = 0; i < timerRemoteActive.Size(); i++) { + remotecount++; + if( ContentTop + marginItem > menuPixmap->ViewPort().Height() ) + break; + if( count + remotecount >= Config.MainMenuWidgetActiveTimerMaxCount ) + break; + + const cChannel *Channel = (timerRemoteActive[i])->Channel(); + //const cEvent *Event = Timer->Event(); + std::stringstream strTimer; + strTimer << "R" << remotecount+1 << ": "; + if( Channel ) + strTimer << Channel->Name() << " - "; + else + strTimer << tr("Unknown") << " - "; + strTimer << (timerRemoteActive[i])->File(); + + contentWidget.AddText(strTimer.str().c_str(), false, cRect(marginItem, ContentTop, wWidth - marginItem*2, fontSmlHeight), + Theme.Color(clrMenuEventFontInfo), Theme.Color(clrMenuEventBg), fontSml, wWidth - marginItem*2); + + ContentTop += fontSmlHeight; } } } diff --git a/displaymenu.h b/displaymenu.h index 721617c0..8ef1d4d0 100644 --- a/displaymenu.h +++ b/displaymenu.h @@ -101,7 +101,6 @@ class cFlatDisplayMenu : public cFlatBaseRender, public cSkinDisplayMenu { int DrawMainMenuWidgetTemperaturs(int wLeft, int wWidth, int ContentTop); int DrawMainMenuWidgetCommand(int wLeft, int wWidth, int ContentTop); int DrawMainMenuWidgetWeather(int wLeft, int wWidth, int ContentTop); - public: cFlatDisplayMenu(void); virtual ~cFlatDisplayMenu(); @@ -16,6 +16,7 @@ class cImageCache imgCache; cTheme Theme; static bool menuActive = false; bool firstDisplay = true; +time_t remoteTimersLastRefresh = 0; cFlat::cFlat(void) : cSkin("flatPlus", &::Theme) { displayMenu = NULL; @@ -17,6 +17,8 @@ extern class cFlatConfig Config; extern class cImageCache imgCache; extern bool firstDisplay; +extern time_t remoteTimersLastRefresh; + class cFlatDisplayMenu; extern cTheme Theme; diff --git a/po/de_DE.po b/po/de_DE.po index 776748b9..d14cd33a 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -6,10 +6,10 @@ msgid "" msgstr "" "Project-Id-Version: vdr-skinflat 0.5.0\n" "Report-Msgid-Bugs-To: <see README>\n" -"POT-Creation-Date: 2015-02-08 14:30+0100\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" -"Language-Team: LANGUAGE <LL@li.org>\n" +"POT-Creation-Date: 2015-02-09 20:09+0100\n" +"PO-Revision-Date: 2015-02-09 20:09+0100\n" +"Last-Translator: Martin Schirrmacher\n" +"Language-Team: Martin Schirrmacher\n" "Language: de_DE\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=ISO-8859-15\n" @@ -822,6 +822,12 @@ msgstr "Timer-Widget: zeige aufnehmende Timer" msgid "Widget timer: show active timer" msgstr "Timer-Widget: zeige aktive Timer" +msgid "Widget timer: show remote recording timer" +msgstr "Timer-Widget: zeige Remote aufnehmende Timer" + +msgid "Widget timer: show remote active timer" +msgstr "Timer-Widget: zeige Remote aktive Timer" + msgid "Widget timer: max show" msgstr "Timer-Widget: Zeige max." @@ -890,6 +896,3 @@ msgstr "Eigene Befehle-Widget: Anzeigen" msgid "Widget custom commands: position" msgstr "Eigene Befehle-Widget: Position" - -#~ msgid "Audio Tracks" -#~ msgstr "Tonspuren" @@ -321,6 +321,9 @@ void cFlatSetup::Store(void) { SetupStore("MainMenuWidgetActiveTimerShowActive", Config.MainMenuWidgetActiveTimerShowActive); SetupStore("MainMenuWidgetActiveTimerShowRecording", Config.MainMenuWidgetActiveTimerShowRecording); SetupStore("MenuEventViewAllwaysWithDate", Config.MenuEventViewAllwaysWithDate); + SetupStore("MainMenuWidgetActiveTimerShowRemoteActive", Config.MainMenuWidgetActiveTimerShowRemoteActive); + SetupStore("MainMenuWidgetActiveTimerShowRemoteRecording", Config.MainMenuWidgetActiveTimerShowRemoteRecording); + SetupStore("MainMenuWidgetActiveTimerShowRemoteRefreshTime", Config.MainMenuWidgetActiveTimerShowRemoteRefreshTime); Config.Init(); } @@ -507,6 +510,9 @@ bool cFlatSetupGeneral::SetupParse(const char *Name, const char *Value) { else if (strcmp(Name, "MainMenuWidgetActiveTimerShowActive") == 0) SetupConfig->MainMenuWidgetActiveTimerShowActive = atoi(Value); else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRecording") == 0) SetupConfig->MainMenuWidgetActiveTimerShowRecording = atoi(Value); else if (strcmp(Name, "MenuEventViewAllwaysWithDate") == 0) SetupConfig->MenuEventViewAllwaysWithDate = atoi(Value); + else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRemoteActive") == 0) SetupConfig->MainMenuWidgetActiveTimerShowRemoteActive = atoi(Value); + else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRemoteRecording") == 0) SetupConfig->MainMenuWidgetActiveTimerShowRemoteRecording = atoi(Value); + else if (strcmp(Name, "MainMenuWidgetActiveTimerShowRemoteRefreshTime") == 0) SetupConfig->MainMenuWidgetActiveTimerShowRemoteRefreshTime = atoi(Value); else return false; return true; @@ -675,6 +681,9 @@ void cFlatSetupGeneral::SaveCurrentSettings(void) { Config.Store("MainMenuWidgetActiveTimerShowActive", SetupConfig->MainMenuWidgetActiveTimerShowActive, *Filename); Config.Store("MainMenuWidgetActiveTimerShowRecording", SetupConfig->MainMenuWidgetActiveTimerShowRecording, *Filename); Config.Store("MenuEventViewAllwaysWithDate", SetupConfig->MenuEventViewAllwaysWithDate, *Filename); + Config.Store("MainMenuWidgetActiveTimerShowRemoteActive", SetupConfig->MainMenuWidgetActiveTimerShowRemoteActive, *Filename); + Config.Store("MainMenuWidgetActiveTimerShowRemoteRecording", SetupConfig->MainMenuWidgetActiveTimerShowRemoteRecording, *Filename); + Config.Store("MainMenuWidgetActiveTimerShowRemoteRefreshTime", SetupConfig->MainMenuWidgetActiveTimerShowRemoteRefreshTime, *Filename); cString msg = cString::sprintf("%s %s", tr("saved settings in file:"), *File); Skins.Message(mtInfo, msg); @@ -1299,6 +1308,8 @@ void cFlatSetupMMWidget::Setup(void) { Add(new cMenuEditIntItem(tr("Widget timer: position"), &SetupConfig->MainMenuWidgetActiveTimerPosition)); Add(new cMenuEditBoolItem(tr("Widget timer: show recording timer"), &SetupConfig->MainMenuWidgetActiveTimerShowRecording)); Add(new cMenuEditBoolItem(tr("Widget timer: show active timer"), &SetupConfig->MainMenuWidgetActiveTimerShowActive)); + Add(new cMenuEditBoolItem(tr("Widget timer: show remote recording timer"), &SetupConfig->MainMenuWidgetActiveTimerShowRemoteRecording)); + Add(new cMenuEditBoolItem(tr("Widget timer: show remote active timer"), &SetupConfig->MainMenuWidgetActiveTimerShowRemoteActive)); Add(new cMenuEditIntItem(tr("Widget timer: max show"), &SetupConfig->MainMenuWidgetActiveTimerMaxCount)); Add(new cMenuEditBoolItem(tr("Widget timer: hide if empty"), &SetupConfig->MainMenuWidgetActiveTimerHideEmpty)); } |