From ea9481f502281e1b4e42d1af8914dd36db5f1cbb Mon Sep 17 00:00:00 2001 From: Kai Sommerfeld Date: Mon, 3 May 2021 20:04:59 +0200 Subject: [PATCH] [PVR] Channel Manager: Do not allow renumbering channels if backend channel numbers or backend channel order shall be used. --- xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp | 12 +++++++++++- xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp index 813676da44eb4..d6c54e43aec9c 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp @@ -163,6 +163,12 @@ void CGUIDialogPVRChannelManager::OnInitWindow() m_bMovingMode = false; m_bContainsChanges = false; m_bAllowNewChannel = false; + + // prevent resorting channels if backend channel numbers or backend channel order shall be used + const std::shared_ptr settings = CServiceBroker::GetSettingsComponent()->GetSettings(); + m_bAllowRenumber = !settings->GetBool(CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER) && + !settings->GetBool(CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS); + SetProperty("IsRadio", ""); Update(); @@ -594,7 +600,8 @@ bool CGUIDialogPVRChannelManager::OnPopupMenu(int iItem) if (!pItem) return false; - buttons.Add(CONTEXT_BUTTON_MOVE, 116); /* Move channel up or down */ + if (m_bAllowRenumber) + buttons.Add(CONTEXT_BUTTON_MOVE, 116); /* Move channel up or down */ if (pItem->GetProperty("SupportsSettings").asBoolean()) { @@ -846,6 +853,9 @@ void CGUIDialogPVRChannelManager::SetItemsUnchanged() void CGUIDialogPVRChannelManager::Renumber() { + if (!m_bAllowRenumber) + return; + int iNextChannelNumber(0); std::string strNumber; CFileItemPtr pItem; diff --git a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h index 1abe2dd9b4717..cead000c4f51f 100644 --- a/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h +++ b/xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h @@ -75,6 +75,7 @@ namespace PVR bool m_bMovingMode = false; bool m_bContainsChanges = false; bool m_bAllowNewChannel = false; + bool m_bAllowRenumber = false; std::shared_ptr m_initialSelection; int m_iSelected = 0;