Skip to content

Commit

Permalink
[PVR] Channel Manager: Do not allow renumbering channels if backend c…
Browse files Browse the repository at this point in the history
…hannel numbers or backend channel order shall be used.
  • Loading branch information
ksooo committed May 4, 2021
1 parent bd16fd1 commit ea9481f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
12 changes: 11 additions & 1 deletion xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<CSettings> settings = CServiceBroker::GetSettingsComponent()->GetSettings();
m_bAllowRenumber = !settings->GetBool(CSettings::SETTING_PVRMANAGER_BACKENDCHANNELORDER) &&
!settings->GetBool(CSettings::SETTING_PVRMANAGER_USEBACKENDCHANNELNUMBERS);

SetProperty("IsRadio", "");

Update();
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -846,6 +853,9 @@ void CGUIDialogPVRChannelManager::SetItemsUnchanged()

void CGUIDialogPVRChannelManager::Renumber()
{
if (!m_bAllowRenumber)
return;

int iNextChannelNumber(0);
std::string strNumber;
CFileItemPtr pItem;
Expand Down
1 change: 1 addition & 0 deletions xbmc/pvr/dialogs/GUIDialogPVRChannelManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<CFileItem> m_initialSelection;
int m_iSelected = 0;
Expand Down

0 comments on commit ea9481f

Please sign in to comment.