From 69356e9c4351cd2d47ba4630af6aec34e2aebddd Mon Sep 17 00:00:00 2001 From: kamel5 Date: Tue, 4 Aug 2020 15:08:37 +0200 Subject: [PATCH] Add "Timer On/Off" to recmenu --- po/ca_ES.po | 9 ++++++--- po/de_DE.po | 9 ++++++--- po/it_IT.po | 9 ++++++--- po/ru_RU.po | 9 ++++++--- po/sk_SK.po | 9 ++++++--- recmanager.c | 47 ++++++++++++++++++++++++++++++++++------------- recmanager.h | 3 ++- recmenuitem.h | 1 + recmenus.c | 3 ++- recmenuview.c | 8 ++++++++ 10 files changed, 77 insertions(+), 30 deletions(-) diff --git a/po/ca_ES.po b/po/ca_ES.po index 77a9b1a..3d66763 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-17 14:30+0100\n" +"POT-Creation-Date: 2020-08-04 14:15+0200\n" "PO-Revision-Date: 2013-09-21 17:49+0200\n" "Last-Translator: My friend Thanks David \n" "Language-Team: \n" @@ -105,12 +105,15 @@ msgstr "" msgid "Instant Record" msgstr "Enregistra a l'instant" -msgid "Delete Timer" -msgstr "Esborra temporitzador" +msgid "Timer On/Off" +msgstr "Temporitzador On/Off" msgid "Edit Timer" msgstr "Edita temporitzador" +msgid "Delete Timer" +msgstr "Esborra temporitzador" + msgid "Timer Timeline" msgstr "" diff --git a/po/de_DE.po b/po/de_DE.po index a654efd..0b9cad9 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-17 14:30+0100\n" +"POT-Creation-Date: 2020-08-04 14:15+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: Horst\n" "Language-Team: \n" @@ -102,12 +102,15 @@ msgstr "erledigte Aufnahmen" msgid "Instant Record" msgstr "Aufnahme" -msgid "Delete Timer" -msgstr "Timer löschen" +msgid "Timer On/Off" +msgstr "Timer Ein/Aus" msgid "Edit Timer" msgstr "Timer bearbeiten" +msgid "Delete Timer" +msgstr "Timer löschen" + msgid "Timer Timeline" msgstr "Timer Tagesübersicht" diff --git a/po/it_IT.po b/po/it_IT.po index a2ef64b..5b5c7a3 100644 --- a/po/it_IT.po +++ b/po/it_IT.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 0.0.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-17 14:30+0100\n" +"POT-Creation-Date: 2020-08-04 14:15+0200\n" "PO-Revision-Date: 2012-08-25 17:49+0200\n" "Last-Translator: fiveten_59\n" "Language-Team: \n" @@ -102,12 +102,15 @@ msgstr "registrazione eseguita" msgid "Instant Record" msgstr "Registrazione immediata" -msgid "Delete Timer" -msgstr "Cancella il Timer" +msgid "Timer On/Off" +msgstr "Timer On/Off" msgid "Edit Timer" msgstr "Edita il Timer" +msgid "Delete Timer" +msgstr "Cancella il Timer" + msgid "Timer Timeline" msgstr "Scadenza del Timer" diff --git a/po/ru_RU.po b/po/ru_RU.po index 1d42229..bc5496a 100644 --- a/po/ru_RU.po +++ b/po/ru_RU.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-17 14:30+0100\n" +"POT-Creation-Date: 2020-08-04 14:15+0200\n" "PO-Revision-Date: 2013-09-25 17:49+0400\n" "Last-Translator: AmiD, ilya\n" "Language-Team: Russia-Cherepovets(wm.amid@gmail.com)\n" @@ -102,12 +102,15 @@ msgstr "" msgid "Instant Record" msgstr "Записать" -msgid "Delete Timer" -msgstr "Удалить таймер" +msgid "Timer On/Off" +msgstr "таймер Вкл/Выкл" msgid "Edit Timer" msgstr "Редактировать таймер" +msgid "Delete Timer" +msgstr "Удалить таймер" + msgid "Timer Timeline" msgstr "" diff --git a/po/sk_SK.po b/po/sk_SK.po index de867a7..0c0dd26 100644 --- a/po/sk_SK.po +++ b/po/sk_SK.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: vdr-tvguide 1.1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-02-17 14:30+0100\n" +"POT-Creation-Date: 2020-08-04 14:15+0200\n" "PO-Revision-Date: 2013-09-15 00:12+0100\n" "Last-Translator: Milan Hrala \n" "Language-Team: \n" @@ -102,12 +102,15 @@ msgstr "" msgid "Instant Record" msgstr "Okamite nahra" -msgid "Delete Timer" -msgstr "Vymaza pln nahrvania" +msgid "Timer On/Off" +msgstr "Zap./Vyp. pln nahrvania" msgid "Edit Timer" msgstr "Upravi pln nahrvania" +msgid "Delete Timer" +msgstr "Vymaza pln nahrvania" + msgid "Timer Timeline" msgstr "" diff --git a/recmanager.c b/recmanager.c index ce95909..f55f6c9 100644 --- a/recmanager.c +++ b/recmanager.c @@ -267,6 +267,21 @@ void cRecManager::DeleteRemoteTimer(const cEvent *event) { } } +void cRecManager::OnOffTimer(const cEvent *event) { + const cTimer *t; +#if VDRVERSNUM >= 20301 + { + LOCK_TIMERS_READ; + t = Timers->GetMatch(event); + } +#else + t = Timers.GetMatch(event); +#endif + if (!t) + return; + SaveTimer(t); +} + void cRecManager::SaveTimer(const cTimer *t, cTimer *newTimerSettings) { if (!t) return; @@ -288,20 +303,26 @@ void cRecManager::SaveTimer(const cTimer *t, cTimer *newTimerSettings) { if (!timer) { return; } - bool active = newTimerSettings->HasFlags(tfActive); - int prio = newTimerSettings->Priority(); - int lifetime = newTimerSettings->Lifetime(); - time_t day = newTimerSettings->Day(); - int start = newTimerSettings->Start(); - int stop = newTimerSettings->Stop(); - std::string fileName = newTimerSettings->File(); - timer->SetDay(day); - timer->SetStart(start); - timer->SetStop(stop); - timer->SetPriority(prio); - timer->SetLifetime(lifetime); - timer->SetFile(fileName.c_str()); + bool active = true; + if (newTimerSettings) { + int prio = newTimerSettings->Priority(); + int lifetime = newTimerSettings->Lifetime(); + time_t day = newTimerSettings->Day(); + int start = newTimerSettings->Start(); + int stop = newTimerSettings->Stop(); + std::string fileName = newTimerSettings->File(); + + timer->SetDay(day); + timer->SetStart(start); + timer->SetStop(stop); + timer->SetPriority(prio); + timer->SetLifetime(lifetime); + timer->SetFile(fileName.c_str()); + + active = newTimerSettings->HasFlags(tfActive); + } else + active = !timer->HasFlags(tfActive); if (active) timer->SetFlags(tfActive); diff --git a/recmanager.h b/recmanager.h index bc405ba..54d6235 100644 --- a/recmanager.h +++ b/recmanager.h @@ -33,11 +33,12 @@ public: cTimer *createLocalTimer(const cEvent *event, std::string path); cTimer *createRemoteTimer(const cEvent *event, std::string path); void SetTimerPath(cTimer *timer, const cEvent *event, std::string path); + void OnOffTimer(const cEvent *event); void DeleteTimer(const cTimer *timer); void DeleteTimer(const cEvent *event); void DeleteLocalTimer(const cEvent *event); void DeleteRemoteTimer(const cEvent *event); - void SaveTimer(const cTimer *timer, cTimer *newTimerSettings); + void SaveTimer(const cTimer *timer, cTimer *newTimerSettings = NULL); bool IsRecorded(const cEvent *event); cTVGuideTimerConflicts *CheckTimerConflict(void); void CreateSeriesTimer(cTimer *seriesTimer); diff --git a/recmenuitem.h b/recmenuitem.h index 298e46f..a98e21d 100644 --- a/recmenuitem.h +++ b/recmenuitem.h @@ -25,6 +25,7 @@ enum eRecMenuState { rmsSearchRerunsTimerConflictMenu, rmsSaveTimerConflictMenu, rmsTimerConflictShowInfo, + rmsOnOffTimer, rmsDeleteTimer, rmsDeleteTimerConfirmation, rmsEditTimer, diff --git a/recmenus.c b/recmenus.c index 90f8bf0..987a20c 100644 --- a/recmenus.c +++ b/recmenus.c @@ -11,8 +11,9 @@ cRecMenuMain::cRecMenuMain(bool epgSearchAvailable, bool timerActive, bool switc action = rmsInstantRecordFolder; AddMenuItem(new cRecMenuItemButton(tr("Instant Record"), action, true, false, false, true)); } else { - AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, true, false, false, true)); + AddMenuItem(new cRecMenuItemButton(tr("Timer On/Off"), rmsOnOffTimer, true, false, false, true)); AddMenuItem(new cRecMenuItemButton(tr("Edit Timer"), rmsEditTimer, false, false, false, true)); + AddMenuItem(new cRecMenuItemButton(tr("Delete Timer"), rmsDeleteTimer, false, false, false, true)); } AddMenuItem(new cRecMenuItemButton(tr("Timer Timeline"), rmsTimeline, false, false, false, true)); diff --git a/recmenuview.c b/recmenuview.c index c2659d3..22f1961 100644 --- a/recmenuview.c +++ b/recmenuview.c @@ -177,6 +177,14 @@ eOSState cRecMenuView::StateMachine(eRecMenuState nextState) { activeMenu = new cRecMenuAskFolder(event, rmsInstantRecord); activeMenu->Display(); break; + case rmsOnOffTimer: { + //caller: main menu + //De/Activate timer for active event + recManager->OnOffTimer(event); + delete activeMenu; + activeMenu = new cRecMenuConfirmTimer(event, true); + activeMenu->Display(); + break; } case rmsDeleteTimer: { //caller: main menu //delete timer for active event