Skip to content

Commit

Permalink
[PVR] CGUIWindowPVRRecordingsBase: Add support for default play actio…
Browse files Browse the repository at this point in the history
…n setting.
  • Loading branch information
ksooo committed Oct 4, 2023
1 parent 2fa5ac2 commit e44db7f
Showing 1 changed file with 42 additions and 11 deletions.
53 changes: 42 additions & 11 deletions xbmc/pvr/windows/GUIWindowPVRRecordings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "utils/URIUtils.h"
#include "video/VideoLibraryQueue.h"
#include "video/VideoUtils.h"
#include "video/guilib/VideoPlayActionProcessor.h"
#include "video/guilib/VideoSelectActionProcessor.h"
#include "video/windows/GUIWindowVideoBase.h"

Expand Down Expand Up @@ -275,6 +276,45 @@ class CVideoSelectActionProcessor : public VIDEO::GUILIB::CVideoSelectActionProc
CGUIWindowPVRRecordingsBase& m_window;
const int m_itemIndex{-1};
};

class CVideoPlayActionProcessor : public CVideoPlayActionProcessorBase
{
public:
explicit CVideoPlayActionProcessor(CFileItem& item) : CVideoPlayActionProcessorBase(item) {}

protected:
bool OnResumeSelected() override
{
if (m_item.m_bIsFolder)
{
m_item.SetStartOffset(STARTOFFSET_RESUME);
CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecordingFolder(
m_item, false /* no resume check */);
}
else
{
CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().ResumePlayRecording(
m_item, true /* fall back to play if no resume possible */);
}
return true;
}

bool OnPlaySelected() override
{
if (m_item.m_bIsFolder)
{
m_item.SetStartOffset(0);
CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecordingFolder(
m_item, false /* no resume check */);
}
else
{
CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecording(
m_item, false /* no resume check */);
}
return true;
}
};
} // namespace

bool CGUIWindowPVRRecordingsBase::OnMessage(CGUIMessage& message)
Expand Down Expand Up @@ -306,17 +346,8 @@ bool CGUIWindowPVRRecordingsBase::OnMessage(CGUIMessage& message)

if (!item->IsParentFolder() && message.GetParam1() == ACTION_PLAYER_PLAY)
{
if (item->m_bIsFolder)
{
CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecordingFolder(
*item, true /* check resume */);
}
else
{
CServiceBroker::GetPVRManager().Get<PVR::GUI::Playback>().PlayRecording(
*item, true /* check resume */);
}
bReturn = true;
CVideoPlayActionProcessor proc{*item};
bReturn = proc.Process();
}
else if (item->m_bIsFolder)
{
Expand Down

0 comments on commit e44db7f

Please sign in to comment.