diff options
author | Kai Sommerfeld <kai.sommerfeld@gmx.com> | 2017-11-30 22:58:24 +0100 |
---|---|---|
committer | Rainer Hochecker <fernetmenta@online.de> | 2017-12-01 08:28:11 +0100 |
commit | 5293aa9f829f39ca25601ccd6f0fceb29ca7bf59 (patch) | |
tree | c3ec55d09345967bb12f99a2e960e4dd40b72b87 | |
parent | 71eb8052709e50aa91547c1d143a0161849a4519 (diff) |
[PVR][guiinfo][builtins][estuary][estouchy] Move recording control and info functionality from player to PVR.
-rw-r--r-- | addons/skin.estouchy/xml/IncludesPlayerControls.xml | 4 | ||||
-rw-r--r-- | addons/skin.estuary/xml/DialogSeekBar.xml | 2 | ||||
-rw-r--r-- | addons/skin.estuary/xml/Variables.xml | 2 | ||||
-rw-r--r-- | addons/skin.estuary/xml/VideoOSD.xml | 6 | ||||
-rw-r--r-- | xbmc/GUIInfoManager.cpp | 14 | ||||
-rw-r--r-- | xbmc/guiinfo/GUIInfoLabels.h | 4 | ||||
-rw-r--r-- | xbmc/interfaces/builtins/PVRBuiltins.cpp | 20 | ||||
-rw-r--r-- | xbmc/music/windows/GUIWindowMusicBase.cpp | 1 | ||||
-rw-r--r-- | xbmc/pvr/PVRActionListener.cpp | 6 | ||||
-rw-r--r-- | xbmc/pvr/PVRGUIActions.cpp | 9 | ||||
-rw-r--r-- | xbmc/pvr/PVRGUIActions.h | 6 | ||||
-rw-r--r-- | xbmc/pvr/PVRGUIInfo.cpp | 10 | ||||
-rw-r--r-- | xbmc/pvr/PVRGUIInfo.h | 3 | ||||
-rw-r--r-- | xbmc/pvr/PVRJobs.cpp | 5 | ||||
-rw-r--r-- | xbmc/pvr/PVRJobs.h | 14 | ||||
-rw-r--r-- | xbmc/pvr/PVRManager.cpp | 6 | ||||
-rw-r--r-- | xbmc/pvr/PVRManager.h | 6 | ||||
-rw-r--r-- | xbmc/pvr/addons/PVRClients.cpp | 2 | ||||
-rw-r--r-- | xbmc/pvr/addons/PVRClients.h | 6 |
19 files changed, 78 insertions, 48 deletions
diff --git a/addons/skin.estouchy/xml/IncludesPlayerControls.xml b/addons/skin.estouchy/xml/IncludesPlayerControls.xml index 8cbac2c4ec..981f86ace7 100644 --- a/addons/skin.estouchy/xml/IncludesPlayerControls.xml +++ b/addons/skin.estouchy/xml/IncludesPlayerControls.xml @@ -341,8 +341,8 @@ <alttexturefocus colordiffuse="red">osd_record.png</alttexturefocus> <alttexturenofocus colordiffuse="red">osd_record.png</alttexturenofocus> <usealttexture>Player.Record</usealttexture> - <onclick>PlayerControl(Record)</onclick> - <visible>Player.CanRecord</visible> + <onclick>PVR.ToggleRecordPlayingChannel</onclick> + <visible>PVR.CanRecordPlayingChannel</visible> </control> </control> </control> diff --git a/addons/skin.estuary/xml/DialogSeekBar.xml b/addons/skin.estuary/xml/DialogSeekBar.xml index 82bcca2ca2..eb73196051 100644 --- a/addons/skin.estuary/xml/DialogSeekBar.xml +++ b/addons/skin.estuary/xml/DialogSeekBar.xml @@ -50,7 +50,7 @@ <visible>player.chaptercount</visible> </control> <control type="group"> - <visible>Player.Recording + !Player.ChannelPreviewActive</visible> + <visible>PVR.IsRecordingPlayingChannel + !Player.ChannelPreviewActive</visible> <control type="image"> <top>100</top> <left>20</left> diff --git a/addons/skin.estuary/xml/Variables.xml b/addons/skin.estuary/xml/Variables.xml index c2a8f67b6e..2847b8fabc 100644 --- a/addons/skin.estuary/xml/Variables.xml +++ b/addons/skin.estuary/xml/Variables.xml @@ -213,7 +213,7 @@ <value condition="Control.HasFocus(70041)">$LOCALIZE[19069]</value> <value condition="Control.HasFocus(70043)">$LOCALIZE[5]</value> <value condition="Control.HasFocus(255)">$LOCALIZE[36501]</value> - <value condition="Control.HasFocus(606)+ Player.Recording">$LOCALIZE[19059]</value> + <value condition="Control.HasFocus(606)+ PVR.IsRecordingPlayingChannel">$LOCALIZE[19059]</value> <value condition="Control.HasFocus(606)">$LOCALIZE[264]</value> <value condition="ControlGroup(6000).HasFocus + Player.SeekEnabled">$LOCALIZE[31054]</value> </variable> diff --git a/addons/skin.estuary/xml/VideoOSD.xml b/addons/skin.estuary/xml/VideoOSD.xml index 938070efc5..51d2c4c9b6 100644 --- a/addons/skin.estuary/xml/VideoOSD.xml +++ b/addons/skin.estuary/xml/VideoOSD.xml @@ -105,9 +105,9 @@ <texturenofocus /> <radioposx>1</radioposx> <radioposy>0</radioposy> - <selected>!Player.Recording</selected> - <onclick>PlayerControl(Record)</onclick> - <visible>Player.CanRecord</visible> + <selected>!PVR.IsRecordingPlayingChannel</selected> + <onclick>PVR.ToggleRecordPlayingChannel</onclick> + <visible>PVR.CanRecordPlayingChannel</visible> <visible>VideoPlayer.Content(livetv)</visible> </control> </control> diff --git a/xbmc/GUIInfoManager.cpp b/xbmc/GUIInfoManager.cpp index 4c50e7f858..606cf44e9a 100644 --- a/xbmc/GUIInfoManager.cpp +++ b/xbmc/GUIInfoManager.cpp @@ -4595,6 +4595,16 @@ const infomap playlist[] = {{ "length", PLAYLIST_LENGTH }, /// _string_, /// Returns the currently entered channel number while in numeric channel input mode, an empty string otherwise /// } +/// \table_row3{ <b>`Pvr.CanRecordPlayingChannel`</b>, +/// \anchor Pvr_CanRecordPlayingChannel +/// _boolean_, +/// Returns true if PVR is currently playing a channel and if this channel can be recorded. +/// } +/// \table_row3{ <b>`Pvr.IsRecordingPlayingChannel`</b>, +/// \anchor Pvr_IsRecordingPlayingChannel +/// _boolean_, +/// Returns true if PVR is currently playing a channel and if this channel is currently recorded. +/// } /// \table_end /// /// ----------------------------------------------------------------------------- @@ -4680,7 +4690,9 @@ const infomap pvr[] = {{ "isrecording", PVR_IS_RECORDING { "isrecordingradio", PVR_IS_RECORDING_RADIO }, { "hasradiotimer", PVR_HAS_RADIO_TIMER }, { "hasnonrecordingradiotimer", PVR_HAS_NONRECORDING_RADIO_TIMER }, - { "channelnumberinput", PVR_CHANNEL_NUMBER_INPUT }}; + { "channelnumberinput", PVR_CHANNEL_NUMBER_INPUT }, + { "canrecordplayingchannel", PVR_CAN_RECORD_PLAYING_CHANNEL }, + { "isrecordingplayingchannel", PVR_IS_RECORDING_PLAYING_CHANNEL }}; /// \page modules__General__List_of_gui_access /// \section modules__General__List_of_gui_access_ADSP ADSP diff --git a/xbmc/guiinfo/GUIInfoLabels.h b/xbmc/guiinfo/GUIInfoLabels.h index e13077bae1..e7088a1700 100644 --- a/xbmc/guiinfo/GUIInfoLabels.h +++ b/xbmc/guiinfo/GUIInfoLabels.h @@ -464,7 +464,9 @@ #define PVR_HAS_RADIO_TIMER (PVR_CONDITIONS_START + 14) #define PVR_HAS_NONRECORDING_RADIO_TIMER (PVR_CONDITIONS_START + 15) #define PVR_IS_PLAYING_EPGTAG (PVR_CONDITIONS_START + 16) -#define PVR_CONDITIONS_END PVR_IS_PLAYING_EPGTAG +#define PVR_CAN_RECORD_PLAYING_CHANNEL (PVR_CONDITIONS_START + 17) +#define PVR_IS_RECORDING_PLAYING_CHANNEL (PVR_CONDITIONS_START + 18) +#define PVR_CONDITIONS_END PVR_IS_RECORDING_PLAYING_CHANNEL #define PVR_STRINGS_START 1200 #define PVR_NEXT_RECORDING_CHANNEL (PVR_STRINGS_START) diff --git a/xbmc/interfaces/builtins/PVRBuiltins.cpp b/xbmc/interfaces/builtins/PVRBuiltins.cpp index d24e765ad8..4f037a05a1 100644 --- a/xbmc/interfaces/builtins/PVRBuiltins.cpp +++ b/xbmc/interfaces/builtins/PVRBuiltins.cpp @@ -21,9 +21,9 @@ #include "PVRBuiltins.h" #include "Application.h" -#include "pvr/PVRManager.h" #include "ServiceBroker.h" - +#include "pvr/PVRGUIActions.h" +#include "pvr/PVRManager.h" /*! \brief Search for missing channel icons * \param params (ignored) @@ -31,7 +31,15 @@ static int SearchMissingIcons(const std::vector<std::string>& params) { CServiceBroker::GetPVRManager().TriggerSearchMissingChannelIcons(); + return 0; +} +/*! \brief will toggle recording of playing channel, if any. + * \param params (ignored) + */ +static int ToggleRecordPlayingChannel(const std::vector<std::string>& params) +{ + CServiceBroker::GetPVRManager().GUIActions()->ToggleRecordingOnPlayingChannel(); return 0; } @@ -51,12 +59,18 @@ static int SearchMissingIcons(const std::vector<std::string>& params) /// , /// Will start a search for missing channel icons /// } +/// \table_row2_l{ +/// <b>`PVR.ToggleRecordPlayingChannel`</b> +/// , +/// Will toggle recording on playing channel, if any +/// } /// \table_end /// CBuiltins::CommandMap CPVRBuiltins::GetOperations() const { return { - {"pvr.searchmissingchannelicons", {"Search for missing channel icons", 0, SearchMissingIcons}} + {"pvr.searchmissingchannelicons", {"Search for missing channel icons", 0, SearchMissingIcons}}, + {"pvr.togglerecordplayingchannel", {"Toggle recording on playing channel", 0, ToggleRecordPlayingChannel}}, }; } diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index d880a4bf4f..436df07401 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -89,7 +89,6 @@ using KODI::MESSAGING::HELPERS::DialogResponse; #define CONTROL_BTNSORTASC 4 #define CONTROL_BTNPLAYLISTS 7 #define CONTROL_BTNSCAN 9 -#define CONTROL_BTNREC 10 #define CONTROL_BTNRIP 11 CGUIWindowMusicBase::CGUIWindowMusicBase(int id, const std::string &xmlFile) diff --git a/xbmc/pvr/PVRActionListener.cpp b/xbmc/pvr/PVRActionListener.cpp index 3b79d365ef..1ba15da1f7 100644 --- a/xbmc/pvr/PVRActionListener.cpp +++ b/xbmc/pvr/PVRActionListener.cpp @@ -194,6 +194,12 @@ bool CPVRActionListener::OnAction(const CAction &action) CServiceBroker::GetPVRManager().GUIActions()->SwitchToChannel(item, false); return true; } + + case ACTION_RECORD: + { + CServiceBroker::GetPVRManager().GUIActions()->ToggleRecordingOnPlayingChannel(); + return true; + } } return false; } diff --git a/xbmc/pvr/PVRGUIActions.cpp b/xbmc/pvr/PVRGUIActions.cpp index 7de5c17fd7..565532b1ae 100644 --- a/xbmc/pvr/PVRGUIActions.cpp +++ b/xbmc/pvr/PVRGUIActions.cpp @@ -476,6 +476,15 @@ namespace PVR } // unnamed namespace + bool CPVRGUIActions::ToggleRecordingOnPlayingChannel() + { + const CPVRChannelPtr channel = CServiceBroker::GetPVRManager().GetCurrentChannel(); + if (channel && channel->CanRecord()) + return SetRecordingOnChannel(channel, !channel->IsRecording()); + + return false; + } + bool CPVRGUIActions::SetRecordingOnChannel(const CPVRChannelPtr &channel, bool bOnOff) { bool bReturn = false; diff --git a/xbmc/pvr/PVRGUIActions.h b/xbmc/pvr/PVRGUIActions.h index c3c54aab2f..c491b85ffb 100644 --- a/xbmc/pvr/PVRGUIActions.h +++ b/xbmc/pvr/PVRGUIActions.h @@ -174,6 +174,12 @@ namespace PVR bool ShowRecordingInfo(const CFileItemPtr &item) const; /*! + * @brief Toggle recording on the currently playing channel, if any. + * @return True if the recording was started or stopped successfully, false otherwise. + */ + bool ToggleRecordingOnPlayingChannel(); + + /*! * @brief Start or stop recording on a given channel. * @param channel the channel to start/stop recording. * @param bOnOff True to start recording, false to stop. diff --git a/xbmc/pvr/PVRGUIInfo.cpp b/xbmc/pvr/PVRGUIInfo.cpp index 270da4864d..1829ae1241 100644 --- a/xbmc/pvr/PVRGUIInfo.cpp +++ b/xbmc/pvr/PVRGUIInfo.cpp @@ -219,6 +219,8 @@ void CPVRGUIInfo::UpdateMisc(void) bool bIsPlayingEncryptedStream = bStarted && CServiceBroker::GetPVRManager().Clients()->IsPlayingEncryptedChannel(); bool bHasTVChannels = bStarted && CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAllTV()->HasChannels(); bool bHasRadioChannels = bStarted && CServiceBroker::GetPVRManager().ChannelGroups()->GetGroupAllRadio()->HasChannels(); + bool bCanRecordPlayingChannel = bStarted && CServiceBroker::GetPVRManager().Clients()->CanRecordOnPlayingChannel(); + bool bIsRecordingPlayingChannel = bStarted && CServiceBroker::GetPVRManager().Clients()->IsRecordingOnPlayingChannel(); std::string strPlayingTVGroup = (bStarted && bIsPlayingTV) ? CServiceBroker::GetPVRManager().GetPlayingGroup(false)->GroupName() : ""; CSingleLock lock(m_critSection); @@ -233,6 +235,8 @@ void CPVRGUIInfo::UpdateMisc(void) m_bHasTVChannels = bHasTVChannels; m_bHasRadioChannels = bHasRadioChannels; m_strPlayingTVGroup = strPlayingTVGroup; + m_bCanRecordPlayingChannel = bCanRecordPlayingChannel; + m_bIsRecordingPlayingChannel = bIsRecordingPlayingChannel; } void CPVRGUIInfo::UpdateTimeshift(void) @@ -490,6 +494,12 @@ bool CPVRGUIInfo::TranslateBoolInfo(DWORD dwInfo) const case PVR_IS_TIMESHIFTING: bReturn = m_bIsTimeshifting; break; + case PVR_CAN_RECORD_PLAYING_CHANNEL: + bReturn = m_bCanRecordPlayingChannel; + break; + case PVR_IS_RECORDING_PLAYING_CHANNEL: + bReturn = m_bIsRecordingPlayingChannel; + break; default: break; } diff --git a/xbmc/pvr/PVRGUIInfo.h b/xbmc/pvr/PVRGUIInfo.h index b640c404c3..7721b3e56b 100644 --- a/xbmc/pvr/PVRGUIInfo.h +++ b/xbmc/pvr/PVRGUIInfo.h @@ -248,7 +248,10 @@ namespace PVR bool m_bIsPlayingEncryptedStream; bool m_bHasTVChannels; bool m_bHasRadioChannels; + bool m_bCanRecordPlayingChannel; + bool m_bIsRecordingPlayingChannel; std::string m_strPlayingTVGroup; + //@} PVR_SIGNAL_STATUS m_qualityInfo; /*!< stream quality information */ diff --git a/xbmc/pvr/PVRJobs.cpp b/xbmc/pvr/PVRJobs.cpp index 6d01113952..3f02ddf1da 100644 --- a/xbmc/pvr/PVRJobs.cpp +++ b/xbmc/pvr/PVRJobs.cpp @@ -40,11 +40,6 @@ namespace PVR { -bool CPVRSetRecordingOnChannelJob::DoWork() -{ - return CServiceBroker::GetPVRManager().GUIActions()->SetRecordingOnChannel(m_channel, m_bOnOff); -} - CPVRChannelEntryTimeoutJob::CPVRChannelEntryTimeoutJob(int iTimeout) { m_delayTimer.Set(iTimeout); diff --git a/xbmc/pvr/PVRJobs.h b/xbmc/pvr/PVRJobs.h index 756e78dfce..432ce22881 100644 --- a/xbmc/pvr/PVRJobs.h +++ b/xbmc/pvr/PVRJobs.h @@ -30,20 +30,6 @@ namespace PVR { - class CPVRSetRecordingOnChannelJob : public CJob - { - public: - CPVRSetRecordingOnChannelJob(const CPVRChannelPtr &channel, bool bOnOff) - : m_channel(channel), m_bOnOff(bOnOff) {} - ~CPVRSetRecordingOnChannelJob() override = default; - const char *GetType() const override { return "pvr-set-recording-on-channel"; } - - bool DoWork() override; - private: - CPVRChannelPtr m_channel; - bool m_bOnOff; - }; - class CPVRPlayChannelOnStartupJob : public CJob { public: diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp index 8d56ad4331..b3b5dbd681 100644 --- a/xbmc/pvr/PVRManager.cpp +++ b/xbmc/pvr/PVRManager.cpp @@ -661,12 +661,6 @@ void CPVRManager::ResetPlayingTag(void) m_guiInfo->ResetPlayingTag(); } -void CPVRManager::StartRecordingOnPlayingChannel(bool bOnOff) -{ - // can be called from VideoPlayer thread. SetRecordingOnChannel can open a dialog. Thus, execute async. - CJobManager::GetInstance().AddJob(new CPVRSetRecordingOnChannelJob(m_addons->GetPlayingChannel(), bOnOff), NULL); -} - void CPVRManager::RestartParentalTimer() { if (m_parentalTimer) diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h index 8241e16898..8b46d0ec37 100644 --- a/xbmc/pvr/PVRManager.h +++ b/xbmc/pvr/PVRManager.h @@ -320,12 +320,6 @@ namespace PVR bool OpenRecordedStream(const CPVRRecordingPtr &tag); /*! - * @brief Start or stop recording on the channel that is currently being played. - * @param bOnOff True to start recording, false to stop. - */ - void StartRecordingOnPlayingChannel(bool bOnOff); - - /*! * @brief Check whether there are active recordings. * @return True if there are active recordings, false otherwise. */ diff --git a/xbmc/pvr/addons/PVRClients.cpp b/xbmc/pvr/addons/PVRClients.cpp index a7fd5965c7..a81d5215bb 100644 --- a/xbmc/pvr/addons/PVRClients.cpp +++ b/xbmc/pvr/addons/PVRClients.cpp @@ -667,7 +667,7 @@ bool CPVRClients::IsRecordingOnPlayingChannel(void) const return currentChannel && currentChannel->IsRecording(); } -bool CPVRClients::CanRecordInstantly(void) +bool CPVRClients::CanRecordOnPlayingChannel(void) { CPVRChannelPtr currentChannel(GetPlayingChannel()); return currentChannel && currentChannel->CanRecord(); diff --git a/xbmc/pvr/addons/PVRClients.h b/xbmc/pvr/addons/PVRClients.h index 89c06d1004..764f55caf4 100644 --- a/xbmc/pvr/addons/PVRClients.h +++ b/xbmc/pvr/addons/PVRClients.h @@ -296,10 +296,10 @@ namespace PVR bool IsRecordingOnPlayingChannel(void) const; /*! - * @brief Check whether the currently playing channel can be recorded instantly. - * @return True if there is a playing channel that can be recorded instantly, false otherwise. + * @brief Check whether the currently playing channel can be recorded. + * @return True if there is a playing channel that can be recorded, false otherwise. */ - bool CanRecordInstantly(void); + bool CanRecordOnPlayingChannel(void); /*! * @brief Set the epg tag that is currently playing. |