[Windows] Fix driver version detection of AMD RDNA+ GPU on Windows 10
[xbmc.git] / xbmc / pvr / dialogs / GUIDialogPVRChannelGuide.cpp
blob563aa126cd1f744c8e9026d07f8f3a044b1c585d
1 /*
2 * Copyright (C) 2012-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
9 #include "GUIDialogPVRChannelGuide.h"
11 #include "FileItem.h"
12 #include "FileItemList.h"
13 #include "ServiceBroker.h"
14 #include "pvr/PVRManager.h"
15 #include "pvr/PVRPlaybackState.h"
16 #include "pvr/channels/PVRChannel.h"
17 #include "pvr/epg/EpgInfoTag.h"
19 #include <memory>
20 #include <vector>
22 using namespace PVR;
24 CGUIDialogPVRChannelGuide::CGUIDialogPVRChannelGuide()
25 : CGUIDialogPVRItemsViewBase(WINDOW_DIALOG_PVR_CHANNEL_GUIDE, "DialogPVRChannelGuide.xml")
29 void CGUIDialogPVRChannelGuide::Open(const std::shared_ptr<const CPVRChannel>& channel)
31 m_channel = channel;
32 CGUIDialogPVRItemsViewBase::Open();
35 void CGUIDialogPVRChannelGuide::OnInitWindow()
37 // no user-specific channel is set; use current playing channel
38 if (!m_channel)
39 m_channel = CServiceBroker::GetPVRManager().PlaybackState()->GetPlayingChannel();
41 if (!m_channel)
43 Close();
44 return;
47 Init();
49 const std::vector<std::shared_ptr<CPVREpgInfoTag>> tags = m_channel->GetEpgTags();
50 for (const auto& tag : tags)
52 m_vecItems->Add(std::make_shared<CFileItem>(tag));
55 m_viewControl.SetItems(*m_vecItems);
57 CGUIDialogPVRItemsViewBase::OnInitWindow();
59 // select the active entry
60 unsigned int iSelectedItem = 0;
61 for (int iEpgPtr = 0; iEpgPtr < m_vecItems->Size(); ++iEpgPtr)
63 const CFileItemPtr entry = m_vecItems->Get(iEpgPtr);
64 if (entry->HasEPGInfoTag() && entry->GetEPGInfoTag()->IsActive())
66 iSelectedItem = iEpgPtr;
67 break;
70 m_viewControl.SetSelectedItem(iSelectedItem);
73 void CGUIDialogPVRChannelGuide::OnDeinitWindow(int nextWindowID)
75 CGUIDialogPVRItemsViewBase::OnDeinitWindow(nextWindowID);
76 m_channel.reset();