aboutsummaryrefslogtreecommitdiff
path: root/src/pvr/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'src/pvr/dialogs')
-rw-r--r--src/pvr/dialogs/GUIDialogPVRChannelManager.cpp831
-rw-r--r--src/pvr/dialogs/GUIDialogPVRChannelManager.h85
-rw-r--r--src/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp351
-rw-r--r--src/pvr/dialogs/GUIDialogPVRChannelsOSD.h67
-rw-r--r--src/pvr/dialogs/GUIDialogPVRCutterOSD.cpp33
-rw-r--r--src/pvr/dialogs/GUIDialogPVRCutterOSD.h32
-rw-r--r--src/pvr/dialogs/GUIDialogPVRDirectorOSD.cpp40
-rw-r--r--src/pvr/dialogs/GUIDialogPVRDirectorOSD.h32
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGroupManager.cpp384
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGroupManager.h74
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGuideInfo.cpp282
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGuideInfo.h57
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGuideOSD.cpp159
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGuideOSD.h50
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGuideSearch.cpp306
-rw-r--r--src/pvr/dialogs/GUIDialogPVRGuideSearch.h63
-rw-r--r--src/pvr/dialogs/GUIDialogPVRRecordingInfo.cpp59
-rw-r--r--src/pvr/dialogs/GUIDialogPVRRecordingInfo.h40
-rw-r--r--src/pvr/dialogs/GUIDialogPVRTimerSettings.cpp528
-rw-r--r--src/pvr/dialogs/GUIDialogPVRTimerSettings.h80
-rw-r--r--src/pvr/dialogs/Makefile15
21 files changed, 3568 insertions, 0 deletions
diff --git a/src/pvr/dialogs/GUIDialogPVRChannelManager.cpp b/src/pvr/dialogs/GUIDialogPVRChannelManager.cpp
new file mode 100644
index 0000000000..6631096e79
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRChannelManager.cpp
@@ -0,0 +1,831 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRChannelManager.h"
+
+#include "FileItem.h"
+#include "GUIDialogPVRGroupManager.h"
+#include "dialogs/GUIDialogFileBrowser.h"
+#include "guilib/GUIKeyboardFactory.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogProgress.h"
+#include "dialogs/GUIDialogSelect.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/GUIEditControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/Key.h"
+#include "guilib/LocalizeStrings.h"
+#include "profiles/ProfilesManager.h"
+#include "pvr/PVRManager.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include "pvr/addons/PVRClients.h"
+#include "settings/Settings.h"
+#include "storage/MediaManager.h"
+#include "utils/StringUtils.h"
+
+#define BUTTON_OK 4
+#define BUTTON_APPLY 5
+#define BUTTON_CANCEL 6
+#define RADIOBUTTON_ACTIVE 7
+#define EDIT_NAME 8
+#define BUTTON_CHANNEL_LOGO 9
+#define IMAGE_CHANNEL_LOGO 10
+#define RADIOBUTTON_USEEPG 12
+#define SPIN_EPGSOURCE_SELECTION 13
+#define RADIOBUTTON_PARENTAL_LOCK 14
+#define CONTROL_LIST_CHANNELS 20
+#define BUTTON_GROUP_MANAGER 30
+#define BUTTON_EDIT_CHANNEL 31
+#define BUTTON_DELETE_CHANNEL 32
+#define BUTTON_NEW_CHANNEL 33
+#define BUTTON_RADIO_TV 34
+
+using namespace PVR;
+
+CGUIDialogPVRChannelManager::CGUIDialogPVRChannelManager(void) :
+ CGUIDialog(WINDOW_DIALOG_PVR_CHANNEL_MANAGER, "DialogPVRChannelManager.xml"),
+ m_bIsRadio(false),
+ m_bMovingMode(false),
+ m_bContainsChanges(false),
+ m_iSelected(0),
+ m_channelItems(new CFileItemList)
+{
+}
+
+CGUIDialogPVRChannelManager::~CGUIDialogPVRChannelManager(void)
+{
+ delete m_channelItems;
+}
+
+bool CGUIDialogPVRChannelManager::OnActionMove(const CAction &action)
+{
+ bool bReturn(false);
+ int iActionId = action.GetID();
+ if (GetFocusedControlID() == CONTROL_LIST_CHANNELS &&
+ (iActionId == ACTION_MOVE_DOWN || iActionId == ACTION_MOVE_UP ||
+ iActionId == ACTION_PAGE_DOWN || iActionId == ACTION_PAGE_UP))
+ {
+ bReturn = true;
+ if (!m_bMovingMode)
+ {
+ CGUIDialog::OnAction(action);
+ int iSelected = m_viewControl.GetSelectedItem();
+ if (iSelected != m_iSelected)
+ {
+ m_iSelected = iSelected;
+ SetData(m_iSelected);
+ }
+ }
+ else
+ {
+ std::string strNumber;
+ CGUIDialog::OnAction(action);
+
+ bool bMoveUp = iActionId == ACTION_PAGE_UP || iActionId == ACTION_MOVE_UP;
+ unsigned int iLines = bMoveUp ? abs(m_iSelected - m_viewControl.GetSelectedItem()) : 1;
+ bool bOutOfBounds = bMoveUp ? m_iSelected <= 0 : m_iSelected >= m_channelItems->Size() - 1;
+ if (bOutOfBounds)
+ {
+ bMoveUp = !bMoveUp;
+ iLines = m_channelItems->Size() - 1;
+ }
+
+ for (unsigned int iLine = 0; iLine < iLines; iLine++)
+ {
+ unsigned int iNewSelect = bMoveUp ? m_iSelected - 1 : m_iSelected + 1;
+ if (m_channelItems->Get(iNewSelect)->GetProperty("Number").asString() != "-")
+ {
+ strNumber = StringUtils::Format("%i", m_iSelected+1);
+ m_channelItems->Get(iNewSelect)->SetProperty("Number", strNumber);
+ strNumber = StringUtils::Format("%i", iNewSelect+1);
+ m_channelItems->Get(m_iSelected)->SetProperty("Number", strNumber);
+ }
+ m_channelItems->Swap(iNewSelect, m_iSelected);
+ m_iSelected = iNewSelect;
+ }
+
+ m_viewControl.SetItems(*m_channelItems);
+ m_viewControl.SetSelectedItem(m_iSelected);
+ }
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRChannelManager::OnAction(const CAction& action)
+{
+ return OnActionMove(action) ||
+ CGUIDialog::OnAction(action);
+}
+
+void CGUIDialogPVRChannelManager::OnInitWindow()
+{
+ CGUIDialog::OnInitWindow();
+
+ m_iSelected = 0;
+ m_bIsRadio = false;
+ m_bMovingMode = false;
+ m_bContainsChanges = false;
+ SetProperty("IsRadio", "");
+ Update();
+ SetData(m_iSelected);
+}
+
+void CGUIDialogPVRChannelManager::OnDeinitWindow(int nextWindowID)
+{
+ Clear();
+
+ CGUIDialog::OnDeinitWindow(nextWindowID);
+}
+
+bool CGUIDialogPVRChannelManager::OnClickListChannels(CGUIMessage &message)
+{
+ if (!m_bMovingMode)
+ {
+ int iAction = message.GetParam1();
+ int iItem = m_viewControl.GetSelectedItem();
+
+ /* Check file item is in list range and get his pointer */
+ if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return true;
+
+ /* Process actions */
+ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_CONTEXT_MENU || iAction == ACTION_MOUSE_RIGHT_CLICK)
+ {
+ /* Show Contextmenu */
+ OnPopupMenu(iItem);
+
+ return true;
+ }
+ }
+ else
+ {
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (pItem)
+ {
+ pItem->SetProperty("Changed", true);
+ pItem->Select(false);
+ m_bMovingMode = false;
+ m_bContainsChanges = true;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonOK(CGUIMessage &message)
+{
+ SaveList();
+ Close();
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonApply(CGUIMessage &message)
+{
+ SaveList();
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonCancel(CGUIMessage &message)
+{
+ Close();
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonRadioTV(CGUIMessage &message)
+{
+ if (m_bContainsChanges)
+ {
+ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
+ if (!pDialog)
+ return true;
+
+ pDialog->SetHeading(20052);
+ pDialog->SetLine(0, "");
+ pDialog->SetLine(1, 19212);
+ pDialog->SetLine(2, 20103);
+ pDialog->DoModal();
+
+ if (pDialog->IsConfirmed())
+ SaveList();
+ }
+
+ m_iSelected = 0;
+ m_bMovingMode = false;
+ m_bContainsChanges = false;
+ m_bIsRadio = !m_bIsRadio;
+ SetProperty("IsRadio", m_bIsRadio ? "true" : "");
+ Update();
+ SetData(m_iSelected);
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonRadioActive(CGUIMessage &message)
+{
+ CGUIMessage msg(GUI_MSG_IS_SELECTED, GetID(), RADIOBUTTON_ACTIVE);
+ if (OnMessage(msg))
+ {
+ bool selected(msg.GetParam1() == 1);
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (pItem)
+ {
+ pItem->SetProperty("Changed", true);
+ pItem->SetProperty("ActiveChannel", selected);
+ m_bContainsChanges = true;
+ Renumber();
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonRadioParentalLocked(CGUIMessage &message)
+{
+ CGUIMessage msg(GUI_MSG_IS_SELECTED, GetID(), RADIOBUTTON_PARENTAL_LOCK);
+ if (!OnMessage(msg))
+ return false;
+
+ bool selected(msg.GetParam1() == 1);
+
+ // ask for PIN first
+ if (!g_PVRManager.CheckParentalPIN(g_localizeStrings.Get(19262).c_str()))
+ { // failed - reset to previou
+ SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_PARENTAL_LOCK, !selected);
+ return false;
+ }
+
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (pItem)
+ {
+ pItem->SetProperty("Changed", true);
+ pItem->SetProperty("ParentalLocked", selected);
+ m_bContainsChanges = true;
+ Renumber();
+ return true;
+ }
+
+ return false;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonEditName(CGUIMessage &message)
+{
+ CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), EDIT_NAME);
+ if (OnMessage(msg))
+ {
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (pItem)
+ {
+ pItem->SetProperty("Changed", true);
+ pItem->SetProperty("Name", msg.GetLabel());
+ m_bContainsChanges = true;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonChannelLogo(CGUIMessage &message)
+{
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (!pItem)
+ return false;
+ if (CProfilesManager::Get().GetCurrentProfile().canWriteSources() && !g_passwordManager.IsProfileLockUnlocked())
+ return false;
+
+ // setup our thumb list
+ CFileItemList items;
+
+ // add the current thumb, if available
+ if (!pItem->GetProperty("Icon").asString().empty())
+ {
+ CFileItemPtr current(new CFileItem("thumb://Current", false));
+ current->SetArt("thumb", pItem->GetPVRChannelInfoTag()->IconPath());
+ current->SetLabel(g_localizeStrings.Get(19282));
+ items.Add(current);
+ }
+ else if (pItem->HasArt("thumb"))
+ { // already have a thumb that the share doesn't know about - must be a local one, so we mayaswell reuse it.
+ CFileItemPtr current(new CFileItem("thumb://Current", false));
+ current->SetArt("thumb", pItem->GetArt("thumb"));
+ current->SetLabel(g_localizeStrings.Get(19282));
+ items.Add(current);
+ }
+
+ // and add a "no thumb" entry as well
+ CFileItemPtr nothumb(new CFileItem("thumb://None", false));
+ nothumb->SetIconImage(pItem->GetIconImage());
+ nothumb->SetLabel(g_localizeStrings.Get(19283));
+ items.Add(nothumb);
+
+ std::string strThumb;
+ VECSOURCES shares;
+ if (CSettings::Get().GetString("pvrmenu.iconpath") != "")
+ {
+ CMediaSource share1;
+ share1.strPath = CSettings::Get().GetString("pvrmenu.iconpath");
+ share1.strName = g_localizeStrings.Get(19066);
+ shares.push_back(share1);
+ }
+ g_mediaManager.GetLocalDrives(shares);
+ if (!CGUIDialogFileBrowser::ShowAndGetImage(items, shares, g_localizeStrings.Get(19285), strThumb, NULL, 19285))
+ return false;
+
+ if (strThumb == "thumb://Current")
+ return true;
+
+ if (strThumb == "thumb://None")
+ strThumb = "";
+
+ pItem->SetProperty("Icon", strThumb);
+ pItem->SetProperty("Changed", true);
+ pItem->SetProperty("UserSetIcon", true);
+ m_bContainsChanges = true;
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonUseEPG(CGUIMessage &message)
+{
+ CGUIMessage msg(GUI_MSG_IS_SELECTED, GetID(), RADIOBUTTON_USEEPG);
+ if (OnMessage(msg))
+ {
+ bool selected(msg.GetParam1() == 1);
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (pItem)
+ {
+ pItem->SetProperty("Changed", true);
+ pItem->SetProperty("UseEPG", selected);
+ m_bContainsChanges = true;
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickEPGSourceSpin(CGUIMessage &message)
+{
+ // TODO: Add EPG scraper support
+ return true;
+// CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(SPIN_EPGSOURCE_SELECTION);
+// if (pSpin)
+// {
+// CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+// if (pItem)
+// {
+// pItem->SetProperty("EPGSource", (int)0);
+// pItem->SetProperty("Changed", true);
+// m_bContainsChanges = true;
+// return true;
+// }
+// }
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonGroupManager(CGUIMessage &message)
+{
+ /* Load group manager dialog */
+ CGUIDialogPVRGroupManager* pDlgInfo = (CGUIDialogPVRGroupManager*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GROUP_MANAGER);
+ if (!pDlgInfo)
+ return false;
+
+ pDlgInfo->SetRadio(m_bIsRadio);
+
+ /* Open dialog window */
+ pDlgInfo->DoModal();
+
+ Update();
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonEditChannel(CGUIMessage &message)
+{
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (!pItem)
+ return false;
+
+ if (pItem->GetProperty("Virtual").asBoolean())
+ {
+ std::string strURL = pItem->GetProperty("StreamURL").asString();
+ if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
+ pItem->SetProperty("StreamURL", strURL);
+ return true;
+ }
+
+ CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonDeleteChannel(CGUIMessage &message)
+{
+ CFileItemPtr pItem = m_channelItems->Get(m_iSelected);
+ if (!pItem)
+ return false;
+
+ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
+ if (!pDialog)
+ return true;
+
+ pDialog->SetHeading(19211);
+ pDialog->SetLine(0, "");
+ pDialog->SetLine(1, 750);
+ pDialog->SetLine(2, "");
+ pDialog->DoModal();
+
+ if (pDialog->IsConfirmed())
+ {
+ if (pItem->GetProperty("Virtual").asBoolean())
+ {
+ pItem->GetPVRChannelInfoTag()->SetVirtual(true);
+ m_channelItems->Remove(m_iSelected);
+ m_viewControl.SetItems(*m_channelItems);
+ Renumber();
+ return true;
+ }
+ CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
+ }
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnClickButtonNewChannel(CGUIMessage &message)
+{
+ std::vector<long> clients;
+
+ CGUIDialogSelect* pDlgSelect = (CGUIDialogSelect*)g_windowManager.GetWindow(WINDOW_DIALOG_SELECT);
+ if (!pDlgSelect)
+ return false;
+
+ pDlgSelect->SetHeading(19213); // Select Client
+ pDlgSelect->Add(g_localizeStrings.Get(19209));
+ clients.push_back(PVR_VIRTUAL_CLIENT_ID);
+
+ PVR_CLIENTMAP clientMap;
+ if (g_PVRClients->GetConnectedClients(clientMap) > 0)
+ {
+ PVR_CLIENTMAP_ITR itr;
+ for (itr = clientMap.begin() ; itr != clientMap.end(); itr++)
+ {
+ clients.push_back((*itr).first);
+ pDlgSelect->Add((*itr).second->Name());
+ }
+ }
+ pDlgSelect->DoModal();
+
+ int selection = pDlgSelect->GetSelectedLabel();
+ if (selection >= 0 && selection <= (int) clients.size())
+ {
+ int clientID = clients[selection];
+ if (clientID == PVR_VIRTUAL_CLIENT_ID)
+ {
+ std::string strURL = "";
+ if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
+ {
+ if (!strURL.empty())
+ {
+ CPVRChannel *newchannel = new CPVRChannel(m_bIsRadio);
+ newchannel->SetChannelName(g_localizeStrings.Get(19204));
+ newchannel->SetEPGEnabled(false);
+ newchannel->SetVirtual(true);
+ newchannel->SetStreamURL(strURL);
+ newchannel->SetClientID(PVR_VIRTUAL_CLIENT_ID);
+ if (g_PVRChannelGroups->CreateChannel(*newchannel))
+ g_PVRChannelGroups->GetGroupAll(m_bIsRadio)->Persist();
+
+ CFileItemPtr channel(new CFileItem(*newchannel));
+ if (channel)
+ {
+ channel->SetProperty("ActiveChannel", true);
+ channel->SetProperty("Name", g_localizeStrings.Get(19204));
+ channel->SetProperty("UseEPG", false);
+ channel->SetProperty("Icon", newchannel->IconPath());
+ channel->SetProperty("EPGSource", (int)0);
+ channel->SetProperty("ClientName", g_localizeStrings.Get(19209));
+ channel->SetProperty("ParentalLocked", false);
+
+ m_channelItems->AddFront(channel, m_iSelected);
+ m_viewControl.SetItems(*m_channelItems);
+ Renumber();
+ }
+ }
+ }
+ }
+ else
+ {
+ CGUIDialogOK::ShowAndGetInput(19033,19038,0,0);
+ }
+ }
+ return true;
+}
+
+bool CGUIDialogPVRChannelManager::OnMessageClick(CGUIMessage &message)
+{
+ int iControl = message.GetSenderId();
+ switch(iControl)
+ {
+ case CONTROL_LIST_CHANNELS:
+ return OnClickListChannels(message);
+ case BUTTON_OK:
+ return OnClickButtonOK(message);
+ case BUTTON_APPLY:
+ return OnClickButtonApply(message);
+ case BUTTON_CANCEL:
+ return OnClickButtonCancel(message);
+ case BUTTON_RADIO_TV:
+ return OnClickButtonRadioTV(message);
+ case RADIOBUTTON_ACTIVE:
+ return OnClickButtonRadioActive(message);
+ case RADIOBUTTON_PARENTAL_LOCK:
+ return OnClickButtonRadioParentalLocked(message);
+ case EDIT_NAME:
+ return OnClickButtonEditName(message);
+ case BUTTON_CHANNEL_LOGO:
+ return OnClickButtonChannelLogo(message);
+ case RADIOBUTTON_USEEPG:
+ return OnClickButtonUseEPG(message);
+ case SPIN_EPGSOURCE_SELECTION:
+ return OnClickEPGSourceSpin(message);
+ case BUTTON_GROUP_MANAGER:
+ return OnClickButtonGroupManager(message);
+ case BUTTON_EDIT_CHANNEL:
+ return OnClickButtonEditChannel(message);
+ case BUTTON_DELETE_CHANNEL:
+ return OnClickButtonDeleteChannel(message);
+ case BUTTON_NEW_CHANNEL:
+ return OnClickButtonNewChannel(message);
+ default:
+ return false;
+ }
+}
+
+bool CGUIDialogPVRChannelManager::OnMessage(CGUIMessage& message)
+{
+ unsigned int iMessage = message.GetMessage();
+
+ switch (iMessage)
+ {
+ case GUI_MSG_CLICKED:
+ return OnMessageClick(message);
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogPVRChannelManager::OnWindowLoaded(void)
+{
+ CGUIDialog::OnWindowLoaded();
+
+ m_viewControl.Reset();
+ m_viewControl.SetParentWindow(GetID());
+ m_viewControl.AddView(GetControl(CONTROL_LIST_CHANNELS));
+}
+
+void CGUIDialogPVRChannelManager::OnWindowUnload(void)
+{
+ CGUIDialog::OnWindowUnload();
+ m_viewControl.Reset();
+}
+
+CFileItemPtr CGUIDialogPVRChannelManager::GetCurrentListItem(int offset)
+{
+ return m_channelItems->Get(m_iSelected);
+}
+
+bool CGUIDialogPVRChannelManager::OnPopupMenu(int iItem)
+{
+ // popup the context menu
+ // grab our context menu
+ CContextButtons buttons;
+
+ // mark the item
+ if (iItem >= 0 && iItem < m_channelItems->Size())
+ m_channelItems->Get(iItem)->Select(true);
+ else
+ return false;
+
+ CFileItemPtr pItem = m_channelItems->Get(iItem);
+ if (!pItem)
+ return false;
+
+ buttons.Add(CONTEXT_BUTTON_MOVE, 116); /* Move channel up or down */
+ if (pItem->GetProperty("Virtual").asBoolean())
+ buttons.Add(CONTEXT_BUTTON_EDIT_SOURCE, 1027); /* Edit virtual channel URL */
+
+ int choice = CGUIDialogContextMenu::ShowAndGetChoice(buttons);
+
+ // deselect our item
+ if (iItem >= 0 && iItem < m_channelItems->Size())
+ m_channelItems->Get(iItem)->Select(false);
+
+ if (choice < 0)
+ return false;
+
+ return OnContextButton(iItem, (CONTEXT_BUTTON)choice);
+}
+
+bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON button)
+{
+ /* Check file item is in list range and get his pointer */
+ if (itemNumber < 0 || itemNumber >= (int)m_channelItems->Size()) return false;
+
+ CFileItemPtr pItem = m_channelItems->Get(itemNumber);
+ if (!pItem)
+ return false;
+
+ if (button == CONTEXT_BUTTON_MOVE)
+ {
+ m_bMovingMode = true;
+ pItem->Select(true);
+ }
+ else if (button == CONTEXT_BUTTON_EDIT_SOURCE)
+ {
+ std::string strURL = pItem->GetProperty("StreamURL").asString();
+ if (CGUIKeyboardFactory::ShowAndGetInput(strURL, g_localizeStrings.Get(19214), false))
+ pItem->SetProperty("StreamURL", strURL);
+ }
+ return true;
+}
+
+void CGUIDialogPVRChannelManager::SetData(int iItem)
+{
+ /* Check file item is in list range and get his pointer */
+ if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return;
+
+ CFileItemPtr pItem = m_channelItems->Get(iItem);
+ if (!pItem)
+ return;
+
+ SET_CONTROL_LABEL2(EDIT_NAME, pItem->GetProperty("Name").asString());
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), EDIT_NAME, CGUIEditControl::INPUT_TYPE_TEXT, 19208);
+ OnMessage(msg);
+
+ SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_ACTIVE, pItem->GetProperty("ActiveChannel").asBoolean());
+ SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_USEEPG, pItem->GetProperty("UseEPG").asBoolean());
+ SET_CONTROL_SELECTED(GetID(), RADIOBUTTON_PARENTAL_LOCK, pItem->GetProperty("ParentalLocked").asBoolean());
+}
+
+void CGUIDialogPVRChannelManager::Update()
+{
+ // lock our display, as this window is rendered from the player thread
+ g_graphicsContext.Lock();
+ m_viewControl.SetCurrentView(CONTROL_LIST_CHANNELS);
+
+ // empty the lists ready for population
+ Clear();
+
+ CPVRChannelGroupPtr channels = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
+
+ // No channels available, nothing to do.
+ if(!channels)
+ return;
+
+ for (int iChannelPtr = 0; iChannelPtr < channels->Size(); iChannelPtr++)
+ {
+ CFileItemPtr channelFile = channels->GetByIndex(iChannelPtr);
+ if (!channelFile || !channelFile->HasPVRChannelInfoTag())
+ continue;
+ const CPVRChannel *channel = channelFile->GetPVRChannelInfoTag();
+
+ channelFile->SetProperty("ActiveChannel", !channel->IsHidden());
+ channelFile->SetProperty("Name", channel->ChannelName());
+ channelFile->SetProperty("UseEPG", channel->EPGEnabled());
+ channelFile->SetProperty("Icon", channel->IconPath());
+ channelFile->SetProperty("EPGSource", (int)0);
+ channelFile->SetProperty("ParentalLocked", channel->IsLocked());
+ channelFile->SetProperty("Number", StringUtils::Format("%i", channel->ChannelNumber()));
+
+ if (channel->IsVirtual())
+ {
+ channelFile->SetProperty("Virtual", true);
+ channelFile->SetProperty("StreamURL", channel->StreamURL());
+ }
+
+ std::string clientName;
+ if (channel->ClientID() == PVR_VIRTUAL_CLIENT_ID) /* XBMC internal */
+ clientName = g_localizeStrings.Get(19209);
+ else
+ g_PVRClients->GetClientName(channel->ClientID(), clientName);
+ channelFile->SetProperty("ClientName", clientName);
+
+ m_channelItems->Add(channelFile);
+ }
+
+ {
+ std::vector< std::pair<std::string, int> > labels;
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19210), 0));
+ /// TODO: Add Labels for EPG scrapers here
+ SET_CONTROL_LABELS(SPIN_EPGSOURCE_SELECTION, 0, &labels);
+ }
+
+ Renumber();
+ m_viewControl.SetItems(*m_channelItems);
+ m_viewControl.SetSelectedItem(m_iSelected);
+
+ g_graphicsContext.Unlock();
+}
+
+void CGUIDialogPVRChannelManager::Clear(void)
+{
+ m_viewControl.Clear();
+ m_channelItems->Clear();
+}
+
+bool CGUIDialogPVRChannelManager::PersistChannel(CFileItemPtr pItem, CPVRChannelGroupPtr group, unsigned int *iChannelNumber)
+{
+ if (!pItem || !pItem->HasPVRChannelInfoTag() || !group)
+ return false;
+
+ /* get values from the form */
+ bool bHidden = !pItem->GetProperty("ActiveChannel").asBoolean();
+ bool bVirtual = pItem->GetProperty("Virtual").asBoolean();
+ bool bEPGEnabled = pItem->GetProperty("UseEPG").asBoolean();
+ bool bParentalLocked = pItem->GetProperty("ParentalLocked").asBoolean();
+ int iEPGSource = (int)pItem->GetProperty("EPGSource").asInteger();
+ std::string strChannelName= pItem->GetProperty("Name").asString();
+ std::string strIconPath = pItem->GetProperty("Icon").asString();
+ std::string strStreamURL = pItem->GetProperty("StreamURL").asString();
+ bool bUserSetIcon = pItem->GetProperty("UserSetIcon").asBoolean();
+
+ return group->UpdateChannel(*pItem, bHidden, bVirtual, bEPGEnabled, bParentalLocked, iEPGSource, ++(*iChannelNumber), strChannelName, strIconPath, strStreamURL, bUserSetIcon);
+}
+
+void CGUIDialogPVRChannelManager::SaveList(void)
+{
+ if (!m_bContainsChanges)
+ return;
+
+ /* display the progress dialog */
+ CGUIDialogProgress* pDlgProgress = (CGUIDialogProgress*)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS);
+ pDlgProgress->SetHeading(190);
+ pDlgProgress->SetLine(0, "");
+ pDlgProgress->SetLine(1, 328);
+ pDlgProgress->SetLine(2, "");
+ pDlgProgress->StartModal();
+ pDlgProgress->Progress();
+ pDlgProgress->SetPercentage(0);
+
+ /* persist all channels */
+ unsigned int iNextChannelNumber(0);
+ CPVRChannelGroupPtr group = g_PVRChannelGroups->GetGroupAll(m_bIsRadio);
+ if (!group)
+ return;
+ for (int iListPtr = 0; iListPtr < m_channelItems->Size(); iListPtr++)
+ {
+ CFileItemPtr pItem = m_channelItems->Get(iListPtr);
+ PersistChannel(pItem, group, &iNextChannelNumber);
+
+ pDlgProgress->SetPercentage(iListPtr * 100 / m_channelItems->Size());
+ }
+
+ group->SortAndRenumber();
+ group->Persist();
+ m_bContainsChanges = false;
+ SetItemsUnchanged();
+ pDlgProgress->Close();
+}
+
+void CGUIDialogPVRChannelManager::SetItemsUnchanged(void)
+{
+ for (int iItemPtr = 0; iItemPtr < m_channelItems->Size(); iItemPtr++)
+ {
+ CFileItemPtr pItem = m_channelItems->Get(iItemPtr);
+ if (pItem)
+ pItem->SetProperty("Changed", false);
+ }
+}
+
+void CGUIDialogPVRChannelManager::Renumber(void)
+{
+ int iNextChannelNumber(0);
+ std::string strNumber;
+ CFileItemPtr pItem;
+ for (int iChannelPtr = 0; iChannelPtr < m_channelItems->Size(); iChannelPtr++)
+ {
+ pItem = m_channelItems->Get(iChannelPtr);
+ if (pItem->GetProperty("ActiveChannel").asBoolean())
+ {
+ strNumber = StringUtils::Format("%i", ++iNextChannelNumber);
+ pItem->SetProperty("Number", strNumber);
+ }
+ else
+ pItem->SetProperty("Number", "-");
+ }
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRChannelManager.h b/src/pvr/dialogs/GUIDialogPVRChannelManager.h
new file mode 100644
index 0000000000..faef829f3c
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRChannelManager.h
@@ -0,0 +1,85 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+#include "dialogs/GUIDialogContextMenu.h"
+#include "view/GUIViewControl.h"
+#include "../channels/PVRChannelGroup.h"
+
+namespace PVR
+{
+ class CGUIDialogPVRChannelManager : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRChannelManager(void);
+ virtual ~CGUIDialogPVRChannelManager(void);
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual bool OnAction(const CAction& action);
+ virtual void OnWindowLoaded(void);
+ virtual void OnWindowUnload(void);
+ virtual bool HasListItems() const { return true; };
+ virtual CFileItemPtr GetCurrentListItem(int offset = 0);
+
+ protected:
+ virtual void OnInitWindow();
+ virtual void OnDeinitWindow(int nextWindowID);
+
+ virtual bool OnPopupMenu(int iItem);
+ virtual bool OnContextButton(int itemNumber, CONTEXT_BUTTON button);
+
+ virtual bool OnActionMove(const CAction &action);
+
+ virtual bool OnMessageClick(CGUIMessage &message);
+
+ virtual bool OnClickListChannels(CGUIMessage &message);
+ virtual bool OnClickButtonOK(CGUIMessage &message);
+ virtual bool OnClickButtonApply(CGUIMessage &message);
+ virtual bool OnClickButtonCancel(CGUIMessage &message);
+ virtual bool OnClickButtonRadioTV(CGUIMessage &message);
+ virtual bool OnClickButtonRadioActive(CGUIMessage &message);
+ virtual bool OnClickButtonRadioParentalLocked(CGUIMessage &message);
+ virtual bool OnClickButtonEditName(CGUIMessage &message);
+ virtual bool OnClickButtonChannelLogo(CGUIMessage &message);
+ virtual bool OnClickButtonUseEPG(CGUIMessage &message);
+ virtual bool OnClickEPGSourceSpin(CGUIMessage &message);
+ virtual bool OnClickButtonGroupManager(CGUIMessage &message);
+ virtual bool OnClickButtonEditChannel(CGUIMessage &message);
+ virtual bool OnClickButtonDeleteChannel(CGUIMessage &message);
+ virtual bool OnClickButtonNewChannel(CGUIMessage &message);
+
+ virtual bool PersistChannel(CFileItemPtr pItem, CPVRChannelGroupPtr group, unsigned int *iChannelNumber);
+ virtual void SetItemsUnchanged(void);
+
+ private:
+ void Clear(void);
+ void Update(void);
+ void SaveList(void);
+ void Renumber(void);
+ void SetData(int iItem);
+ bool m_bIsRadio;
+ bool m_bMovingMode;
+ bool m_bContainsChanges;
+
+ int m_iSelected;
+ CFileItemList* m_channelItems;
+ CGUIViewControl m_viewControl;
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp b/src/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
new file mode 100644
index 0000000000..5fb5c7917e
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRChannelsOSD.cpp
@@ -0,0 +1,351 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRChannelsOSD.h"
+#include "Application.h"
+#include "ApplicationMessenger.h"
+#include "FileItem.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/Key.h"
+#include "guilib/LocalizeStrings.h"
+#include "dialogs/GUIDialogKaiToast.h"
+#include "dialogs/GUIDialogOK.h"
+#include "GUIDialogPVRGuideInfo.h"
+#include "view/ViewState.h"
+#include "settings/Settings.h"
+#include "GUIInfoManager.h"
+#include "cores/IPlayer.h"
+#include "utils/StringUtils.h"
+
+#include "pvr/PVRManager.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include "epg/Epg.h"
+#include "pvr/timers/PVRTimerInfoTag.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include "pvr/windows/GUIWindowPVRBase.h"
+
+using namespace PVR;
+using namespace EPG;
+
+#define CONTROL_LIST 11
+
+CGUIDialogPVRChannelsOSD::CGUIDialogPVRChannelsOSD() :
+ CGUIDialog(WINDOW_DIALOG_PVR_OSD_CHANNELS, "DialogPVRChannelsOSD.xml"),
+ Observer()
+{
+ m_vecItems = new CFileItemList;
+}
+
+CGUIDialogPVRChannelsOSD::~CGUIDialogPVRChannelsOSD()
+{
+ delete m_vecItems;
+
+ if (IsObserving(g_infoManager))
+ g_infoManager.UnregisterObserver(this);
+}
+
+bool CGUIDialogPVRChannelsOSD::OnMessage(CGUIMessage& message)
+{
+ switch (message.GetMessage())
+ {
+ case GUI_MSG_CLICKED:
+ {
+ int iControl = message.GetSenderId();
+
+ if (m_viewControl.HasControl(iControl)) // list/thumb control
+ {
+ int iItem = m_viewControl.GetSelectedItem();
+ int iAction = message.GetParam1();
+
+ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
+ {
+ /* Switch to channel */
+ GotoChannel(iItem);
+ return true;
+ }
+ else if (iAction == ACTION_SHOW_INFO || iAction == ACTION_MOUSE_RIGHT_CLICK)
+ {
+ /* Show information Dialog */
+ ShowInfo(iItem);
+ return true;
+ }
+ }
+ }
+ break;
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogPVRChannelsOSD::OnInitWindow()
+{
+ /* Close dialog immediately if neither a TV nor a radio channel is playing */
+ if (!g_PVRManager.IsPlayingTV() && !g_PVRManager.IsPlayingRadio())
+ {
+ Close();
+ return;
+ }
+
+ Update();
+
+ CGUIDialog::OnInitWindow();
+}
+
+void CGUIDialogPVRChannelsOSD::OnDeinitWindow(int nextWindowID)
+{
+ if (m_group)
+ {
+ if (m_group != GetPlayingGroup())
+ {
+ CGUIWindowPVRBase::SetSelectedItemPath(g_PVRManager.IsPlayingRadio(), GetLastSelectedItemPath(m_group->GroupID()));
+ g_PVRManager.SetPlayingGroup(m_group);
+ }
+ else
+ {
+ CGUIWindowPVRBase::SetSelectedItemPath(g_PVRManager.IsPlayingRadio(), m_viewControl.GetSelectedItemPath());
+ }
+
+ m_group.reset();
+ }
+
+ CGUIDialog::OnDeinitWindow(nextWindowID);
+
+ Clear();
+}
+
+bool CGUIDialogPVRChannelsOSD::OnAction(const CAction &action)
+{
+ switch (action.GetID())
+ {
+ case ACTION_PREVIOUS_CHANNELGROUP:
+ case ACTION_NEXT_CHANNELGROUP:
+ {
+ // save control states and currently selected item of group
+ SaveControlStates();
+
+ // switch to next or previous group
+ CPVRChannelGroupPtr group = GetPlayingGroup();
+ CPVRChannelGroupPtr nextGroup = action.GetID() == ACTION_NEXT_CHANNELGROUP ? group->GetNextGroup() : group->GetPreviousGroup();
+ g_PVRManager.SetPlayingGroup(nextGroup);
+ Update();
+
+ // restore control states and previously selected item of group
+ RestoreControlStates();
+ return true;
+ }
+ }
+
+ return CGUIDialog::OnAction(action);
+}
+
+CPVRChannelGroupPtr CGUIDialogPVRChannelsOSD::GetPlayingGroup()
+{
+ CPVRChannelPtr channel;
+ if (g_PVRManager.GetCurrentChannel(channel))
+ return g_PVRManager.GetPlayingGroup(channel->IsRadio());
+ else
+ return CPVRChannelGroupPtr();
+}
+
+void CGUIDialogPVRChannelsOSD::Update()
+{
+ // lock our display, as this window is rendered from the player thread
+ g_graphicsContext.Lock();
+
+ if (!IsObserving(g_infoManager))
+ g_infoManager.RegisterObserver(this);
+
+ m_viewControl.SetCurrentView(DEFAULT_VIEW_LIST);
+
+ // empty the list ready for population
+ Clear();
+
+ CPVRChannelPtr channel;
+ if (g_PVRManager.GetCurrentChannel(channel))
+ {
+ CPVRChannelGroupPtr group = g_PVRManager.GetPlayingGroup(channel->IsRadio());
+ if (group)
+ {
+ group->GetMembers(*m_vecItems);
+ m_viewControl.SetItems(*m_vecItems);
+
+ if (!m_group)
+ {
+ m_group = group;
+ m_viewControl.SetSelectedItem(CGUIWindowPVRBase::GetSelectedItemPath(channel->IsRadio()));
+ SaveSelectedItemPath(group->GroupID());
+ }
+ }
+ }
+
+ g_graphicsContext.Unlock();
+}
+
+void CGUIDialogPVRChannelsOSD::SaveControlStates()
+{
+ CGUIDialog::SaveControlStates();
+
+ CPVRChannelGroupPtr group = GetPlayingGroup();
+ if (group)
+ SaveSelectedItemPath(group->GroupID());
+}
+
+void CGUIDialogPVRChannelsOSD::RestoreControlStates()
+{
+ CGUIDialog::RestoreControlStates();
+
+ CPVRChannelGroupPtr group = GetPlayingGroup();
+ if (group)
+ {
+ std::string path = GetLastSelectedItemPath(group->GroupID());
+ if (!path.empty())
+ m_viewControl.SetSelectedItem(path);
+ else
+ m_viewControl.SetSelectedItem(0);
+ }
+}
+
+void CGUIDialogPVRChannelsOSD::Clear()
+{
+ m_viewControl.Clear();
+ m_vecItems->Clear();
+}
+
+void CGUIDialogPVRChannelsOSD::CloseOrSelect(unsigned int iItem)
+{
+ if (CSettings::Get().GetBool("pvrmenu.closechannelosdonswitch"))
+ {
+ if (CSettings::Get().GetInt("pvrmenu.displaychannelinfo") > 0)
+ g_PVRManager.ShowPlayerInfo(CSettings::Get().GetInt("pvrmenu.displaychannelinfo"));
+ Close();
+ }
+ else
+ m_viewControl.SetSelectedItem(iItem);
+}
+
+void CGUIDialogPVRChannelsOSD::GotoChannel(int item)
+{
+ /* Check file item is in list range and get his pointer */
+ if (item < 0 || item >= (int)m_vecItems->Size()) return;
+ CFileItemPtr pItem = m_vecItems->Get(item);
+
+ if (pItem->GetPath() == g_application.CurrentFile())
+ {
+ CloseOrSelect(item);
+ return;
+ }
+
+ if (g_PVRManager.IsPlaying() && pItem->HasPVRChannelInfoTag() && g_application.m_pPlayer->HasPlayer())
+ {
+ CPVRChannel *channel = pItem->GetPVRChannelInfoTag();
+ if (!g_PVRManager.CheckParentalLock(*channel) ||
+ !g_application.m_pPlayer->SwitchChannel(*channel))
+ {
+ std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), channel->ChannelName().c_str()); // CHANNELNAME could not be played. Check the log for details.
+ CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Error,
+ g_localizeStrings.Get(19166), // PVR information
+ msg);
+ return;
+ }
+ }
+ else
+ CApplicationMessenger::Get().PlayFile(*pItem);
+
+ m_group = GetPlayingGroup();
+
+ CloseOrSelect(item);
+}
+
+void CGUIDialogPVRChannelsOSD::ShowInfo(int item)
+{
+ /* Check file item is in list range and get his pointer */
+ if (item < 0 || item >= (int)m_vecItems->Size()) return;
+
+ CFileItemPtr pItem = m_vecItems->Get(item);
+ if (pItem && pItem->IsPVRChannel())
+ {
+ CPVRChannel *channel = pItem->GetPVRChannelInfoTag();
+ if (!g_PVRManager.CheckParentalLock(*channel))
+ return;
+
+ /* Get the current running show on this channel from the EPG storage */
+ CEpgInfoTag epgnow;
+ if (!channel->GetEPGNow(epgnow))
+ return;
+
+ /* Load programme info dialog */
+ CGUIDialogPVRGuideInfo* pDlgInfo = (CGUIDialogPVRGuideInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GUIDE_INFO);
+ if (!pDlgInfo)
+ return;
+
+ /* inform dialog about the file item and open dialog window */
+ CFileItem *itemNow = new CFileItem(epgnow);
+ pDlgInfo->SetProgInfo(itemNow);
+ pDlgInfo->DoModal();
+ delete itemNow; /* delete previuosly created FileItem */
+ }
+
+ return;
+}
+
+void CGUIDialogPVRChannelsOSD::OnWindowLoaded()
+{
+ CGUIDialog::OnWindowLoaded();
+ m_viewControl.Reset();
+ m_viewControl.SetParentWindow(GetID());
+ m_viewControl.AddView(GetControl(CONTROL_LIST));
+}
+
+void CGUIDialogPVRChannelsOSD::OnWindowUnload()
+{
+ CGUIDialog::OnWindowUnload();
+ m_viewControl.Reset();
+}
+
+CGUIControl *CGUIDialogPVRChannelsOSD::GetFirstFocusableControl(int id)
+{
+ if (m_viewControl.HasControl(id))
+ id = m_viewControl.GetCurrentControl();
+
+ return CGUIWindow::GetFirstFocusableControl(id);
+}
+
+void CGUIDialogPVRChannelsOSD::Notify(const Observable &obs, const ObservableMessage msg)
+{
+ if (msg == ObservableMessageCurrentItem)
+ {
+ g_graphicsContext.Lock();
+ m_viewControl.SetItems(*m_vecItems);
+ g_graphicsContext.Unlock();
+ }
+}
+
+void CGUIDialogPVRChannelsOSD::SaveSelectedItemPath(int iGroupID)
+{
+ m_groupSelectedItemPaths[iGroupID] = m_viewControl.GetSelectedItemPath();
+}
+
+std::string CGUIDialogPVRChannelsOSD::GetLastSelectedItemPath(int iGroupID) const
+{
+ std::map<int, std::string>::const_iterator it = m_groupSelectedItemPaths.find(iGroupID);
+ if (it != m_groupSelectedItemPaths.end())
+ return it->second;
+ return "";
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRChannelsOSD.h b/src/pvr/dialogs/GUIDialogPVRChannelsOSD.h
new file mode 100644
index 0000000000..f19c1341f8
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRChannelsOSD.h
@@ -0,0 +1,67 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+#include "view/GUIViewControl.h"
+#include "utils/Observer.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include <map>
+
+class CFileItemList;
+
+namespace PVR
+{
+ class CGUIDialogPVRChannelsOSD : public CGUIDialog, public Observer
+ {
+ public:
+ CGUIDialogPVRChannelsOSD(void);
+ virtual ~CGUIDialogPVRChannelsOSD(void);
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual bool OnAction(const CAction &action);
+ virtual void OnWindowLoaded();
+ virtual void OnWindowUnload();
+ virtual void Notify(const Observable &obs, const ObservableMessage msg);
+
+ protected:
+ virtual void OnInitWindow();
+ virtual void OnDeinitWindow(int nextWindowID);
+ virtual void RestoreControlStates();
+ virtual void SaveControlStates();
+
+ void CloseOrSelect(unsigned int iItem);
+ void GotoChannel(int iItem);
+ void ShowInfo(int item);
+ void Clear();
+ void Update();
+ CPVRChannelGroupPtr GetPlayingGroup();
+ CGUIControl *GetFirstFocusableControl(int id);
+
+ CFileItemList *m_vecItems;
+ CGUIViewControl m_viewControl;
+
+ private:
+ CPVRChannelGroupPtr m_group;
+ std::map<int, std::string> m_groupSelectedItemPaths;
+ void SaveSelectedItemPath(int iGroupID);
+ std::string GetLastSelectedItemPath(int iGroupID) const;
+ };
+}
+
diff --git a/src/pvr/dialogs/GUIDialogPVRCutterOSD.cpp b/src/pvr/dialogs/GUIDialogPVRCutterOSD.cpp
new file mode 100644
index 0000000000..8543ae2d54
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRCutterOSD.cpp
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRCutterOSD.h"
+#include "utils/log.h"
+
+using namespace PVR;
+
+CGUIDialogPVRCutterOSD::CGUIDialogPVRCutterOSD()
+ : CGUIDialog(WINDOW_DIALOG_PVR_OSD_CUTTER, "DialogPVRCutterOSD.xml")
+{
+}
+
+CGUIDialogPVRCutterOSD::~CGUIDialogPVRCutterOSD()
+{
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRCutterOSD.h b/src/pvr/dialogs/GUIDialogPVRCutterOSD.h
new file mode 100644
index 0000000000..32a25f84c6
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRCutterOSD.h
@@ -0,0 +1,32 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+
+namespace PVR
+{
+ class CGUIDialogPVRCutterOSD : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRCutterOSD(void);
+ virtual ~CGUIDialogPVRCutterOSD(void);
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRDirectorOSD.cpp b/src/pvr/dialogs/GUIDialogPVRDirectorOSD.cpp
new file mode 100644
index 0000000000..a5cbb7128b
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRDirectorOSD.cpp
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * DESCRIPTION:
+ *
+ * Used in Fullscreen view to control, multifeed channel groups.
+ *
+ */
+
+#include "GUIDialogPVRDirectorOSD.h"
+#include "utils/log.h"
+
+using namespace PVR;
+
+CGUIDialogPVRDirectorOSD::CGUIDialogPVRDirectorOSD()
+ : CGUIDialog(WINDOW_DIALOG_PVR_OSD_DIRECTOR, "DialogPVRDirectorOSD.xml")
+{
+}
+
+CGUIDialogPVRDirectorOSD::~CGUIDialogPVRDirectorOSD()
+{
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRDirectorOSD.h b/src/pvr/dialogs/GUIDialogPVRDirectorOSD.h
new file mode 100644
index 0000000000..2c903bf60c
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRDirectorOSD.h
@@ -0,0 +1,32 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+
+namespace PVR
+{
+ class CGUIDialogPVRDirectorOSD : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRDirectorOSD(void);
+ virtual ~CGUIDialogPVRDirectorOSD(void);
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGroupManager.cpp b/src/pvr/dialogs/GUIDialogPVRGroupManager.cpp
new file mode 100644
index 0000000000..5165588c85
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGroupManager.cpp
@@ -0,0 +1,384 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRGroupManager.h"
+#include "FileItem.h"
+#include "guilib/GUIKeyboardFactory.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/Key.h"
+#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
+
+#include "pvr/PVRManager.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+
+using namespace PVR;
+
+#define CONTROL_LIST_CHANNELS_LEFT 11
+#define CONTROL_LIST_CHANNELS_RIGHT 12
+#define CONTROL_LIST_CHANNEL_GROUPS 13
+#define CONTROL_CURRENT_GROUP_LABEL 20
+#define CONTROL_UNGROUPED_LABEL 21
+#define CONTROL_IN_GROUP_LABEL 22
+#define BUTTON_NEWGROUP 26
+#define BUTTON_RENAMEGROUP 27
+#define BUTTON_DELGROUP 28
+#define BUTTON_OK 29
+
+CGUIDialogPVRGroupManager::CGUIDialogPVRGroupManager() :
+ CGUIDialog(WINDOW_DIALOG_PVR_GROUP_MANAGER, "DialogPVRGroupManager.xml")
+{
+ m_ungroupedChannels = new CFileItemList;
+ m_groupMembers = new CFileItemList;
+ m_channelGroups = new CFileItemList;
+}
+
+CGUIDialogPVRGroupManager::~CGUIDialogPVRGroupManager()
+{
+ delete m_ungroupedChannels;
+ delete m_groupMembers;
+ delete m_channelGroups;
+}
+
+bool CGUIDialogPVRGroupManager::PersistChanges(void)
+{
+ return g_PVRChannelGroups->Get(m_bIsRadio)->PersistAll();
+}
+
+bool CGUIDialogPVRGroupManager::CancelChanges(void)
+{
+ // TODO
+ return false;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonOk(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (iControl == BUTTON_OK)
+ {
+ PersistChanges();
+ Close();
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonNewGroup(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (iControl == BUTTON_NEWGROUP)
+ {
+ std::string strGroupName = "";
+ /* prompt for a group name */
+ if (CGUIKeyboardFactory::ShowAndGetInput(strGroupName, g_localizeStrings.Get(19139), false))
+ {
+ if (strGroupName != "")
+ {
+ /* add the group if it doesn't already exist */
+ CPVRChannelGroups *groups = ((CPVRChannelGroups *) g_PVRChannelGroups->Get(m_bIsRadio));
+ if (groups->AddGroup(strGroupName))
+ {
+ g_PVRChannelGroups->Get(m_bIsRadio)->GetByName(strGroupName)->SetGroupType(PVR_GROUP_TYPE_USER_DEFINED);
+ m_iSelectedChannelGroup = groups->Size() - 1;
+ Update();
+ }
+ }
+ }
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonDeleteGroup(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (iControl == BUTTON_DELGROUP)
+ {
+ if (!m_selectedGroup)
+ return bReturn;
+
+ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
+ if (!pDialog)
+ return bReturn;
+
+ pDialog->SetHeading(117);
+ pDialog->SetLine(0, "");
+ pDialog->SetLine(1, m_selectedGroup->GroupName());
+ pDialog->SetLine(2, "");
+ pDialog->DoModal();
+
+ if (pDialog->IsConfirmed())
+ {
+ if (((CPVRChannelGroups *) g_PVRChannelGroups->Get(m_bIsRadio))->DeleteGroup(*m_selectedGroup))
+ Update();
+ }
+
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonRenameGroup(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (iControl == BUTTON_RENAMEGROUP)
+ {
+ if (!m_selectedGroup)
+ return bReturn;
+
+ std::string strGroupName(m_selectedGroup->GroupName());
+ if (CGUIKeyboardFactory::ShowAndGetInput(strGroupName, g_localizeStrings.Get(19139), false))
+ {
+ if (strGroupName != "")
+ {
+ m_selectedGroup->SetGroupName(strGroupName, true);
+ Update();
+ }
+ }
+
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonUngroupedChannels(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (m_viewUngroupedChannels.HasControl(iControl)) // list/thumb control
+ {
+ m_iSelectedUngroupedChannel = m_viewUngroupedChannels.GetSelectedItem();
+ int iAction = message.GetParam1();
+
+ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
+ {
+ if (m_channelGroups->GetFolderCount() == 0)
+ {
+ CGUIDialogOK::ShowAndGetInput(19033,19137,0,19138);
+ }
+ else if (m_ungroupedChannels->GetFileCount() > 0)
+ {
+ CFileItemPtr pItemChannel = m_ungroupedChannels->Get(m_iSelectedUngroupedChannel);
+ if (m_selectedGroup->AddToGroup(*pItemChannel->GetPVRChannelInfoTag()))
+ Update();
+ }
+ }
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonGroupMembers(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (m_viewGroupMembers.HasControl(iControl)) // list/thumb control
+ {
+ m_iSelectedGroupMember = m_viewGroupMembers.GetSelectedItem();
+ int iAction = message.GetParam1();
+
+ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
+ {
+ if (m_selectedGroup && m_groupMembers->GetFileCount() > 0)
+ {
+ CFileItemPtr pItemChannel = m_groupMembers->Get(m_iSelectedGroupMember);
+ m_selectedGroup->RemoveFromGroup(*pItemChannel->GetPVRChannelInfoTag());
+ Update();
+ }
+ }
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::ActionButtonChannelGroups(CGUIMessage &message)
+{
+ bool bReturn = false;
+ unsigned int iControl = message.GetSenderId();
+
+ if (m_viewChannelGroups.HasControl(iControl)) // list/thumb control
+ {
+ int iAction = message.GetParam1();
+
+ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
+ {
+ m_iSelectedChannelGroup = m_viewChannelGroups.GetSelectedItem();
+ Update();
+ }
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGroupManager::OnMessageClick(CGUIMessage &message)
+{
+ return ActionButtonOk(message) ||
+ ActionButtonNewGroup(message) ||
+ ActionButtonDeleteGroup(message) ||
+ ActionButtonRenameGroup(message) ||
+ ActionButtonUngroupedChannels(message) ||
+ ActionButtonGroupMembers(message) ||
+ ActionButtonChannelGroups(message);
+}
+
+bool CGUIDialogPVRGroupManager::OnMessage(CGUIMessage& message)
+{
+ unsigned int iMessage = message.GetMessage();
+
+ switch (iMessage)
+ {
+ case GUI_MSG_CLICKED:
+ {
+ OnMessageClick(message);
+ }
+ break;
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogPVRGroupManager::OnInitWindow()
+{
+ CGUIDialog::OnInitWindow();
+ m_iSelectedUngroupedChannel = 0;
+ m_iSelectedGroupMember = 0;
+ m_iSelectedChannelGroup = 0;
+ Update();
+}
+
+void CGUIDialogPVRGroupManager::OnDeinitWindow(int nextWindowID)
+{
+ Clear();
+ CGUIDialog::OnDeinitWindow(nextWindowID);
+}
+
+void CGUIDialogPVRGroupManager::OnWindowLoaded()
+{
+ CGUIDialog::OnWindowLoaded();
+
+ m_viewUngroupedChannels.Reset();
+ m_viewUngroupedChannels.SetParentWindow(GetID());
+ m_viewUngroupedChannels.AddView(GetControl(CONTROL_LIST_CHANNELS_LEFT));
+
+ m_viewGroupMembers.Reset();
+ m_viewGroupMembers.SetParentWindow(GetID());
+ m_viewGroupMembers.AddView(GetControl(CONTROL_LIST_CHANNELS_RIGHT));
+
+ m_viewChannelGroups.Reset();
+ m_viewChannelGroups.SetParentWindow(GetID());
+ m_viewChannelGroups.AddView(GetControl(CONTROL_LIST_CHANNEL_GROUPS));
+}
+
+void CGUIDialogPVRGroupManager::OnWindowUnload()
+{
+ CGUIDialog::OnWindowUnload();
+ m_viewUngroupedChannels.Reset();
+ m_viewGroupMembers.Reset();
+ m_viewChannelGroups.Reset();
+}
+
+void CGUIDialogPVRGroupManager::Update()
+{
+ /* lock our display, as this window is rendered from the player thread */
+ g_graphicsContext.Lock();
+ m_viewUngroupedChannels.SetCurrentView(CONTROL_LIST_CHANNELS_LEFT);
+ m_viewGroupMembers.SetCurrentView(CONTROL_LIST_CHANNELS_RIGHT);
+ m_viewChannelGroups.SetCurrentView(CONTROL_LIST_CHANNEL_GROUPS);
+
+ Clear();
+
+ /* get the groups list */
+ g_PVRChannelGroups->Get(m_bIsRadio)->GetGroupList(m_channelGroups);
+ m_viewChannelGroups.SetItems(*m_channelGroups);
+ m_viewChannelGroups.SetSelectedItem(m_iSelectedChannelGroup);
+
+ /* select a group or select the default group if no group was selected */
+ CFileItemPtr pItem = m_channelGroups->Get(m_viewChannelGroups.GetSelectedItem());
+ m_selectedGroup = g_PVRChannelGroups->Get(m_bIsRadio)->GetByName(pItem->m_strTitle);
+ if (m_selectedGroup)
+ {
+ /* set this group in the pvrmanager, so it becomes the selected group in other dialogs too */
+ g_PVRManager.SetPlayingGroup(m_selectedGroup);
+ SET_CONTROL_LABEL(CONTROL_CURRENT_GROUP_LABEL, m_selectedGroup->GroupName());
+
+ if (m_selectedGroup->IsInternalGroup())
+ {
+ std::string strNewLabel = StringUtils::Format("%s %s",
+ g_localizeStrings.Get(19022).c_str(),
+ m_bIsRadio ? g_localizeStrings.Get(19024).c_str() : g_localizeStrings.Get(19023).c_str());
+ SET_CONTROL_LABEL(CONTROL_UNGROUPED_LABEL, strNewLabel);
+
+ strNewLabel = StringUtils::Format("%s %s",
+ g_localizeStrings.Get(19218).c_str(),
+ m_bIsRadio ? g_localizeStrings.Get(19024).c_str() : g_localizeStrings.Get(19023).c_str());
+ SET_CONTROL_LABEL(CONTROL_IN_GROUP_LABEL, strNewLabel);
+ }
+ else
+ {
+ std::string strNewLabel = StringUtils::Format("%s", g_localizeStrings.Get(19219).c_str());
+ SET_CONTROL_LABEL(CONTROL_UNGROUPED_LABEL, strNewLabel);
+
+ strNewLabel = StringUtils::Format("%s %s", g_localizeStrings.Get(19220).c_str(), m_selectedGroup->GroupName().c_str());
+ SET_CONTROL_LABEL(CONTROL_IN_GROUP_LABEL, strNewLabel);
+ }
+
+ /* get all channels that are not in this group for the center part */
+ m_selectedGroup->GetMembers(*m_ungroupedChannels, false);
+ m_viewUngroupedChannels.SetItems(*m_ungroupedChannels);
+ m_viewUngroupedChannels.SetSelectedItem(m_iSelectedUngroupedChannel);
+
+ /* get all channels in this group for the right side part */
+ m_selectedGroup->GetMembers(*m_groupMembers, true);
+ m_viewGroupMembers.SetItems(*m_groupMembers);
+ m_viewGroupMembers.SetSelectedItem(m_iSelectedGroupMember);
+ }
+
+ g_graphicsContext.Unlock();
+}
+
+void CGUIDialogPVRGroupManager::Clear()
+{
+ m_viewUngroupedChannels.Clear();
+ m_viewGroupMembers.Clear();
+ m_viewChannelGroups.Clear();
+
+ m_ungroupedChannels->Clear();
+ m_groupMembers->Clear();
+ m_channelGroups->Clear();
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGroupManager.h b/src/pvr/dialogs/GUIDialogPVRGroupManager.h
new file mode 100644
index 0000000000..f9ffae1960
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGroupManager.h
@@ -0,0 +1,74 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+#include "view/GUIViewControl.h"
+#include "../channels/PVRChannelGroup.h"
+
+class CFileItemList;
+
+namespace PVR
+{
+ class CGUIDialogPVRGroupManager : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRGroupManager(void);
+ virtual ~CGUIDialogPVRGroupManager(void);
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual void OnWindowLoaded();
+ virtual void OnWindowUnload();
+ void SetRadio(bool IsRadio) { m_bIsRadio = IsRadio; }
+
+ protected:
+ virtual void OnInitWindow();
+ virtual void OnDeinitWindow(int nextWindowID);
+
+ void Clear();
+ void Update();
+
+ private:
+ bool PersistChanges(void);
+ bool CancelChanges(void);
+ bool ActionButtonOk(CGUIMessage &message);
+ bool ActionButtonNewGroup(CGUIMessage &message);
+ bool ActionButtonDeleteGroup(CGUIMessage &message);
+ bool ActionButtonRenameGroup(CGUIMessage &message);
+ bool ActionButtonUngroupedChannels(CGUIMessage &message);
+ bool ActionButtonGroupMembers(CGUIMessage &message);
+ bool ActionButtonChannelGroups(CGUIMessage &message);
+ bool OnMessageClick(CGUIMessage &message);
+
+ CPVRChannelGroupPtr m_selectedGroup;
+ bool m_bIsRadio;
+
+ unsigned int m_iSelectedUngroupedChannel;
+ unsigned int m_iSelectedGroupMember;
+ unsigned int m_iSelectedChannelGroup;
+
+ CFileItemList * m_ungroupedChannels;
+ CFileItemList * m_groupMembers;
+ CFileItemList * m_channelGroups;
+
+ CGUIViewControl m_viewUngroupedChannels;
+ CGUIViewControl m_viewGroupMembers;
+ CGUIViewControl m_viewChannelGroups;
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGuideInfo.cpp b/src/pvr/dialogs/GUIDialogPVRGuideInfo.cpp
new file mode 100644
index 0000000000..79ee8da924
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGuideInfo.cpp
@@ -0,0 +1,282 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRGuideInfo.h"
+#include "Application.h"
+#include "guilib/GUIWindowManager.h"
+#include "dialogs/GUIDialogOK.h"
+#include "dialogs/GUIDialogYesNo.h"
+#include "guilib/LocalizeStrings.h"
+#include "utils/StringUtils.h"
+
+#include "pvr/PVRManager.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include "epg/EpgInfoTag.h"
+#include "pvr/timers/PVRTimers.h"
+#include "pvr/timers/PVRTimerInfoTag.h"
+#include "pvr/windows/GUIWindowPVRBase.h"
+
+using namespace PVR;
+using namespace EPG;
+
+#define CONTROL_BTN_FIND 4
+#define CONTROL_BTN_SWITCH 5
+#define CONTROL_BTN_RECORD 6
+#define CONTROL_BTN_OK 7
+
+CGUIDialogPVRGuideInfo::CGUIDialogPVRGuideInfo(void)
+ : CGUIDialog(WINDOW_DIALOG_PVR_GUIDE_INFO, "DialogPVRGuideInfo.xml")
+ , m_progItem(new CFileItem)
+{
+}
+
+CGUIDialogPVRGuideInfo::~CGUIDialogPVRGuideInfo(void)
+{
+}
+
+bool CGUIDialogPVRGuideInfo::ActionStartTimer(const CEpgInfoTag *tag)
+{
+ bool bReturn = false;
+
+ if (!tag)
+ return false;
+
+ CPVRChannelPtr channel = tag->ChannelTag();
+ if (!channel || !g_PVRManager.CheckParentalLock(*channel))
+ return false;
+
+ // prompt user for confirmation of channel record
+ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
+
+ if (pDialog)
+ {
+ pDialog->SetHeading(264);
+ pDialog->SetLine(0, "");
+ pDialog->SetLine(1, tag->Title());
+ pDialog->SetLine(2, "");
+ pDialog->DoModal();
+
+ if (pDialog->IsConfirmed())
+ {
+ Close();
+ CPVRTimerInfoTag *newTimer = CPVRTimerInfoTag::CreateFromEpg(*tag);
+ if (newTimer)
+ {
+ bReturn = CPVRTimers::AddTimer(*newTimer);
+ delete newTimer;
+ }
+ else
+ {
+ bReturn = false;
+ }
+ }
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGuideInfo::ActionCancelTimer(CFileItemPtr timer)
+{
+ bool bReturn = false;
+ if (!timer || !timer->HasPVRTimerInfoTag())
+ {
+ return bReturn;
+ }
+
+ // prompt user for confirmation of timer deletion
+ CGUIDialogYesNo* pDialog = (CGUIDialogYesNo*)g_windowManager.GetWindow(WINDOW_DIALOG_YES_NO);
+
+ if (pDialog)
+ {
+ pDialog->SetHeading(265);
+ pDialog->SetLine(0, "");
+ pDialog->SetLine(1, timer->GetPVRTimerInfoTag()->m_strTitle);
+ pDialog->SetLine(2, "");
+ pDialog->DoModal();
+
+ if (pDialog->IsConfirmed())
+ {
+ Close();
+ bReturn = CPVRTimers::DeleteTimer(*timer);
+ }
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGuideInfo::OnClickButtonOK(CGUIMessage &message)
+{
+ bool bReturn = false;
+
+ if (message.GetSenderId() == CONTROL_BTN_OK)
+ {
+ Close();
+ bReturn = true;
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGuideInfo::OnClickButtonRecord(CGUIMessage &message)
+{
+ bool bReturn = false;
+
+ if (message.GetSenderId() == CONTROL_BTN_RECORD)
+ {
+ bReturn = true;
+
+ const CEpgInfoTag *tag = m_progItem->GetEPGInfoTag();
+ if (!tag || !tag->HasPVRChannel())
+ {
+ /* invalid channel */
+ CGUIDialogOK::ShowAndGetInput(19033,19067,0,0);
+ Close();
+ return bReturn;
+ }
+
+ CFileItemPtr timerTag = g_PVRTimers->GetTimerForEpgTag(m_progItem.get());
+ bool bHasTimer = timerTag != NULL && timerTag->HasPVRTimerInfoTag();
+
+ if (!bHasTimer)
+ ActionStartTimer(tag);
+ else
+ ActionCancelTimer(timerTag);
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGuideInfo::OnClickButtonSwitch(CGUIMessage &message)
+{
+ bool bReturn = false;
+
+ if (message.GetSenderId() == CONTROL_BTN_SWITCH)
+ {
+ Close();
+ PlayBackRet ret = PLAYBACK_CANCELED;
+ CEpgInfoTag *epgTag = m_progItem->GetEPGInfoTag();
+
+ if (epgTag)
+ {
+ if (epgTag->HasRecording())
+ ret = g_application.PlayFile(CFileItem(*epgTag->Recording()));
+ else if (epgTag->HasPVRChannel())
+ ret = g_application.PlayFile(CFileItem(*epgTag->ChannelTag()));
+ }
+ else
+ ret = PLAYBACK_FAIL;
+
+ if (ret == PLAYBACK_FAIL)
+ {
+ std::string msg = StringUtils::Format(g_localizeStrings.Get(19035).c_str(), g_localizeStrings.Get(19029).c_str()); // Channel could not be played. Check the log for details.
+ CGUIDialogOK::ShowAndGetInput(19033, 0, msg, 0);
+ }
+ else if (ret == PLAYBACK_OK)
+ {
+ bReturn = true;
+ }
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGuideInfo::OnClickButtonFind(CGUIMessage &message)
+{
+ bool bReturn = false;
+
+ if (message.GetSenderId() == CONTROL_BTN_FIND)
+ {
+ const CEpgInfoTag *tag = m_progItem->GetEPGInfoTag();
+ if (tag && tag->HasPVRChannel())
+ {
+ int windowSearchId = tag->ChannelTag()->IsRadio() ? WINDOW_RADIO_SEARCH : WINDOW_TV_SEARCH;
+ CGUIWindowPVRBase *windowSearch = (CGUIWindowPVRBase*) g_windowManager.GetWindow(windowSearchId);
+ if (windowSearch)
+ {
+ Close();
+ g_windowManager.ActivateWindow(windowSearchId);
+ bReturn = windowSearch->OnContextButton(*m_progItem.get(), CONTEXT_BUTTON_FIND);
+ }
+ }
+ }
+
+ return bReturn;
+}
+
+bool CGUIDialogPVRGuideInfo::OnMessage(CGUIMessage& message)
+{
+ switch (message.GetMessage())
+ {
+ case GUI_MSG_CLICKED:
+ return OnClickButtonOK(message) ||
+ OnClickButtonRecord(message) ||
+ OnClickButtonSwitch(message) ||
+ OnClickButtonFind(message);
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogPVRGuideInfo::SetProgInfo(const CFileItem *item)
+{
+ *m_progItem = *item;
+}
+
+CFileItemPtr CGUIDialogPVRGuideInfo::GetCurrentListItem(int offset)
+{
+ return m_progItem;
+}
+
+void CGUIDialogPVRGuideInfo::OnInitWindow()
+{
+ CGUIDialog::OnInitWindow();
+
+ const CEpgInfoTag *tag = m_progItem->GetEPGInfoTag();
+ if (!tag)
+ {
+ /* no epg event selected */
+ return;
+ }
+
+ if (tag->EndAsLocalTime() <= CDateTime::GetCurrentDateTime())
+ {
+ /* event has passed. hide the record button */
+ SET_CONTROL_HIDDEN(CONTROL_BTN_RECORD);
+ return;
+ }
+
+ CFileItemPtr match = g_PVRTimers->GetTimerForEpgTag(m_progItem.get());
+ if (!match || !match->HasPVRTimerInfoTag())
+ {
+ /* no timer present on this tag */
+ if (tag->StartAsLocalTime() < CDateTime::GetCurrentDateTime())
+ SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 264);
+ else
+ SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19061);
+ }
+ else
+ {
+ /* timer present on this tag */
+ if (tag->StartAsLocalTime() < CDateTime::GetCurrentDateTime())
+ SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19059);
+ else
+ SET_CONTROL_LABEL(CONTROL_BTN_RECORD, 19060);
+ }
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGuideInfo.h b/src/pvr/dialogs/GUIDialogPVRGuideInfo.h
new file mode 100644
index 0000000000..243573300b
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGuideInfo.h
@@ -0,0 +1,57 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+
+namespace EPG
+{
+ class CEpgInfoTag;
+}
+
+namespace PVR
+{
+ class CPVRTimerInfoTag;
+
+ class CGUIDialogPVRGuideInfo : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRGuideInfo(void);
+ virtual ~CGUIDialogPVRGuideInfo(void);
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual bool HasListItems() const { return true; };
+ virtual CFileItemPtr GetCurrentListItem(int offset = 0);
+
+ void SetProgInfo(const CFileItem *item);
+
+ protected:
+ virtual void OnInitWindow();
+
+ bool ActionStartTimer(const EPG::CEpgInfoTag *tag);
+ bool ActionCancelTimer(CFileItemPtr timer);
+
+ bool OnClickButtonOK(CGUIMessage &message);
+ bool OnClickButtonRecord(CGUIMessage &message);
+ bool OnClickButtonSwitch(CGUIMessage &message);
+ bool OnClickButtonFind(CGUIMessage &message);
+
+ CFileItemPtr m_progItem;
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGuideOSD.cpp b/src/pvr/dialogs/GUIDialogPVRGuideOSD.cpp
new file mode 100644
index 0000000000..cf7e5d2d25
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGuideOSD.cpp
@@ -0,0 +1,159 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRGuideOSD.h"
+#include "FileItem.h"
+#include "GUIDialogPVRGuideInfo.h"
+#include "guilib/GUIWindowManager.h"
+#include "guilib/Key.h"
+#include "view/ViewState.h"
+#include "epg/Epg.h"
+
+#include "pvr/PVRManager.h"
+
+using namespace PVR;
+
+#define CONTROL_LIST 11
+
+CGUIDialogPVRGuideOSD::CGUIDialogPVRGuideOSD()
+ : CGUIDialog(WINDOW_DIALOG_PVR_OSD_GUIDE, "DialogPVRGuideOSD.xml")
+{
+ m_vecItems = new CFileItemList;
+}
+
+CGUIDialogPVRGuideOSD::~CGUIDialogPVRGuideOSD()
+{
+ delete m_vecItems;
+}
+
+bool CGUIDialogPVRGuideOSD::OnMessage(CGUIMessage& message)
+{
+ switch (message.GetMessage())
+ {
+ case GUI_MSG_CLICKED:
+ {
+ int iControl = message.GetSenderId();
+
+ if (m_viewControl.HasControl(iControl)) // list/thumb control
+ {
+ int iItem = m_viewControl.GetSelectedItem();
+ int iAction = message.GetParam1();
+
+ if (iAction == ACTION_SELECT_ITEM || iAction == ACTION_MOUSE_LEFT_CLICK)
+ {
+ ShowInfo(iItem);
+ return true;
+ }
+ }
+ }
+ break;
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogPVRGuideOSD::OnInitWindow()
+{
+ /* Close dialog immediately if no TV or radio channel is playing */
+ if (!g_PVRManager.IsPlaying())
+ {
+ Close();
+ return;
+ }
+
+ // lock our display, as this window is rendered from the player thread
+ g_graphicsContext.Lock();
+ m_viewControl.SetCurrentView(DEFAULT_VIEW_LIST);
+
+ // empty the list ready for population
+ Clear();
+
+ g_PVRManager.GetCurrentEpg(*m_vecItems);
+ m_viewControl.SetItems(*m_vecItems);
+
+ g_graphicsContext.Unlock();
+
+ // call init
+ CGUIDialog::OnInitWindow();
+
+ // select the active entry
+ unsigned int iSelectedItem = 0;
+ for (int iEpgPtr = 0; iEpgPtr < m_vecItems->Size(); iEpgPtr++)
+ {
+ CFileItemPtr entry = m_vecItems->Get(iEpgPtr);
+ if (entry->GetEPGInfoTag()->IsActive())
+ {
+ iSelectedItem = iEpgPtr;
+ break;
+ }
+ }
+ m_viewControl.SetSelectedItem(iSelectedItem);
+}
+
+void CGUIDialogPVRGuideOSD::OnDeinitWindow(int nextWindowID)
+{
+ CGUIDialog::OnDeinitWindow(nextWindowID);
+ Clear();
+}
+
+void CGUIDialogPVRGuideOSD::Clear()
+{
+ m_viewControl.Clear();
+ m_vecItems->Clear();
+}
+
+void CGUIDialogPVRGuideOSD::ShowInfo(int item)
+{
+ /* Check file item is in list range and get his pointer */
+ if (item < 0 || item >= (int)m_vecItems->Size()) return;
+
+ CFileItemPtr pItem = m_vecItems->Get(item);
+
+ /* Load programme info dialog */
+ CGUIDialogPVRGuideInfo* pDlgInfo = (CGUIDialogPVRGuideInfo*)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_GUIDE_INFO);
+ if (!pDlgInfo)
+ return;
+
+ /* inform dialog about the file item and open dialog window */
+ pDlgInfo->SetProgInfo(pItem.get());
+ pDlgInfo->DoModal();
+}
+
+void CGUIDialogPVRGuideOSD::OnWindowLoaded()
+{
+ CGUIDialog::OnWindowLoaded();
+ m_viewControl.Reset();
+ m_viewControl.SetParentWindow(GetID());
+ m_viewControl.AddView(GetControl(CONTROL_LIST));
+}
+
+void CGUIDialogPVRGuideOSD::OnWindowUnload()
+{
+ CGUIDialog::OnWindowUnload();
+ m_viewControl.Reset();
+}
+
+CGUIControl *CGUIDialogPVRGuideOSD::GetFirstFocusableControl(int id)
+{
+ if (m_viewControl.HasControl(id))
+ id = m_viewControl.GetCurrentControl();
+
+ return CGUIWindow::GetFirstFocusableControl(id);
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGuideOSD.h b/src/pvr/dialogs/GUIDialogPVRGuideOSD.h
new file mode 100644
index 0000000000..cc20c4c0c6
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGuideOSD.h
@@ -0,0 +1,50 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+#include "view/GUIViewControl.h"
+
+class CFileItemList;
+
+namespace PVR
+{
+ class CGUIDialogPVRGuideOSD : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRGuideOSD(void);
+ virtual ~CGUIDialogPVRGuideOSD(void);
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual void OnWindowLoaded();
+ virtual void OnWindowUnload();
+
+ protected:
+ virtual void OnInitWindow();
+ virtual void OnDeinitWindow(int nextWindowID);
+
+ void ShowInfo(int iItem);
+ void Clear();
+
+ CGUIControl *GetFirstFocusableControl(int id);
+
+ CFileItemList *m_vecItems;
+ CGUIViewControl m_viewControl;
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGuideSearch.cpp b/src/pvr/dialogs/GUIDialogPVRGuideSearch.cpp
new file mode 100644
index 0000000000..15acf44e50
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGuideSearch.cpp
@@ -0,0 +1,306 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRGuideSearch.h"
+#include "Application.h"
+#include "guilib/LocalizeStrings.h"
+#include "guilib/GUIEditControl.h"
+#include "guilib/GUIWindowManager.h"
+#include "utils/StringUtils.h"
+
+#include "addons/include/xbmc_pvr_types.h"
+#include "pvr/PVRManager.h"
+#include "epg/EpgSearchFilter.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+
+using namespace PVR;
+
+#define CONTROL_EDIT_SEARCH 9
+#define CONTROL_BTN_INC_DESC 10
+#define CONTROL_BTN_CASE_SENS 11
+#define CONTROL_SPIN_MIN_DURATION 12
+#define CONTROL_SPIN_MAX_DURATION 13
+#define CONTROL_EDIT_START_DATE 14
+#define CONTROL_EDIT_STOP_DATE 15
+#define CONTROL_EDIT_START_TIME 16
+#define CONTROL_EDIT_STOP_TIME 17
+#define CONTROL_SPIN_GENRE 18
+#define CONTROL_SPIN_NO_REPEATS 19
+#define CONTROL_BTN_UNK_GENRE 20
+#define CONTROL_SPIN_GROUPS 21
+#define CONTROL_BTN_FTA_ONLY 22
+#define CONTROL_SPIN_CHANNELS 23
+#define CONTROL_BTN_IGNORE_TMR 24
+#define CONTROL_BTN_CANCEL 25
+#define CONTROL_BTN_SEARCH 26
+#define CONTROL_BTN_IGNORE_REC 27
+#define CONTROL_BTN_DEFAULTS 28
+
+CGUIDialogPVRGuideSearch::CGUIDialogPVRGuideSearch(void) :
+ CGUIDialog(WINDOW_DIALOG_PVR_GUIDE_SEARCH, "DialogPVRGuideSearch.xml"),
+ m_bConfirmed(false),
+ m_bCanceled(false),
+ m_searchFilter(NULL)
+{
+}
+
+void CGUIDialogPVRGuideSearch::UpdateChannelSpin(void)
+{
+ int iChannelGroup = GetSpinValue(CONTROL_SPIN_GROUPS);
+
+ std::vector< std::pair<std::string, int> > labels;
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19217), EPG_SEARCH_UNSET));
+
+ CPVRChannelGroupPtr group;
+ if (iChannelGroup == EPG_SEARCH_UNSET)
+ group = g_PVRChannelGroups->GetGroupAll(m_searchFilter->m_bIsRadio);
+ else
+ group = g_PVRChannelGroups->GetByIdFromAll(iChannelGroup);
+
+ if (!group)
+ group = g_PVRChannelGroups->GetGroupAll(m_searchFilter->m_bIsRadio);
+
+ for (int iChannelPtr = 0; iChannelPtr < group->Size(); iChannelPtr++)
+ {
+ CFileItemPtr channel = group->GetByIndex(iChannelPtr);
+ if (!channel || !channel->HasPVRChannelInfoTag())
+ continue;
+
+ int iChannelNumber = group->GetChannelNumber(*channel->GetPVRChannelInfoTag());
+ labels.push_back(std::make_pair(channel->GetPVRChannelInfoTag()->ChannelName(), iChannelNumber));
+ }
+
+ SET_CONTROL_LABELS(CONTROL_SPIN_CHANNELS, m_searchFilter->m_iChannelNumber, &labels);
+}
+
+void CGUIDialogPVRGuideSearch::UpdateGroupsSpin(void)
+{
+ std::vector< std::pair<std::string, int> > labels;
+
+ /* groups */
+ std::vector<CPVRChannelGroupPtr> groups = g_PVRChannelGroups->Get(m_searchFilter->m_bIsRadio)->GetMembers();
+ for (std::vector<CPVRChannelGroupPtr>::const_iterator it = groups.begin(); it != groups.end(); ++it)
+ labels.push_back(std::make_pair((*it)->GroupName(), (*it)->GroupID()));
+
+ SET_CONTROL_LABELS(CONTROL_SPIN_GROUPS, m_searchFilter->m_iChannelGroup, &labels);
+}
+
+void CGUIDialogPVRGuideSearch::UpdateGenreSpin(void)
+{
+ std::vector< std::pair<std::string, int> > labels;
+ labels.push_back(std::make_pair(g_localizeStrings.Get(593), EPG_SEARCH_UNSET));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19500), EPG_EVENT_CONTENTMASK_MOVIEDRAMA));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19516), EPG_EVENT_CONTENTMASK_NEWSCURRENTAFFAIRS));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19532), EPG_EVENT_CONTENTMASK_SHOW));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19548), EPG_EVENT_CONTENTMASK_SPORTS));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19564), EPG_EVENT_CONTENTMASK_CHILDRENYOUTH));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19580), EPG_EVENT_CONTENTMASK_MUSICBALLETDANCE));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19596), EPG_EVENT_CONTENTMASK_ARTSCULTURE));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19612), EPG_EVENT_CONTENTMASK_SOCIALPOLITICALECONOMICS));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19628), EPG_EVENT_CONTENTMASK_EDUCATIONALSCIENCE));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19644), EPG_EVENT_CONTENTMASK_LEISUREHOBBIES));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19660), EPG_EVENT_CONTENTMASK_SPECIAL));
+ labels.push_back(std::make_pair(g_localizeStrings.Get(19499), EPG_EVENT_CONTENTMASK_USERDEFINED));
+
+ SET_CONTROL_LABELS(CONTROL_SPIN_GENRE, m_searchFilter->m_iGenreType, &labels);
+}
+
+void CGUIDialogPVRGuideSearch::UpdateDurationSpin(void)
+{
+ /* minimum duration */
+ std::vector< std::pair<std::string, int> > labels;
+
+ labels.push_back(std::make_pair("-", EPG_SEARCH_UNSET));
+ for (int i = 1; i < 12*60/5; i++)
+ labels.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(14044).c_str(), i*5), i*5));
+
+ SET_CONTROL_LABELS(CONTROL_SPIN_MIN_DURATION, m_searchFilter->m_iMinimumDuration, &labels);
+
+ /* maximum duration */
+ labels.clear();
+
+ labels.push_back(std::make_pair("-", EPG_SEARCH_UNSET));
+ for (int i = 1; i < 12*60/5; i++)
+ labels.push_back(std::make_pair(StringUtils::Format(g_localizeStrings.Get(14044).c_str(), i*5), i*5));
+
+ SET_CONTROL_LABELS(CONTROL_SPIN_MAX_DURATION, m_searchFilter->m_iMaximumDuration, &labels);
+}
+
+bool CGUIDialogPVRGuideSearch::OnMessage(CGUIMessage& message)
+{
+ CGUIDialog::OnMessage(message);
+
+ switch (message.GetMessage())
+ {
+ case GUI_MSG_CLICKED:
+ {
+ int iControl = message.GetSenderId();
+ if (iControl == CONTROL_BTN_SEARCH)
+ {
+ OnSearch();
+ m_bConfirmed = true;
+ m_bCanceled = false;
+ Close();
+ return true;
+ }
+ else if (iControl == CONTROL_BTN_CANCEL)
+ {
+ Close();
+ m_bCanceled = true;
+ return true;
+ }
+ else if (iControl == CONTROL_BTN_DEFAULTS)
+ {
+ if (m_searchFilter)
+ {
+ m_searchFilter->Reset();
+ Update();
+ }
+
+ return true;
+ }
+ else if (iControl == CONTROL_SPIN_GROUPS)
+ {
+ UpdateChannelSpin();
+ return true;
+ }
+ }
+ break;
+ }
+
+ return false;
+}
+
+void CGUIDialogPVRGuideSearch::OnInitWindow()
+{
+ CGUIDialog::OnInitWindow();
+
+ m_bConfirmed = false;
+ m_bCanceled = false;
+}
+
+void CGUIDialogPVRGuideSearch::OnWindowLoaded()
+{
+ Update();
+ return CGUIDialog::OnWindowLoaded();
+}
+
+void CGUIDialogPVRGuideSearch::ReadDateTime(const std::string &strDate, const std::string &strTime, CDateTime &dateTime) const
+{
+ int iHours, iMinutes;
+ sscanf(strTime.c_str(), "%d:%d", &iHours, &iMinutes);
+ dateTime.SetFromDBDate(strDate);
+ dateTime.SetDateTime(dateTime.GetYear(), dateTime.GetMonth(), dateTime.GetDay(), iHours, iMinutes, 0);
+}
+
+bool CGUIDialogPVRGuideSearch::IsRadioSelected(int controlID)
+{
+ CGUIMessage msg(GUI_MSG_IS_SELECTED, GetID(), controlID);
+ OnMessage(msg);
+ return (msg.GetParam1() == 1);
+}
+
+int CGUIDialogPVRGuideSearch::GetSpinValue(int controlID)
+{
+ CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), controlID);
+ OnMessage(msg);
+ return (int)msg.GetParam1();
+}
+
+std::string CGUIDialogPVRGuideSearch::GetEditValue(int controlID)
+{
+ CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), controlID);
+ OnMessage(msg);
+ return msg.GetLabel();
+}
+
+void CGUIDialogPVRGuideSearch::OnSearch()
+{
+ if (!m_searchFilter)
+ return;
+
+ m_searchFilter->m_strSearchTerm = GetEditValue(CONTROL_EDIT_SEARCH);
+
+ m_searchFilter->m_bSearchInDescription = IsRadioSelected(CONTROL_BTN_INC_DESC);
+ m_searchFilter->m_bIsCaseSensitive = IsRadioSelected(CONTROL_BTN_CASE_SENS);
+ m_searchFilter->m_bFTAOnly = IsRadioSelected(CONTROL_BTN_FTA_ONLY);
+ m_searchFilter->m_bIncludeUnknownGenres = IsRadioSelected(CONTROL_BTN_UNK_GENRE);
+ m_searchFilter->m_bIgnorePresentRecordings = IsRadioSelected(CONTROL_BTN_IGNORE_REC);
+ m_searchFilter->m_bIgnorePresentTimers = IsRadioSelected(CONTROL_BTN_IGNORE_TMR);
+ m_searchFilter->m_bPreventRepeats = IsRadioSelected(CONTROL_SPIN_NO_REPEATS);
+
+ m_searchFilter->m_iGenreType = GetSpinValue(CONTROL_SPIN_GENRE);
+ m_searchFilter->m_iMinimumDuration = GetSpinValue(CONTROL_SPIN_MIN_DURATION);
+ m_searchFilter->m_iMaximumDuration = GetSpinValue(CONTROL_SPIN_MAX_DURATION);
+ m_searchFilter->m_iChannelNumber = GetSpinValue(CONTROL_SPIN_CHANNELS);
+ m_searchFilter->m_iChannelGroup = GetSpinValue(CONTROL_SPIN_GROUPS);
+
+ std::string strTmp = GetEditValue(CONTROL_EDIT_START_TIME);
+ ReadDateTime(GetEditValue(CONTROL_EDIT_START_DATE), strTmp, m_searchFilter->m_startDateTime);
+ strTmp = GetEditValue(CONTROL_EDIT_STOP_TIME);
+ ReadDateTime(GetEditValue(CONTROL_EDIT_STOP_DATE), strTmp, m_searchFilter->m_endDateTime);
+}
+
+void CGUIDialogPVRGuideSearch::Update()
+{
+ if (!m_searchFilter)
+ return;
+
+ SET_CONTROL_LABEL2(CONTROL_EDIT_SEARCH, m_searchFilter->m_strSearchTerm);
+ {
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_SEARCH, CGUIEditControl::INPUT_TYPE_TEXT, 16017);
+ OnMessage(msg);
+ }
+
+ SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_CASE_SENS, m_searchFilter->m_bIsCaseSensitive);
+ SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_INC_DESC, m_searchFilter->m_bSearchInDescription);
+ SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_FTA_ONLY, m_searchFilter->m_bFTAOnly);
+ SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_UNK_GENRE, m_searchFilter->m_bIncludeUnknownGenres);
+ SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_IGNORE_REC, m_searchFilter->m_bIgnorePresentRecordings);
+ SET_CONTROL_SELECTED(GetID(), CONTROL_BTN_IGNORE_TMR, m_searchFilter->m_bIgnorePresentTimers);
+ SET_CONTROL_SELECTED(GetID(), CONTROL_SPIN_NO_REPEATS, m_searchFilter->m_bPreventRepeats);
+
+ /* Set time fields */
+ SET_CONTROL_LABEL2(CONTROL_EDIT_START_TIME, m_searchFilter->m_startDateTime.GetAsLocalizedTime("", false));
+ {
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_START_TIME, CGUIEditControl::INPUT_TYPE_TIME, 14066);
+ OnMessage(msg);
+ }
+ SET_CONTROL_LABEL2(CONTROL_EDIT_STOP_TIME, m_searchFilter->m_endDateTime.GetAsLocalizedTime("", false));
+ {
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_STOP_TIME, CGUIEditControl::INPUT_TYPE_TIME, 14066);
+ OnMessage(msg);
+ }
+ SET_CONTROL_LABEL2(CONTROL_EDIT_START_DATE, m_searchFilter->m_startDateTime.GetAsDBDate());
+ {
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_START_DATE, CGUIEditControl::INPUT_TYPE_DATE, 14067);
+ OnMessage(msg);
+ }
+ SET_CONTROL_LABEL2(CONTROL_EDIT_STOP_DATE, m_searchFilter->m_endDateTime.GetAsDBDate());
+ {
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_STOP_DATE, CGUIEditControl::INPUT_TYPE_DATE, 14067);
+ OnMessage(msg);
+ }
+
+ UpdateDurationSpin();
+ UpdateGroupsSpin();
+ UpdateChannelSpin();
+ UpdateGenreSpin();
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRGuideSearch.h b/src/pvr/dialogs/GUIDialogPVRGuideSearch.h
new file mode 100644
index 0000000000..0590d338fd
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRGuideSearch.h
@@ -0,0 +1,63 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+#include "XBDateTime.h"
+
+namespace EPG
+{
+ struct EpgSearchFilter;
+}
+
+namespace PVR
+{
+ class CGUIDialogPVRGuideSearch : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRGuideSearch(void);
+ virtual ~CGUIDialogPVRGuideSearch(void) {}
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual void OnWindowLoaded();
+
+ void SetFilterData(EPG::EpgSearchFilter *searchFilter) { m_searchFilter = searchFilter; }
+ bool IsConfirmed() const { return m_bConfirmed; }
+ bool IsCanceled() const { return m_bCanceled; }
+ void OnSearch();
+
+ protected:
+ virtual void OnInitWindow();
+
+ void UpdateChannelSpin(void);
+ void UpdateGroupsSpin(void);
+ void UpdateGenreSpin(void);
+ void UpdateDurationSpin(void);
+ void ReadDateTime(const std::string &strDate, const std::string &strTime, CDateTime &dateTime) const;
+ void Update();
+
+ bool IsRadioSelected(int controlID);
+ int GetSpinValue(int controlID);
+ std::string GetEditValue(int controlID);
+
+ bool m_bConfirmed;
+ bool m_bCanceled;
+ EPG::EpgSearchFilter *m_searchFilter;
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRRecordingInfo.cpp b/src/pvr/dialogs/GUIDialogPVRRecordingInfo.cpp
new file mode 100644
index 0000000000..ca6f7ca18c
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRRecordingInfo.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRRecordingInfo.h"
+#include "guilib/GUIWindowManager.h"
+#include "FileItem.h"
+
+using namespace PVR;
+
+#define CONTROL_BTN_OK 10
+
+CGUIDialogPVRRecordingInfo::CGUIDialogPVRRecordingInfo(void)
+ : CGUIDialog(WINDOW_DIALOG_PVR_RECORDING_INFO, "DialogPVRRecordingInfo.xml")
+ , m_recordItem(new CFileItem)
+{
+}
+
+bool CGUIDialogPVRRecordingInfo::OnMessage(CGUIMessage& message)
+{
+ if (message.GetMessage() == GUI_MSG_CLICKED)
+ {
+ int iControl = message.GetSenderId();
+
+ if (iControl == CONTROL_BTN_OK)
+ {
+ Close();
+ return true;
+ }
+ }
+
+ return CGUIDialog::OnMessage(message);
+}
+
+void CGUIDialogPVRRecordingInfo::SetRecording(const CFileItem *item)
+{
+ *m_recordItem = *item;
+}
+
+CFileItemPtr CGUIDialogPVRRecordingInfo::GetCurrentListItem(int offset)
+{
+ return m_recordItem;
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRRecordingInfo.h b/src/pvr/dialogs/GUIDialogPVRRecordingInfo.h
new file mode 100644
index 0000000000..5415d902c8
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRRecordingInfo.h
@@ -0,0 +1,40 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2013 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "guilib/GUIDialog.h"
+
+namespace PVR
+{
+ class CGUIDialogPVRRecordingInfo : public CGUIDialog
+ {
+ public:
+ CGUIDialogPVRRecordingInfo(void);
+ virtual ~CGUIDialogPVRRecordingInfo(void) {}
+ virtual bool OnMessage(CGUIMessage& message);
+ virtual bool HasListItems() const { return true; };
+ virtual CFileItemPtr GetCurrentListItem(int offset = 0);
+
+ void SetRecording(const CFileItem *item);
+
+ protected:
+ CFileItemPtr m_recordItem;
+ };
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRTimerSettings.cpp b/src/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
new file mode 100644
index 0000000000..7fda3d932c
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRTimerSettings.cpp
@@ -0,0 +1,528 @@
+/*
+ * Copyright (C) 2012-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "GUIDialogPVRTimerSettings.h"
+#include "FileItem.h"
+#include "dialogs/GUIDialogNumeric.h"
+#include "guilib/LocalizeStrings.h"
+#include "pvr/PVRManager.h"
+#include "pvr/addons/PVRClient.h"
+#include "pvr/channels/PVRChannelGroupsContainer.h"
+#include "pvr/timers/PVRTimerInfoTag.h"
+#include "settings/lib/Setting.h"
+#include "settings/lib/SettingsManager.h"
+#include "settings/windows/GUIControlSettings.h"
+#include "utils/log.h"
+#include "utils/StringUtils.h"
+
+using namespace PVR;
+
+#define SETTING_TMR_ACTIVE "timer.active"
+#define SETTING_TMR_CHNAME_TV "timer.tvchannelname"
+#define SETTING_TMR_DAY "timer.day"
+#define SETTING_TMR_BEGIN "timer.begin"
+#define SETTING_TMR_END "timer.end"
+#define SETTING_TMR_PRIORITY "timer.priority"
+#define SETTING_TMR_LIFETIME "timer.lifetime"
+#define SETTING_TMR_FIRST_DAY "timer.firstday"
+#define SETTING_TMR_NAME "timer.name"
+#define SETTING_TMR_DIR "timer.directory"
+#define SETTING_TMR_RADIO "timer.radio"
+#define SETTING_TMR_CHNAME_RADIO "timer.radiochannelname"
+
+CGUIDialogPVRTimerSettings::CGUIDialogPVRTimerSettings(void)
+ : CGUIDialogSettingsManualBase(WINDOW_DIALOG_PVR_TIMER_SETTING, "DialogPVRTimerSettings.xml"),
+ m_tmp_iFirstDay(0),
+ m_tmp_day(11),
+ m_bTimerActive(false),
+ m_timerItem(NULL)
+{
+ m_loadType = LOAD_EVERY_TIME;
+}
+
+void CGUIDialogPVRTimerSettings::SetTimer(CFileItem *item)
+{
+ m_timerItem = item;
+
+ m_timerItem->GetPVRTimerInfoTag()->StartAsLocalTime().GetAsSystemTime(m_timerStartTime);
+ m_timerItem->GetPVRTimerInfoTag()->EndAsLocalTime().GetAsSystemTime(m_timerEndTime);
+ m_timerStartTimeStr = m_timerItem->GetPVRTimerInfoTag()->StartAsLocalTime().GetAsLocalizedTime("", false);
+ m_timerEndTimeStr = m_timerItem->GetPVRTimerInfoTag()->EndAsLocalTime().GetAsLocalizedTime("", false);
+
+ m_tmp_iFirstDay = 0;
+ m_tmp_day = 11;
+}
+
+void CGUIDialogPVRTimerSettings::OnSettingChanged(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ CGUIDialogSettingsManualBase::OnSettingChanged(setting);
+
+ CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
+ if (tag == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == SETTING_TMR_ACTIVE)
+ m_bTimerActive = static_cast<const CSettingBool*>(setting)->GetValue();
+ if (settingId == SETTING_TMR_RADIO || settingId == SETTING_TMR_CHNAME_TV || settingId == SETTING_TMR_CHNAME_RADIO)
+ {
+ if (settingId == SETTING_TMR_RADIO)
+ {
+ tag->m_bIsRadio = static_cast<const CSettingBool*>(setting)->GetValue();
+ m_selectedChannelEntry = 0;
+ }
+ else
+ m_selectedChannelEntry = static_cast<const CSettingInt*>(setting)->GetValue();
+
+ std::map<std::pair<bool, int>, int>::iterator itc = m_channelEntries.find(std::make_pair(tag->m_bIsRadio, m_selectedChannelEntry));
+ if (itc != m_channelEntries.end())
+ {
+ CPVRChannelPtr channel = g_PVRChannelGroups->GetChannelById(itc->second);
+ if (channel)
+ {
+ tag->m_iClientChannelUid = channel->UniqueID();
+ tag->m_iClientId = channel->ClientID();
+ tag->m_bIsRadio = channel->IsRadio();
+ tag->m_iChannelNumber = channel->ChannelNumber();
+ }
+ else
+ {
+ tag->m_iClientChannelUid = PVR_VIRTUAL_CHANNEL_UID;
+ tag->m_iClientId = PVR_VIRTUAL_CLIENT_ID;
+ tag->m_iChannelNumber = 0;
+ }
+ // Update channel pointer from above values
+ tag->UpdateChannel();
+ }
+ }
+ else if (settingId == SETTING_TMR_DAY)
+ {
+ m_tmp_day = static_cast<const CSettingInt*>(setting)->GetValue();
+
+ if (m_tmp_day <= 10)
+ SetTimerFromWeekdaySetting(*tag);
+ else
+ {
+ CDateTime time = CDateTime::GetCurrentDateTime();
+ CDateTime timestart = m_timerStartTime;
+ CDateTime timestop = m_timerEndTime;
+ int m_tmp_diff;
+
+ // get diffence of timer in days between today and timer start date
+ tm time_cur; time.GetAsTm(time_cur);
+ tm time_tmr; timestart.GetAsTm(time_tmr);
+
+ m_tmp_diff = time_tmr.tm_yday - time_cur.tm_yday;
+ if (time_tmr.tm_yday - time_cur.tm_yday < 0)
+ m_tmp_diff = 365;
+
+ CDateTime newStart = timestart + CDateTimeSpan(m_tmp_day - 11 - m_tmp_diff, 0, 0, 0);
+ CDateTime newEnd = timestop + CDateTimeSpan(m_tmp_day - 11 - m_tmp_diff, 0, 0, 0);
+
+ // add a day to end time if end time is before start time
+ // TODO: this should be removed after separate end date control was added
+ if (newEnd < newStart)
+ newEnd += CDateTimeSpan(1, 0, 0, 0);
+
+ tag->SetStartFromLocalTime(newStart);
+ tag->SetEndFromLocalTime(newEnd);
+
+ tag->m_bIsRepeating = false;
+ tag->m_iWeekdays = 0;
+ }
+ }
+ else if (settingId == SETTING_TMR_PRIORITY)
+ tag->m_iPriority = static_cast<const CSettingInt*>(setting)->GetValue();
+ else if (settingId == SETTING_TMR_LIFETIME)
+ tag->m_iLifetime = static_cast<const CSettingInt*>(setting)->GetValue();
+ else if (settingId == SETTING_TMR_FIRST_DAY)
+ {
+ m_tmp_iFirstDay = static_cast<const CSettingInt*>(setting)->GetValue();
+
+ CDateTime newFirstDay;
+ if (m_tmp_iFirstDay > 0)
+ newFirstDay = CDateTime::GetCurrentDateTime() + CDateTimeSpan(m_tmp_iFirstDay - 1, 0, 0, 0);
+
+ tag->SetFirstDayFromLocalTime(newFirstDay);
+ }
+ else if (settingId == SETTING_TMR_NAME)
+ tag->m_strTitle = static_cast<const CSettingString*>(setting)->GetValue();
+ else if (settingId == SETTING_TMR_DIR)
+ tag->m_strDirectory = static_cast<const CSettingString*>(setting)->GetValue();
+
+ tag->UpdateSummary();
+}
+
+void CGUIDialogPVRTimerSettings::OnSettingAction(const CSetting *setting)
+{
+ if (setting == NULL)
+ return;
+
+ CGUIDialogSettingsManualBase::OnSettingAction(setting);
+
+ CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
+ if (tag == NULL)
+ return;
+
+ const std::string &settingId = setting->GetId();
+ if (settingId == SETTING_TMR_BEGIN)
+ {
+ if (CGUIDialogNumeric::ShowAndGetTime(m_timerStartTime, g_localizeStrings.Get(14066)))
+ {
+ CDateTime timestart = m_timerStartTime;
+ int start_day = tag->StartAsLocalTime().GetDay();
+ int start_month = tag->StartAsLocalTime().GetMonth();
+ int start_year = tag->StartAsLocalTime().GetYear();
+ int start_hour = timestart.GetHour();
+ int start_minute = timestart.GetMinute();
+ CDateTime newStart(start_year, start_month, start_day, start_hour, start_minute, 0);
+ tag->SetStartFromLocalTime(newStart);
+
+ m_timerStartTimeStr = tag->StartAsLocalTime().GetAsLocalizedTime("", false);
+ setButtonLabels();
+ }
+ }
+ else if (settingId == SETTING_TMR_END)
+ {
+ if (CGUIDialogNumeric::ShowAndGetTime(m_timerEndTime, g_localizeStrings.Get(14066)))
+ {
+ CDateTime timestop = m_timerEndTime;
+ // TODO: add separate end date control to schedule a show with more then 24 hours
+ int start_day = tag->StartAsLocalTime().GetDay();
+ int start_month = tag->StartAsLocalTime().GetMonth();
+ int start_year = tag->StartAsLocalTime().GetYear();
+ int start_hour = timestop.GetHour();
+ int start_minute = timestop.GetMinute();
+ CDateTime newEnd(start_year, start_month, start_day, start_hour, start_minute, 0);
+
+ // add a day to end time if end time is before start time
+ // TODO: this should be removed after separate end date control was added
+ if (newEnd < tag->StartAsLocalTime())
+ newEnd += CDateTimeSpan(1, 0, 0, 0);
+
+ tag->SetEndFromLocalTime(newEnd);
+
+ m_timerEndTimeStr = tag->EndAsLocalTime().GetAsLocalizedTime("", false);
+ setButtonLabels();
+ }
+ }
+
+ tag->UpdateSummary();
+}
+
+void CGUIDialogPVRTimerSettings::Save()
+{
+ CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
+
+ // Set the timer's title to the channel name if it's 'New Timer' or empty
+ if (tag->m_strTitle == g_localizeStrings.Get(19056) || tag->m_strTitle.empty())
+ {
+ CPVRChannelPtr channel = g_PVRChannelGroups->GetByUniqueID(tag->m_iClientChannelUid, tag->m_iClientId);
+ if (channel)
+ tag->m_strTitle = channel->ChannelName();
+ }
+
+ if (m_bTimerActive)
+ tag->m_state = PVR_TIMER_STATE_SCHEDULED;
+ else
+ tag->m_state = PVR_TIMER_STATE_CANCELLED;
+}
+
+void CGUIDialogPVRTimerSettings::SetupView()
+{
+ CGUIDialogSettingsManualBase::SetupView();
+
+ setButtonLabels();
+}
+
+void CGUIDialogPVRTimerSettings::InitializeSettings()
+{
+ CGUIDialogSettingsManualBase::InitializeSettings();
+
+ CSettingCategory *category = AddCategory("pvrtimersettings", -1);
+ if (category == NULL)
+ {
+ CLog::Log(LOGERROR, "CGUIDialogPVRTimerSettings: unable to setup settings");
+ return;
+ }
+
+ CSettingGroup *group = AddGroup(category);
+ if (group == NULL)
+ {
+ CLog::Log(LOGERROR, "CGUIDialogPVRTimerSettings: unable to setup settings");
+ return;
+ }
+
+ // add a condition
+ m_settingsManager->AddCondition("IsTimerDayRepeating", IsTimerDayRepeating);
+
+ CPVRTimerInfoTag* tag = m_timerItem->GetPVRTimerInfoTag();
+
+ m_selectedChannelEntry = 0;
+ m_channelEntries.clear();
+ m_bTimerActive = tag->IsActive();
+
+ AddToggle(group, SETTING_TMR_ACTIVE, 19074, 0, m_bTimerActive);
+ AddEdit(group, SETTING_TMR_NAME, 19075, 0, tag->m_strTitle, false, false, 19097);
+
+ if (tag->SupportsFolders())
+ AddEdit(group, SETTING_TMR_DIR, 19076, 0, tag->m_strDirectory, true, false, 19104);
+
+ AddToggle(group, SETTING_TMR_RADIO, 19077, 0, tag->m_bIsRadio);
+
+ /// Channel names
+ {
+ // For TV
+ AddChannelNames(group, false);
+
+ // For Radio
+ AddChannelNames(group, true);
+ }
+
+ /// Day
+ {
+ // get diffence of timer in days between today and timer start date
+ tm time_cur; CDateTime::GetCurrentDateTime().GetAsTm(time_cur);
+ tm time_tmr; tag->StartAsLocalTime().GetAsTm(time_tmr);
+
+ m_tmp_day += time_tmr.tm_yday - time_cur.tm_yday;
+ if (time_tmr.tm_yday - time_cur.tm_yday < 0)
+ m_tmp_day += 365;
+
+ SetWeekdaySettingFromTimer(*tag);
+
+ AddSpinner(group, SETTING_TMR_DAY, 19079, 0, m_tmp_day, DaysOptionsFiller);
+ }
+
+ AddButton(group, SETTING_TMR_BEGIN, 19080, 0);
+ AddButton(group, SETTING_TMR_END, 19081, 0);
+ AddSpinner(group, SETTING_TMR_PRIORITY, 19082, 0, tag->m_iPriority, 0, 1, 99);
+ AddSpinner(group, SETTING_TMR_LIFETIME, 19083, 0, tag->m_iLifetime, 0, 1, 365);
+
+ /// First day
+ {
+ CDateTime time = CDateTime::GetCurrentDateTime();
+ CDateTime timestart = tag->FirstDayAsLocalTime();
+
+ // get diffence of timer in days between today and timer start date
+ if (time < timestart)
+ {
+ tm time_cur; time.GetAsTm(time_cur);
+ tm time_tmr; timestart.GetAsTm(time_tmr);
+
+ m_tmp_iFirstDay += time_tmr.tm_yday - time_cur.tm_yday + 1;
+ if (time_tmr.tm_yday - time_cur.tm_yday < 0)
+ m_tmp_iFirstDay += 365;
+ }
+
+ CSettingInt *settingFirstDay = AddSpinner(group, SETTING_TMR_FIRST_DAY, 19084, 0, m_tmp_iFirstDay, DaysOptionsFiller);
+
+ // define an enable dependency with m_tmp_day <= 10
+ CSettingDependency depdendencyFirstDay(SettingDependencyTypeEnable, m_settingsManager);
+ depdendencyFirstDay.And()
+ ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition("IsTimerDayRepeating", "true", SETTING_TMR_DAY, false, m_settingsManager)));
+ SettingDependencies deps;
+ deps.push_back(depdendencyFirstDay);
+ settingFirstDay->SetDependencies(deps);
+ }
+}
+
+CSetting* CGUIDialogPVRTimerSettings::AddChannelNames(CSettingGroup *group, bool bRadio)
+{
+ std::vector< std::pair<std::string, int> > options;
+ getChannelNames(bRadio, options, m_selectedChannelEntry, true);
+
+ int timerChannelID;
+ if (m_timerItem->GetPVRTimerInfoTag()->ChannelTag())
+ timerChannelID = m_timerItem->GetPVRTimerInfoTag()->ChannelTag()->ChannelID();
+ else
+ timerChannelID = PVR_VIRTUAL_CHANNEL_UID;
+
+ for (std::vector< std::pair<std::string, int> >::const_iterator option = options.begin(); option != options.end(); ++option)
+ {
+ std::map<std::pair<bool, int>, int>::const_iterator channelEntry = m_channelEntries.find(std::make_pair(bRadio, option->second));
+ if (channelEntry != m_channelEntries.end() && channelEntry->second == timerChannelID)
+ {
+ m_selectedChannelEntry = option->second;
+ break;
+ }
+ }
+
+ CSettingInt *setting = AddSpinner(group, bRadio ? SETTING_TMR_CHNAME_RADIO : SETTING_TMR_CHNAME_TV, 19078, 0, m_selectedChannelEntry, ChannelNamesOptionsFiller);
+ if (setting == NULL)
+ return NULL;
+
+ // define an enable dependency with tag->m_bIsRadio
+ CSettingDependency depdendencyIsRadio(SettingDependencyTypeEnable, m_settingsManager);
+ depdendencyIsRadio.And()
+ ->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_TMR_RADIO, "true", SettingDependencyOperatorEquals, !bRadio, m_settingsManager)));
+ SettingDependencies deps;
+ deps.push_back(depdendencyIsRadio);
+ setting->SetDependencies(deps);
+
+ return setting;
+}
+
+void CGUIDialogPVRTimerSettings::SetWeekdaySettingFromTimer(const CPVRTimerInfoTag &timer)
+{
+ if (timer.m_bIsRepeating)
+ {
+ if (timer.m_iWeekdays == 0x01)
+ m_tmp_day = 0;
+ else if (timer.m_iWeekdays == 0x02)
+ m_tmp_day = 1;
+ else if (timer.m_iWeekdays == 0x04)
+ m_tmp_day = 2;
+ else if (timer.m_iWeekdays == 0x08)
+ m_tmp_day = 3;
+ else if (timer.m_iWeekdays == 0x10)
+ m_tmp_day = 4;
+ else if (timer.m_iWeekdays == 0x20)
+ m_tmp_day = 5;
+ else if (timer.m_iWeekdays == 0x40)
+ m_tmp_day = 6;
+ else if (timer.m_iWeekdays == 0x1F)
+ m_tmp_day = 7;
+ else if (timer.m_iWeekdays == 0x3F)
+ m_tmp_day = 8;
+ else if (timer.m_iWeekdays == 0x7F)
+ m_tmp_day = 9;
+ else if (timer.m_iWeekdays == 0x60)
+ m_tmp_day = 10;
+ }
+}
+
+void CGUIDialogPVRTimerSettings::SetTimerFromWeekdaySetting(CPVRTimerInfoTag &timer)
+{
+ timer.m_bIsRepeating = true;
+
+ if (m_tmp_day == 0)
+ timer.m_iWeekdays = 0x01;
+ else if (m_tmp_day == 1)
+ timer.m_iWeekdays = 0x02;
+ else if (m_tmp_day == 2)
+ timer.m_iWeekdays = 0x04;
+ else if (m_tmp_day == 3)
+ timer.m_iWeekdays = 0x08;
+ else if (m_tmp_day == 4)
+ timer.m_iWeekdays = 0x10;
+ else if (m_tmp_day == 5)
+ timer.m_iWeekdays = 0x20;
+ else if (m_tmp_day == 6)
+ timer.m_iWeekdays = 0x40;
+ else if (m_tmp_day == 7)
+ timer.m_iWeekdays = 0x1F;
+ else if (m_tmp_day == 8)
+ timer.m_iWeekdays = 0x3F;
+ else if (m_tmp_day == 9)
+ timer.m_iWeekdays = 0x7F;
+ else if (m_tmp_day == 10)
+ timer.m_iWeekdays = 0x60;
+ else
+ timer.m_iWeekdays = 0;
+}
+
+void CGUIDialogPVRTimerSettings::getChannelNames(bool bRadio, std::vector< std::pair<std::string, int> > &list, int &current, bool updateChannelEntries /* = false */)
+{
+ CFileItemList channelsList;
+ g_PVRChannelGroups->GetGroupAll(bRadio)->GetMembers(channelsList);
+
+ int entry = 0;
+ list.push_back(std::make_pair("0 dummy", entry));
+ if (updateChannelEntries)
+ m_channelEntries.insert(std::make_pair(std::make_pair(bRadio, entry), PVR_VIRTUAL_CHANNEL_UID));
+ ++entry;
+
+ for (int i = 0; i < channelsList.Size(); i++)
+ {
+ const CPVRChannel *channel = channelsList[i]->GetPVRChannelInfoTag();
+
+ list.push_back(std::make_pair(StringUtils::Format("%i %s", channel->ChannelNumber(), channel->ChannelName().c_str()), entry));
+ if (updateChannelEntries)
+ m_channelEntries.insert(std::make_pair(std::make_pair(bRadio, entry), channel->ChannelID()));
+ ++entry;
+ }
+}
+
+void CGUIDialogPVRTimerSettings::setButtonLabels()
+{
+ // timer start time
+ BaseSettingControlPtr settingControl = GetSettingControl(SETTING_TMR_BEGIN);
+ if (settingControl != NULL && settingControl->GetControl() != NULL)
+ SET_CONTROL_LABEL2(settingControl->GetID(), m_timerStartTimeStr);
+
+ // timer end time
+ settingControl = GetSettingControl(SETTING_TMR_END);
+ if (settingControl != NULL && settingControl->GetControl() != NULL)
+ SET_CONTROL_LABEL2(settingControl->GetID(), m_timerEndTimeStr);
+}
+
+ bool CGUIDialogPVRTimerSettings::IsTimerDayRepeating(const std::string &condition, const std::string &value, const CSetting *setting)
+ {
+ if (setting == NULL || setting->GetType() != SettingTypeInteger)
+ return false;
+
+ bool result = static_cast<const CSettingInt*>(setting)->GetValue() <= 10;
+ return result == StringUtils::EqualsNoCase(value, "true");
+ }
+
+void CGUIDialogPVRTimerSettings::ChannelNamesOptionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data)
+{
+ if (data == NULL)
+ return;
+
+ CGUIDialogPVRTimerSettings *dialog = static_cast<CGUIDialogPVRTimerSettings*>(data);
+ if (dialog == NULL)
+ return;
+
+ dialog->getChannelNames(setting->GetId() == SETTING_TMR_CHNAME_RADIO, list, current, false);
+}
+
+void CGUIDialogPVRTimerSettings::DaysOptionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data)
+{
+ if (setting == NULL || data == NULL)
+ return;
+
+ CGUIDialogPVRTimerSettings *dialog = static_cast<CGUIDialogPVRTimerSettings*>(data);
+ if (dialog == NULL)
+ return;
+
+ const CPVRTimerInfoTag *tag = dialog->m_timerItem->GetPVRTimerInfoTag();
+ if (tag == NULL)
+ return;
+
+ if (setting->GetId() == SETTING_TMR_DAY)
+ {
+ for (unsigned int iDayPtr = 19086; iDayPtr <= 19096; iDayPtr++)
+ list.push_back(std::make_pair(g_localizeStrings.Get(iDayPtr), list.size()));
+ }
+ else if (setting->GetId() == SETTING_TMR_FIRST_DAY)
+ list.push_back(std::make_pair(g_localizeStrings.Get(19030), 0));
+
+ CDateTime time = CDateTime::GetCurrentDateTime();
+ for (int i = 1; i < 365; ++i)
+ {
+ list.push_back(std::make_pair(time.GetAsLocalizedDate(), list.size()));
+ time += CDateTimeSpan(1, 0, 0, 0);
+ }
+}
diff --git a/src/pvr/dialogs/GUIDialogPVRTimerSettings.h b/src/pvr/dialogs/GUIDialogPVRTimerSettings.h
new file mode 100644
index 0000000000..e233eeb205
--- /dev/null
+++ b/src/pvr/dialogs/GUIDialogPVRTimerSettings.h
@@ -0,0 +1,80 @@
+#pragma once
+/*
+ * Copyright (C) 2012-2014 Team XBMC
+ * http://xbmc.org
+ *
+ * This Program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This Program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with XBMC; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include <map>
+
+#include "XBDateTime.h"
+#include "settings/dialogs/GUIDialogSettingsManualBase.h"
+
+class CFileItem;
+class CSetting;
+class CSettingGroup;
+
+namespace PVR
+{
+ class CPVRTimerInfoTag;
+
+ class CGUIDialogPVRTimerSettings : public CGUIDialogSettingsManualBase
+ {
+ public:
+ CGUIDialogPVRTimerSettings();
+ virtual ~CGUIDialogPVRTimerSettings() { }
+
+ void SetTimer(CFileItem *item);
+
+ protected:
+ // implementations of ISettingCallback
+ virtual void OnSettingChanged(const CSetting *setting);
+ virtual void OnSettingAction(const CSetting *setting);
+
+ // specialization of CGUIDialogSettingsBase
+ virtual bool AllowResettingSettings() const { return false; }
+ virtual void Save();
+ virtual void SetupView();
+
+ // specialization of CGUIDialogSettingsManualBase
+ virtual void InitializeSettings();
+
+ virtual CSetting* AddChannelNames(CSettingGroup *group, bool bRadio);
+ virtual void SetWeekdaySettingFromTimer(const CPVRTimerInfoTag &timer);
+ virtual void SetTimerFromWeekdaySetting(CPVRTimerInfoTag &timer);
+
+ void getChannelNames(bool bRadio, std::vector< std::pair<std::string, int> > &list, int &current, bool updateChannelEntries = false);
+ void setButtonLabels();
+
+ static bool IsTimerDayRepeating(const std::string &condition, const std::string &value, const CSetting *setting);
+
+ static void ChannelNamesOptionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data);
+ static void DaysOptionsFiller(const CSetting *setting, std::vector< std::pair<std::string, int> > &list, int &current, void *data);
+
+ SYSTEMTIME m_timerStartTime;
+ SYSTEMTIME m_timerEndTime;
+ std::string m_timerStartTimeStr;
+ std::string m_timerEndTimeStr;
+ int m_tmp_iFirstDay;
+ int m_tmp_day;
+ bool m_bTimerActive;
+ int m_selectedChannelEntry;
+ std::map<std::pair<bool, int>, int> m_channelEntries;
+
+ CFileItem *m_timerItem;
+ };
+}
diff --git a/src/pvr/dialogs/Makefile b/src/pvr/dialogs/Makefile
new file mode 100644
index 0000000000..675cdbb8d2
--- /dev/null
+++ b/src/pvr/dialogs/Makefile
@@ -0,0 +1,15 @@
+SRCS=GUIDialogPVRChannelManager.cpp \
+ GUIDialogPVRChannelsOSD.cpp \
+ GUIDialogPVRCutterOSD.cpp \
+ GUIDialogPVRDirectorOSD.cpp \
+ GUIDialogPVRGroupManager.cpp \
+ GUIDialogPVRGuideInfo.cpp \
+ GUIDialogPVRGuideOSD.cpp \
+ GUIDialogPVRGuideSearch.cpp \
+ GUIDialogPVRRecordingInfo.cpp \
+ GUIDialogPVRTimerSettings.cpp
+
+LIB=pvrdialogs.a
+
+include ../../../Makefile.include
+-include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS)))