diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2015-11-01 22:13:15 +0100 |
---|---|---|
committer | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2015-11-06 12:07:47 +0100 |
commit | 067e138b394b506f44b8daf5e2fd1ab63e34121d (patch) | |
tree | 23c3f0dcc5ac3f5effceb1f2b682de9f2fdc79ae | |
parent | 212ad18810f4c9e900532f4cc42090bc3433aae3 (diff) |
[PVR] Context menu cleanup: Consequently use same logic for 'Stop recording' vs 'Delete timer'
-rw-r--r-- | addons/resource.language.en_gb/resources/strings.po | 14 | ||||
-rw-r--r-- | xbmc/dialogs/GUIDialogContextMenu.h | 2 | ||||
-rw-r--r-- | xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp | 73 | ||||
-rw-r--r-- | xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h | 2 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRBase.cpp | 81 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRBase.h | 37 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRChannels.cpp | 32 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRChannels.h | 3 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRGuide.cpp | 29 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRGuide.h | 1 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRRecordings.cpp | 2 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRSearch.cpp | 45 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRSearch.h | 1 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRTimers.cpp | 36 | ||||
-rw-r--r-- | xbmc/pvr/windows/GUIWindowPVRTimers.h | 1 |
15 files changed, 234 insertions, 125 deletions
diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 434f190171..345e7466f1 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -3646,7 +3646,19 @@ msgctxt "#846" msgid "Are you sure you want to delete this timer?" msgstr "" -#empty strings from id 847 to 849 +#. Message in a dialog when a user wants to delete a non-repeating timer +#: xbmc/pvr/windows/GUIWindowPVRBase.cpp +msgctxt "#847" +msgid "Confirm stop recording" +msgstr "" + +#. Message in a dialog when a user wants to delete a non-repeating timer +#: xbmc/pvr/windows/GUIWindowPVRBase.cpp +msgctxt "#848" +msgid "Are you sure you want to stop this recording?" +msgstr "" + +#empty string with id 849 msgctxt "#850" msgid "Invalid port number entered" diff --git a/xbmc/dialogs/GUIDialogContextMenu.h b/xbmc/dialogs/GUIDialogContextMenu.h index fc3a8b40fb..2ce98af6ba 100644 --- a/xbmc/dialogs/GUIDialogContextMenu.h +++ b/xbmc/dialogs/GUIDialogContextMenu.h @@ -107,6 +107,7 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0, CONTEXT_BUTTON_START_RECORD, CONTEXT_BUTTON_ADD_TIMER, CONTEXT_BUTTON_STOP_RECORD, + CONTEXT_BUTTON_DELETE_TIMER, CONTEXT_BUTTON_GROUP_MANAGER, CONTEXT_BUTTON_CHANNEL_MANAGER, CONTEXT_BUTTON_FILTER, @@ -125,7 +126,6 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0, CONTEXT_BUTTON_PLAY_AND_QUEUE, CONTEXT_BUTTON_PLAY_ONLY_THIS, CONTEXT_BUTTON_UPDATE_EPG, - CONTEXT_BUTTON_RECORD_ITEM, CONTEXT_BUTTON_TAGS_ADD_ITEMS, CONTEXT_BUTTON_TAGS_REMOVE_ITEMS, CONTEXT_BUTTON_SET_MOVIESET, diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp index f9b07cf975..bd1d211711 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp @@ -60,36 +60,26 @@ bool CGUIDialogPVRGuideInfo::ActionStartTimer(const CEpgInfoTagPtr &tag) { bool bReturn = false; - if (!tag) - return false; - - CPVRChannelPtr channel = tag->ChannelTag(); - if (!channel || !g_PVRManager.CheckParentalLock(channel)) - return false; - - Close(); + CFileItemPtr item(new CFileItem(tag)); + bReturn = CGUIWindowPVRBase::AddTimer(item.get(), false); - CPVRTimerInfoTagPtr newTimer = CPVRTimerInfoTag::CreateFromEpg(tag); - if (newTimer) - bReturn = CPVRTimers::AddTimer(newTimer); - else - bReturn = false; + if (bReturn) + Close(); return bReturn; } -bool CGUIDialogPVRGuideInfo::ActionCancelTimer(CFileItemPtr timer) +bool CGUIDialogPVRGuideInfo::ActionCancelTimer(const CFileItemPtr &timer) { - bool bReturn(false); - if (!timer || !timer->HasPVRTimerInfoTag()) - return bReturn; + bool bReturn = false; - bool bDeleteSchedule(false); - if (CGUIWindowPVRBase::ConfirmDeleteTimer(timer.get(), bDeleteSchedule)) - { + if (timer->GetPVRTimerInfoTag()->IsRecording()) + bReturn = CGUIWindowPVRBase::StopRecordFile(timer.get()); + else + bReturn = CGUIWindowPVRBase::DeleteTimer(timer.get()); + + if (bReturn) Close(); - bReturn = CPVRTimers::DeleteTimer(*timer, false, bDeleteSchedule); - } return bReturn; } @@ -234,29 +224,26 @@ void CGUIDialogPVRGuideInfo::OnInitWindow() SET_CONTROL_HIDDEN(CONTROL_BTN_PLAY_RECORDING); } - if (tag->EndAsLocalTime() <= CDateTime::GetCurrentDateTime()) + bool bHideRecord(true); + if (tag->HasTimer()) { - /* event has passed. hide the record button */ - SET_CONTROL_HIDDEN(CONTROL_BTN_RECORD); - return; - } - - CFileItemPtr match = g_PVRTimers->GetTimerForEpgTag(m_progItem.get()); - if (!match || !match->HasPVRTimerInfoTag()) - { - /* no timer present on this tag */ - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 264); // Record + if (tag->Timer()->IsRecording()) + { + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19059); /* Stop recording */ + bHideRecord = false; + } + else if (tag->Timer()->HasTimerType() && !tag->Timer()->GetTimerType()->IsReadOnly()) + { + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19060); /* Delete timer */ + bHideRecord = false; + } } - else + else if (tag->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) { - /* timer present on this tag */ - if (tag->StartAsLocalTime() < CDateTime::GetCurrentDateTime()) - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19059); // Stop recording - else if (match->HasPVRTimerInfoTag() && - match->GetPVRTimerInfoTag()->HasTimerType() && - !match->GetPVRTimerInfoTag()->GetTimerType()->IsReadOnly()) - SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19060); // Delete timer - else - SET_CONTROL_HIDDEN(CONTROL_BTN_RECORD); + SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 264); /* Record */ + bHideRecord = false; } + + if (bHideRecord) + SET_CONTROL_HIDDEN(CONTROL_BTN_RECORD); } diff --git a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h index 39fc09fbd7..e3a0581824 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h +++ b/xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h @@ -47,7 +47,7 @@ namespace PVR virtual void OnInitWindow(); bool ActionStartTimer(const EPG::CEpgInfoTagPtr &tag); - bool ActionCancelTimer(CFileItemPtr timer); + bool ActionCancelTimer(const CFileItemPtr &timer); bool OnClickButtonOK(CGUIMessage &message); bool OnClickButtonRecord(CGUIMessage &message); diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp index c082484263..da842464c4 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRBase.cpp @@ -456,10 +456,27 @@ bool CGUIWindowPVRBase::ShowTimerSettings(CFileItem *item) bool CGUIWindowPVRBase::AddTimer(CFileItem *item, bool bAdvanced) { - if (!item->HasEPGInfoTag()) - return false; + CFileItemPtr epgTag; + if (item->IsEPG()) + { + epgTag.reset(new CFileItem(*item)); + if (!epgTag->GetEPGInfoTag()->HasPVRChannel()) + return false; + } + else if (item->IsPVRChannel()) + { + CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); + if (!channel) + return false; + + CEpgInfoTagPtr epgNow(channel->GetEPGNow()); + if (!epgNow) + return false; - const CEpgInfoTagPtr tag = item->GetEPGInfoTag(); + epgTag.reset(new CFileItem(epgNow)); + } + + const CEpgInfoTagPtr tag = epgTag->GetEPGInfoTag(); CPVRChannelPtr channel = tag->ChannelTag(); if (!channel || !g_PVRManager.CheckParentalLock(channel)) @@ -497,23 +514,52 @@ bool CGUIWindowPVRBase::AddTimer(CFileItem *item, bool bAdvanced) return bReturn; } +bool CGUIWindowPVRBase::DeleteTimer(CFileItem *item) +{ + return DeleteTimer(item, false); +} + bool CGUIWindowPVRBase::StopRecordFile(CFileItem *item) { - if (!item->HasEPGInfoTag()) - return false; + return DeleteTimer(item, true); +} - const CEpgInfoTagPtr tag(item->GetEPGInfoTag()); - if (!tag || !tag->HasPVRChannel()) - return false; +bool CGUIWindowPVRBase::DeleteTimer(CFileItem *item, bool bIsRecording) +{ + CFileItemPtr timer; + + if (item->IsPVRTimer()) + { + timer.reset(new CFileItem(*item)); + } + else if (item->IsEPG()) + { + timer = g_PVRTimers->GetTimerForEpgTag(item); + } + else if (item->IsPVRChannel()) + { + CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); + if (!channel) + return false; + + CFileItemPtr epgNow(new CFileItem(channel->GetEPGNow())); + timer = g_PVRTimers->GetTimerForEpgTag(epgNow.get()); + } - CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(item); if (!timer || !timer->HasPVRTimerInfoTag()) return false; - bool bDeleteSchedule(false); - if (ConfirmDeleteTimer(timer.get(), bDeleteSchedule)) - return CPVRTimers::DeleteTimer(*timer, false, bDeleteSchedule); - + if (bIsRecording) + { + if (ConfirmStopRecording(timer.get())) + return CPVRTimers::DeleteTimer(*timer, true, false); + } + else + { + bool bDeleteSchedule(false); + if (ConfirmDeleteTimer(timer.get(), bDeleteSchedule)) + return CPVRTimers::DeleteTimer(*timer, false, bDeleteSchedule); + } return false; } @@ -847,3 +893,12 @@ bool CGUIWindowPVRBase::ConfirmDeleteTimer(CFileItem *item, bool &bDeleteSchedul return bConfirmed; } + +bool CGUIWindowPVRBase::ConfirmStopRecording(CFileItem *item) +{ + return CGUIDialogYesNo::ShowAndGetInput( + CVariant{847}, // "Confirm stop recording" + CVariant{848}, // "Are you sure you want to stop this recording?" + CVariant{""}, + CVariant{item->GetPVRTimerInfoTag()->Title()}); +} diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.h b/xbmc/pvr/windows/GUIWindowPVRBase.h index 4253543bbc..3497bc9fee 100644 --- a/xbmc/pvr/windows/GUIWindowPVRBase.h +++ b/xbmc/pvr/windows/GUIWindowPVRBase.h @@ -76,16 +76,10 @@ namespace PVR static std::string GetSelectedItemPath(bool bRadio); static void SetSelectedItemPath(bool bRadio, const std::string &path); - /*! - * @brief Open a dialog to confirm timer delete. - * @param item the timer to delete. - * @param bDeleteSchedule in: ignored - * out, for one shot timer scheduled by a repeating timer: true to also delete the - * repeating timer that has scheduled this timer, false to only delete the one shot timer. - * out, for one shot timer not scheduled by a repeating timer: ignored - * @return true, to proceed with delete, false otherwise. - */ - static bool ConfirmDeleteTimer(CFileItem *item, bool &bDeleteSchedule); + static bool ShowTimerSettings(CFileItem *item); + static bool AddTimer(CFileItem *item, bool bAdvanced); + static bool DeleteTimer(CFileItem *item); + static bool StopRecordFile(CFileItem *item); protected: CGUIWindowPVRBase(bool bRadio, int id, const std::string &xmlFile); @@ -102,9 +96,6 @@ namespace PVR virtual bool PlayRecording(CFileItem *item, bool bPlayMinimized = false, bool bCheckResume = true); virtual bool PlayFile(CFileItem *item, bool bPlayMinimized = false, bool bCheckResume = true); - virtual bool ShowTimerSettings(CFileItem *item); - virtual bool AddTimer(CFileItem *item, bool bAdvanced = false); - virtual bool StopRecordFile(CFileItem *item); virtual void ShowEPGInfo(CFileItem *item); virtual void ShowRecordingInfo(CFileItem *item); virtual bool UpdateEpgForChannel(CFileItem *item); @@ -118,6 +109,26 @@ namespace PVR bool m_bRadio; private: + /*! + * @brief Open a dialog to confirm timer delete. + * @param item the timer to delete. + * @param bDeleteSchedule in: ignored + * out, for one shot timer scheduled by a repeating timer: true to also delete the + * repeating timer that has scheduled this timer, false to only delete the one shot timer. + * out, for one shot timer not scheduled by a repeating timer: ignored + * @return true, to proceed with delete, false otherwise. + */ + static bool ConfirmDeleteTimer(CFileItem *item, bool &bDeleteSchedule); + + /*! + * @brief Open a dialog to confirm stop recording. + * @param item the recording to stop (actually the timer to delete). + * @return true, to proceed with delete, false otherwise. + */ + static bool ConfirmStopRecording(CFileItem *item); + + static bool DeleteTimer(CFileItem *item, bool bIsRecording); + CPVRChannelGroupPtr m_group; XbmcThreads::EndTime m_refreshTimeout; }; diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp index b51eecc90a..2e01de2350 100644 --- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp @@ -86,7 +86,10 @@ void CGUIWindowPVRChannels::GetContextButtons(int itemNumber, CContextButtons &b buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar */ } - buttons.Add(CONTEXT_BUTTON_RECORD_ITEM, !channel->IsRecording() ? 264 : 19059); /* Record / Stop recording */ + if (channel->IsRecording()) + buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */ + else + buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */ if (g_PVRClients->HasMenuHooks(pItem->GetPVRChannelInfoTag()->ClientID(), PVR_MENUHOOK_CHANNEL)) buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */ @@ -116,7 +119,8 @@ bool CGUIWindowPVRChannels::OnContextButton(int itemNumber, CONTEXT_BUTTON butto OnContextButtonInfo(pItem.get(), button) || OnContextButtonGroupManager(pItem.get(), button) || OnContextButtonUpdateEpg(pItem.get(), button) || - OnContextButtonRecord(pItem.get(), button) || + OnContextButtonStartRecord(pItem.get(), button) || + OnContextButtonStopRecord(pItem.get(), button) || OnContextButtonManage(pItem.get(), button) || OnContextButtonActiveAEDSPSettings(pItem.get(), button) || CGUIWindowPVRBase::OnContextButton(itemNumber, button); @@ -339,16 +343,28 @@ bool CGUIWindowPVRChannels::OnContextButtonManage(CFileItem *item, CONTEXT_BUTTO return bReturn; } -bool CGUIWindowPVRChannels::OnContextButtonRecord(CFileItem *item, CONTEXT_BUTTON button) +bool CGUIWindowPVRChannels::OnContextButtonStartRecord(CFileItem *item, CONTEXT_BUTTON button) { - bool bReturn(false); + bool bReturn = false; - if (button == CONTEXT_BUTTON_RECORD_ITEM) + if ((button == CONTEXT_BUTTON_START_RECORD) || + (button == CONTEXT_BUTTON_ADD_TIMER)) { - CPVRChannelPtr channel(item->GetPVRChannelInfoTag()); + AddTimer(item, button == CONTEXT_BUTTON_ADD_TIMER); + bReturn = true; + } + + return bReturn; +} + +bool CGUIWindowPVRChannels::OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button) +{ + bool bReturn = false; - if (channel) - return g_PVRManager.ToggleRecordingOnChannel(channel->ChannelID()); + if (button == CONTEXT_BUTTON_STOP_RECORD) + { + StopRecordFile(item); + bReturn = true; } return bReturn; diff --git a/xbmc/pvr/windows/GUIWindowPVRChannels.h b/xbmc/pvr/windows/GUIWindowPVRChannels.h index 1d5d89eefe..049e518394 100644 --- a/xbmc/pvr/windows/GUIWindowPVRChannels.h +++ b/xbmc/pvr/windows/GUIWindowPVRChannels.h @@ -47,7 +47,8 @@ namespace PVR bool OnContextButtonInfo(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonManage(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonUpdateEpg(CFileItem *item, CONTEXT_BUTTON button); - bool OnContextButtonRecord(CFileItem *item, CONTEXT_BUTTON button); + bool OnContextButtonStartRecord(CFileItem *item, CONTEXT_BUTTON button); + bool OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button); void ShowChannelManager(); void ShowGroupManager(void); diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp index 283b8514b0..58de1d3e71 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp @@ -87,16 +87,15 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt if (pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->HasRecording()) buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 19687); /* Play recording */ - CFileItemPtr timer = g_PVRTimers->GetTimerForEpgTag(pItem.get()); - if (timer && timer->HasPVRTimerInfoTag()) + if (pItem->GetEPGInfoTag()->HasTimer()) { - if (timer->GetPVRTimerInfoTag()->IsRecording()) - buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */ - else if (timer->GetPVRTimerInfoTag()->HasTimerType() && - !timer->GetPVRTimerInfoTag()->GetTimerType()->IsReadOnly()) - buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19060); /* Delete timer */ + if (pItem->GetEPGInfoTag()->Timer()->IsRecording()) + buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */ + else if (pItem->GetEPGInfoTag()->Timer()->HasTimerType() && + !pItem->GetEPGInfoTag()->Timer()->GetTimerType()->IsReadOnly()) + buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060); /* Delete timer */ } - else if (pItem->HasEPGInfoTag() && pItem->GetEPGInfoTag()->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) + else if (pItem->GetEPGInfoTag()->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) { buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */ buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */ @@ -334,6 +333,7 @@ bool CGUIWindowPVRGuide::OnContextButton(int itemNumber, CONTEXT_BUTTON button) OnContextButtonInfo(pItem.get(), button) || OnContextButtonStartRecord(pItem.get(), button) || OnContextButtonStopRecord(pItem.get(), button) || + OnContextButtonDeleteTimer(pItem.get(), button) || OnContextButtonBegin(pItem.get(), button) || OnContextButtonEnd(pItem.get(), button) || OnContextButtonNow(pItem.get(), button) || @@ -533,3 +533,16 @@ bool CGUIWindowPVRGuide::OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTT return bReturn; } + +bool CGUIWindowPVRGuide::OnContextButtonDeleteTimer(CFileItem *item, CONTEXT_BUTTON button) +{ + bool bReturn = false; + + if (button == CONTEXT_BUTTON_DELETE_TIMER) + { + DeleteTimer(item); + bReturn = true; + } + + return bReturn; +} diff --git a/xbmc/pvr/windows/GUIWindowPVRGuide.h b/xbmc/pvr/windows/GUIWindowPVRGuide.h index fbfacab2af..311580a144 100644 --- a/xbmc/pvr/windows/GUIWindowPVRGuide.h +++ b/xbmc/pvr/windows/GUIWindowPVRGuide.h @@ -55,6 +55,7 @@ namespace PVR bool OnContextButtonPlay(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonStartRecord(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button); + bool OnContextButtonDeleteTimer(CFileItem *item, CONTEXT_BUTTON button); void GetViewChannelItems(CFileItemList &items); void GetViewNowItems(CFileItemList &items); diff --git a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp index aafc79bddf..e3e17b55cd 100644 --- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp @@ -132,9 +132,7 @@ void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 12021); /* Start from beginning */ std::string resumeString = GetResumeString(*pItem); if (!resumeString.empty()) - { buttons.Add(CONTEXT_BUTTON_RESUME_ITEM, resumeString); - } } else { diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp index 7011a2e0f1..c0966ec9d4 100644 --- a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp @@ -50,23 +50,20 @@ void CGUIWindowPVRSearch::GetContextButtons(int itemNumber, CContextButtons &but if (pItem->HasEPGInfoTag()) { - if (pItem->GetEPGInfoTag()->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) + buttons.Add(CONTEXT_BUTTON_INFO, 19047); /* Programme information */ + + if (pItem->GetEPGInfoTag()->HasTimer()) { - if (!pItem->GetEPGInfoTag()->HasTimer()) - { - buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */ - buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */ - } - else - { - if (pItem->GetEPGInfoTag()->StartAsLocalTime() < CDateTime::GetCurrentDateTime()) - buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */ - else if (pItem->GetEPGInfoTag()->Timer()->HasTimerType()) - { - if (!pItem->GetEPGInfoTag()->Timer()->GetTimerType()->IsReadOnly()) - buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19060); /* Delete timer */ - } - } + if (pItem->GetEPGInfoTag()->Timer()->IsRecording()) + buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */ + else if (pItem->GetEPGInfoTag()->Timer()->HasTimerType() && + !pItem->GetEPGInfoTag()->Timer()->GetTimerType()->IsReadOnly()) + buttons.Add(CONTEXT_BUTTON_DELETE_TIMER, 19060); /* Delete timer */ + } + else if (pItem->GetEPGInfoTag()->EndAsLocalTime() > CDateTime::GetCurrentDateTime()) + { + buttons.Add(CONTEXT_BUTTON_START_RECORD, 264); /* Record */ + buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */ } if (pItem->GetEPGInfoTag()->HasRecording()) buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 19687); /* Play recording */ @@ -97,8 +94,9 @@ bool CGUIWindowPVRSearch::OnContextButton(int itemNumber, CONTEXT_BUTTON button) return OnContextButtonClear(pItem.get(), button) || OnContextButtonInfo(pItem.get(), button) || - OnContextButtonStopRecord(pItem.get(), button) || OnContextButtonStartRecord(pItem.get(), button) || + OnContextButtonStopRecord(pItem.get(), button) || + OnContextButtonDeleteTimer(pItem.get(), button) || OnContextButtonPlay(pItem.get(), button) || CGUIWindowPVRBase::OnContextButton(itemNumber, button); } @@ -300,6 +298,19 @@ bool CGUIWindowPVRSearch::OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUT return bReturn; } +bool CGUIWindowPVRSearch::OnContextButtonDeleteTimer(CFileItem *item, CONTEXT_BUTTON button) +{ + bool bReturn = false; + + if (button == CONTEXT_BUTTON_DELETE_TIMER) + { + DeleteTimer(item); + bReturn = true; + } + + return bReturn; +} + void CGUIWindowPVRSearch::OpenDialogSearch() { CGUIDialogPVRGuideSearch* dlgSearch = (CGUIDialogPVRGuideSearch*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GUIDE_SEARCH); diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.h b/xbmc/pvr/windows/GUIWindowPVRSearch.h index ea41549803..a7bd311c52 100644 --- a/xbmc/pvr/windows/GUIWindowPVRSearch.h +++ b/xbmc/pvr/windows/GUIWindowPVRSearch.h @@ -45,6 +45,7 @@ namespace PVR bool OnContextButtonPlay(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonStartRecord(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button); + bool OnContextButtonDeleteTimer(CFileItem *item, CONTEXT_BUTTON button); void OpenDialogSearch(); diff --git a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp index fdf78a3f7d..800b54a406 100644 --- a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp +++ b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp @@ -90,7 +90,11 @@ void CGUIWindowPVRTimers::GetContextButtons(int itemNumber, CContextButtons &but if (!pItem->GetPVRTimerInfoTag()->GetTimerType()->IsReadOnly()) { - buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete */ + if (pItem->GetPVRTimerInfoTag()->IsRecording()) + buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */ + else + buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete */ + buttons.Add(CONTEXT_BUTTON_EDIT, 21450); /* Edit */ // As epg-based timers will get it's title from the epg tag, they should not be renamable. @@ -132,6 +136,7 @@ bool CGUIWindowPVRTimers::OnContextButton(int itemNumber, CONTEXT_BUTTON button) return OnContextButtonActivate(pItem.get(), button) || OnContextButtonAdd(pItem.get(), button) || OnContextButtonDelete(pItem.get(), button) || + OnContextButtonStopRecord(pItem.get(), button) || OnContextButtonEdit(pItem.get(), button) || OnContextButtonRename(pItem.get(), button) || OnContextButtonInfo(pItem.get(), button) || @@ -279,14 +284,21 @@ bool CGUIWindowPVRTimers::OnContextButtonDelete(CFileItem *item, CONTEXT_BUTTON if (button == CONTEXT_BUTTON_DELETE) { + DeleteTimer(item); bReturn = true; + } - if (!item->HasPVRTimerInfoTag()) - return bReturn; + return bReturn; +} + +bool CGUIWindowPVRTimers::OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button) +{ + bool bReturn = false; - bool bDeleteSchedule(false); - if (ConfirmDeleteTimer(item, bDeleteSchedule)) - CPVRTimers::DeleteTimer(*item, false, bDeleteSchedule); + if (button == CONTEXT_BUTTON_STOP_RECORD) + { + StopRecordFile(item); + bReturn = true; } return bReturn; @@ -343,17 +355,7 @@ bool CGUIWindowPVRTimers::OnContextButtonInfo(CFileItem *item, CONTEXT_BUTTON bu bool CGUIWindowPVRTimers::ActionDeleteTimer(CFileItem *item) { - /* check if the timer tag is valid */ - CPVRTimerInfoTagPtr timerTag = item->GetPVRTimerInfoTag(); - if (!timerTag || (timerTag->m_iClientIndex == PVR_TIMER_NO_CLIENT_INDEX)) - return false; - - bool bDeleteSchedule(false); - if (!ConfirmDeleteTimer(item, bDeleteSchedule)) - return false; - - /* delete the timer */ - bool bReturn = CPVRTimers::DeleteTimer(*item, false, bDeleteSchedule); + bool bReturn = DeleteTimer(item); if (bReturn && (m_vecItems->GetObjectCount() == 0)) { diff --git a/xbmc/pvr/windows/GUIWindowPVRTimers.h b/xbmc/pvr/windows/GUIWindowPVRTimers.h index 9480edab59..f3c237af78 100644 --- a/xbmc/pvr/windows/GUIWindowPVRTimers.h +++ b/xbmc/pvr/windows/GUIWindowPVRTimers.h @@ -55,6 +55,7 @@ namespace PVR bool OnContextButtonActivate(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonAdd(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonDelete(CFileItem *item, CONTEXT_BUTTON button); + bool OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonEdit(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonRename(CFileItem *item, CONTEXT_BUTTON button); bool OnContextButtonInfo(CFileItem *item, CONTEXT_BUTTON button); |