aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2015-11-09 07:55:18 +0100
committerKai Sommerfeld <kai.sommerfeld@gmx.com>2015-11-09 07:55:18 +0100
commit02fa942e40bc6ecfb0a9151c67c353b11cd1bee5 (patch)
tree271db7119aaa54534729bc744733489ff90b10c1
parent4dfcba93c2dad14d134e307a4d5ff79ff1972094 (diff)
parenta721f8bfd58905ea51cd5ffc66aaa2fccb5a9653 (diff)
Merge pull request #8360 from ksooo/pvr-context-menu-cleanup-4
-rw-r--r--addons/resource.language.en_gb/resources/strings.po14
-rw-r--r--xbmc/dialogs/GUIDialogContextMenu.h4
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.cpp73
-rw-r--r--xbmc/pvr/dialogs/GUIDialogPVRGuideInfo.h2
-rw-r--r--xbmc/pvr/timers/PVRTimers.cpp3
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRBase.cpp128
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRBase.h39
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRChannels.cpp38
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRChannels.h3
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.cpp51
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRGuide.h1
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRRecordings.cpp13
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRSearch.cpp57
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRSearch.h1
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRTimers.cpp36
-rw-r--r--xbmc/pvr/windows/GUIWindowPVRTimers.h1
16 files changed, 278 insertions, 186 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 88b34a51fc..2ce98af6ba 100644
--- a/xbmc/dialogs/GUIDialogContextMenu.h
+++ b/xbmc/dialogs/GUIDialogContextMenu.h
@@ -105,8 +105,9 @@ enum CONTEXT_BUTTON { CONTEXT_BUTTON_CANCELLED = 0,
CONTEXT_BUTTON_ADD,
CONTEXT_BUTTON_ACTIVATE,
CONTEXT_BUTTON_START_RECORD,
- CONTEXT_BUTTON_ADVANCED_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/timers/PVRTimers.cpp b/xbmc/pvr/timers/PVRTimers.cpp
index a2714d3f32..96be273987 100644
--- a/xbmc/pvr/timers/PVRTimers.cpp
+++ b/xbmc/pvr/timers/PVRTimers.cpp
@@ -446,6 +446,9 @@ bool CPVRTimers::GetSubDirectory(const CPVRTimersPath &path, CFileItemList &item
(timer->m_iParentClientIndex == iParentId))
{
item.reset(new CFileItem(timer));
+ std::string strItemPath(
+ CPVRTimersPath(path.GetPath(), timer->m_iClientId, timer->m_iClientIndex).GetPath());
+ item->SetPath(strItemPath);
items.Add(item);
}
}
diff --git a/xbmc/pvr/windows/GUIWindowPVRBase.cpp b/xbmc/pvr/windows/GUIWindowPVRBase.cpp
index c082484263..6c905f0f28 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;
- const CEpgInfoTagPtr tag = item->GetEPGInfoTag();
+ CEpgInfoTagPtr epgNow(channel->GetEPGNow());
+ if (!epgNow)
+ return false;
+
+ epgTag.reset(new CFileItem(epgNow));
+ }
+
+ const CEpgInfoTagPtr tag = epgTag->GetEPGInfoTag();
CPVRChannelPtr channel = tag->ChannelTag();
if (!channel || !g_PVRManager.CheckParentalLock(channel))
@@ -497,23 +514,56 @@ 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 (timer->GetPVRTimerInfoTag()->HasTimerType() &&
+ timer->GetPVRTimerInfoTag()->GetTimerType()->IsReadOnly())
+ return false;
+ 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;
}
@@ -692,6 +742,18 @@ bool CGUIWindowPVRBase::ActionInputChannelNumber(int input)
return false;
}
+bool CGUIWindowPVRBase::ActionToggleTimer(CFileItem *item)
+{
+ if (!item->HasEPGInfoTag())
+ return false;
+
+ CPVRTimerInfoTagPtr timer(item->GetEPGInfoTag()->Timer());
+ if (timer)
+ return DeleteTimer(item, timer->IsRecording());
+ else
+ return AddTimer(item, false);
+}
+
bool CGUIWindowPVRBase::ActionPlayChannel(CFileItem *item)
{
return PlayFile(item, CSettings::GetInstance().GetBool(CSettings::SETTING_PVRPLAYBACK_PLAYMINIMIZED));
@@ -756,39 +818,6 @@ bool CGUIWindowPVRBase::ActionDeleteChannel(CFileItem *item)
return true;
}
-bool CGUIWindowPVRBase::ActionRecord(CFileItem *item)
-{
- bool bReturn = false;
-
- CEpgInfoTagPtr epgTag(item->GetEPGInfoTag());
- if (!epgTag)
- return bReturn;
-
- CPVRChannelPtr channel = epgTag->ChannelTag();
- if (!channel || !g_PVRManager.CheckParentalLock(channel))
- return bReturn;
-
- if (epgTag->Timer() == NULL)
- {
- CPVRTimerInfoTagPtr newTimer = CPVRTimerInfoTag::CreateFromEpg(epgTag);
- if (newTimer)
- {
- bReturn = g_PVRTimers->AddTimer(newTimer);
- }
- else
- {
- bReturn = false;
- }
- }
- else
- {
- CGUIDialogOK::ShowAndGetInput(CVariant{19033}, CVariant{19034});
- bReturn = true;
- }
-
- return bReturn;
-}
-
bool CGUIWindowPVRBase::UpdateEpgForChannel(CFileItem *item)
{
CPVRChannelPtr channel(item->GetPVRChannelInfoTag());
@@ -847,3 +876,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..0807568497 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);
@@ -94,7 +88,7 @@ namespace PVR
virtual CPVRChannelGroupPtr GetGroup(void);
virtual void SetGroup(CPVRChannelGroupPtr group);
- virtual bool ActionRecord(CFileItem *item);
+ virtual bool ActionToggleTimer(CFileItem *item);
virtual bool ActionPlayChannel(CFileItem *item);
virtual bool ActionPlayEpg(CFileItem *item, bool bPlayRecording);
virtual bool ActionDeleteChannel(CFileItem *item);
@@ -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..c64c10ed36 100644
--- a/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRChannels.cpp
@@ -77,16 +77,19 @@ void CGUIWindowPVRChannels::GetContextButtons(int itemNumber, CContextButtons &b
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
CPVRChannelPtr channel(pItem->GetPVRChannelInfoTag());
- if (ActiveAE::CActiveAEDSP::GetInstance().IsProcessing())
- buttons.Add(CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS, 15047); /* Audio DSP settings */
-
if (channel->GetEPGNow())
{
buttons.Add(CONTEXT_BUTTON_INFO, 19047); /* Programme information */
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 (ActiveAE::CActiveAEDSP::GetInstance().IsProcessing())
+ buttons.Add(CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS, 15047); /* Audio DSP settings */
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;
+ }
- if (channel)
- return g_PVRManager.ToggleRecordingOnChannel(channel->ChannelID());
+ return bReturn;
+}
+
+bool CGUIWindowPVRChannels::OnContextButtonStopRecord(CFileItem *item, CONTEXT_BUTTON button)
+{
+ bool bReturn = false;
+
+ 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 440e688acf..5da9d0c4e4 100644
--- a/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRGuide.cpp
@@ -83,27 +83,25 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
buttons.Add(CONTEXT_BUTTON_PLAY_ITEM, 19000); /* Switch channel */
+ buttons.Add(CONTEXT_BUTTON_INFO, 19047); /* Programme information */
+ buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar */
- 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_ADVANCED_RECORD, 19061); /* Add timer */
+ buttons.Add(CONTEXT_BUTTON_ADD_TIMER, 19061); /* Add timer */
}
- buttons.Add(CONTEXT_BUTTON_INFO, 19047); /* Programme information */
- buttons.Add(CONTEXT_BUTTON_FIND, 19003); /* Find similar */
+ if (pItem->GetEPGInfoTag()->HasRecording())
+ buttons.Add(CONTEXT_BUTTON_PLAY_OTHER, 19687); /* Play recording */
if (m_viewControl.GetCurrentControl() == GUIDE_VIEW_TIMELINE)
{
@@ -112,8 +110,7 @@ void CGUIWindowPVRGuide::GetContextButtons(int itemNumber, CContextButtons &butt
buttons.Add(CONTEXT_BUTTON_END, 19064); /* Go to end */
}
- if (pItem->HasEPGInfoTag() &&
- pItem->GetEPGInfoTag()->HasPVRChannel() &&
+ if (pItem->GetEPGInfoTag()->HasPVRChannel() &&
g_PVRClients->HasMenuHooks(pItem->GetEPGInfoTag()->ChannelTag()->ClientID(), PVR_MENUHOOK_EPG))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
@@ -223,7 +220,7 @@ bool CGUIWindowPVRGuide::OnMessage(CGUIMessage& message)
bReturn = true;
break;
case EPG_SELECT_ACTION_RECORD:
- ActionRecord(pItem.get());
+ ActionToggleTimer(pItem.get());
bReturn = true;
break;
}
@@ -237,7 +234,7 @@ bool CGUIWindowPVRGuide::OnMessage(CGUIMessage& message)
bReturn = true;
break;
case ACTION_RECORD:
- ActionRecord(pItem.get());
+ ActionToggleTimer(pItem.get());
bReturn = true;
break;
case ACTION_CONTEXT_MENU:
@@ -334,6 +331,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) ||
@@ -512,9 +510,9 @@ bool CGUIWindowPVRGuide::OnContextButtonStartRecord(CFileItem *item, CONTEXT_BUT
bool bReturn = false;
if ((button == CONTEXT_BUTTON_START_RECORD) ||
- (button == CONTEXT_BUTTON_ADVANCED_RECORD))
+ (button == CONTEXT_BUTTON_ADD_TIMER))
{
- AddTimer(item, button == CONTEXT_BUTTON_ADVANCED_RECORD);
+ AddTimer(item, button == CONTEXT_BUTTON_ADD_TIMER);
bReturn = true;
}
@@ -533,3 +531,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..6ffe173ba7 100644
--- a/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
@@ -118,9 +118,6 @@ void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons
bool isDeletedRecording = false;
- if (ActiveAE::CActiveAEDSP::GetInstance().IsProcessing())
- buttons.Add(CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS, 15047); /* Audio DSP settings */
-
if (pItem->HasPVRRecordingInfoTag())
{
isDeletedRecording = pItem->GetPVRRecordingInfoTag()->IsDeleted();
@@ -132,9 +129,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
{
@@ -165,11 +160,13 @@ void CGUIWindowPVRRecordings::GetContextButtons(int itemNumber, CContextButtons
buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete */
}
+ if (ActiveAE::CActiveAEDSP::GetInstance().IsProcessing())
+ buttons.Add(CONTEXT_BUTTON_ACTIVE_ADSP_SETTINGS, 15047); /* Audio DSP settings */
+
if (pItem->HasPVRRecordingInfoTag())
{
- if (!isDeletedRecording && g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING))
- buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
- else if (isDeletedRecording && g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_DELETED_RECORDING))
+ if ((!isDeletedRecording && g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_RECORDING)) ||
+ (isDeletedRecording && g_PVRClients->HasMenuHooks(pItem->GetPVRRecordingInfoTag()->m_iClientId, PVR_MENUHOOK_DELETED_RECORDING)))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
}
diff --git a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp
index 8becc708aa..c8fb104bea 100644
--- a/xbmc/pvr/windows/GUIWindowPVRSearch.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRSearch.cpp
@@ -48,37 +48,34 @@ void CGUIWindowPVRSearch::GetContextButtons(int itemNumber, CContextButtons &but
return;
CFileItemPtr pItem = m_vecItems->Get(itemNumber);
+ buttons.Add(CONTEXT_BUTTON_CLEAR, 19232); /* Clear search results */
+
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_ADVANCED_RECORD, 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 */
- buttons.Add(CONTEXT_BUTTON_INFO, 19047); /* Programme information */
if (pItem->GetEPGInfoTag()->HasPVRChannel() &&
g_PVRClients->HasMenuHooks(pItem->GetEPGInfoTag()->ChannelTag()->ClientID(), PVR_MENUHOOK_EPG))
buttons.Add(CONTEXT_BUTTON_MENU_HOOKS, 19195); /* PVR client specific action */
}
- buttons.Add(CONTEXT_BUTTON_CLEAR, 19232); /* Clear search results */
-
CGUIWindowPVRBase::GetContextButtons(itemNumber, buttons);
CContextMenuManager::GetInstance().AddVisibleItems(pItem, buttons);
}
@@ -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);
}
@@ -219,7 +217,7 @@ bool CGUIWindowPVRSearch::OnMessage(CGUIMessage &message)
return true;
case ACTION_RECORD:
- ActionRecord(pItem.get());
+ ActionToggleTimer(pItem.get());
return true;
}
}
@@ -278,9 +276,9 @@ bool CGUIWindowPVRSearch::OnContextButtonStartRecord(CFileItem *item, CONTEXT_BU
bool bReturn = false;
if ((button == CONTEXT_BUTTON_START_RECORD) ||
- (button == CONTEXT_BUTTON_ADVANCED_RECORD))
+ (button == CONTEXT_BUTTON_ADD_TIMER))
{
- AddTimer(item, button == CONTEXT_BUTTON_ADVANCED_RECORD);
+ AddTimer(item, button == CONTEXT_BUTTON_ADD_TIMER);
bReturn = true;
}
@@ -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 f264f7d4de..9f6467ea2d 100644
--- a/xbmc/pvr/windows/GUIWindowPVRTimers.cpp
+++ b/xbmc/pvr/windows/GUIWindowPVRTimers.cpp
@@ -90,12 +90,16 @@ void CGUIWindowPVRTimers::GetContextButtons(int itemNumber, CContextButtons &but
if (!pItem->GetPVRTimerInfoTag()->GetTimerType()->IsReadOnly())
{
- 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.
if (pItem->GetPVRTimerInfoTag()->IsManual())
buttons.Add(CONTEXT_BUTTON_RENAME, 118); /* Rename */
+
+ if (pItem->GetPVRTimerInfoTag()->IsRecording())
+ buttons.Add(CONTEXT_BUTTON_STOP_RECORD, 19059); /* Stop recording */
+ else
+ buttons.Add(CONTEXT_BUTTON_DELETE, 117); /* Delete */
}
}
@@ -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 f474a18720..e6dbd8a22c 100644
--- a/xbmc/pvr/windows/GUIWindowPVRTimers.h
+++ b/xbmc/pvr/windows/GUIWindowPVRTimers.h
@@ -54,6 +54,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);