Skip to content
Browse files

[guilib] use SET_CONTROL_LABEL2 and GUI_MSG_SET_TYPE for setting/fetc…

…hing info from edit controls rather than direct access
  • Loading branch information...
1 parent deaf421 commit 8d845b1522674579ab19a31f54eb7d9ac65e08d5 Jonathan Marshall committed
View
17 xbmc/pvr/dialogs/GUIDialogPVRChannelManager.cpp
@@ -288,14 +288,14 @@ bool CGUIDialogPVRChannelManager::OnClickButtonRadioParentalLocked(CGUIMessage &
bool CGUIDialogPVRChannelManager::OnClickButtonEditName(CGUIMessage &message)
{
- CGUIEditControl *pEdit = (CGUIEditControl *)GetControl(EDIT_NAME);
- if (pEdit)
+ 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", pEdit->GetLabel2());
+ pItem->SetProperty("Name", msg.GetLabel());
m_bContainsChanges = true;
return true;
@@ -667,8 +667,6 @@ bool CGUIDialogPVRChannelManager::OnContextButton(int itemNumber, CONTEXT_BUTTON
void CGUIDialogPVRChannelManager::SetData(int iItem)
{
- CGUIEditControl *pEdit;
-
/* Check file item is in list range and get his pointer */
if (iItem < 0 || iItem >= (int)m_channelItems->Size()) return;
@@ -676,12 +674,9 @@ void CGUIDialogPVRChannelManager::SetData(int iItem)
if (!pItem)
return;
- pEdit = (CGUIEditControl *)GetControl(EDIT_NAME);
- if (pEdit)
- {
- pEdit->SetLabel2(pItem->GetProperty("Name").asString());
- pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, 19208);
- }
+ 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());
View
66 xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.cpp
@@ -231,16 +231,19 @@ int CGUIDialogPVRGuideSearch::GetSpinValue(int controlID)
return (int)msg.GetParam1();
}
-void CGUIDialogPVRGuideSearch::OnSearch()
+string CGUIDialogPVRGuideSearch::GetEditValue(int controlID)
{
- CStdString strTmp;
- CGUIEditControl *pEdit;
+ CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), controlID);
+ OnMessage(msg);
+ return msg.GetLabel();
+}
+void CGUIDialogPVRGuideSearch::OnSearch()
+{
if (!m_searchFilter)
return;
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH);
- if (pEdit) m_searchFilter->m_strSearchTerm = pEdit->GetLabel2();
+ 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);
@@ -256,32 +259,21 @@ void CGUIDialogPVRGuideSearch::OnSearch()
m_searchFilter->m_iChannelNumber = GetSpinValue(CONTROL_SPIN_CHANNELS);
m_searchFilter->m_iChannelGroup = GetSpinValue(CONTROL_SPIN_GROUPS);
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_TIME);
- if (pEdit) strTmp = pEdit->GetLabel2();
-
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_DATE);
- if (pEdit) ReadDateTime(pEdit->GetLabel2(), strTmp, m_searchFilter->m_startDateTime);
- strTmp.clear();
-
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_TIME);
- if (pEdit) strTmp = pEdit->GetLabel2();
-
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_DATE);
- if (pEdit) ReadDateTime(pEdit->GetLabel2(), strTmp, m_searchFilter->m_endDateTime);
+ CStdString 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()
{
- CGUIEditControl *pEdit;
-
if (!m_searchFilter)
return;
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH);
- if (pEdit)
+ SET_CONTROL_LABEL2(CONTROL_EDIT_SEARCH, m_searchFilter->m_strSearchTerm);
{
- pEdit->SetLabel2(m_searchFilter->m_strSearchTerm);
- pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TEXT, 16017);
+ 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);
@@ -293,29 +285,25 @@ void CGUIDialogPVRGuideSearch::Update()
SET_CONTROL_SELECTED(GetID(), CONTROL_SPIN_NO_REPEATS, m_searchFilter->m_bPreventRepeats);
/* Set time fields */
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_TIME);
- if (pEdit)
+ SET_CONTROL_LABEL2(CONTROL_EDIT_START_TIME, m_searchFilter->m_startDateTime.GetAsLocalizedTime("", false));
{
- pEdit->SetLabel2(m_searchFilter->m_startDateTime.GetAsLocalizedTime("", false));
- pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TIME, 14066);
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_START_TIME, CGUIEditControl::INPUT_TYPE_TIME, 14066);
+ OnMessage(msg);
}
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_TIME);
- if (pEdit)
+ SET_CONTROL_LABEL2(CONTROL_EDIT_STOP_TIME, m_searchFilter->m_endDateTime.GetAsLocalizedTime("", false));
{
- pEdit->SetLabel2(m_searchFilter->m_endDateTime.GetAsLocalizedTime("", false));
- pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_TIME, 14066);
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_STOP_TIME, CGUIEditControl::INPUT_TYPE_TIME, 14066);
+ OnMessage(msg);
}
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_START_DATE);
- if (pEdit)
+ SET_CONTROL_LABEL2(CONTROL_EDIT_START_DATE, m_searchFilter->m_startDateTime.GetAsDBDate());
{
- pEdit->SetLabel2(m_searchFilter->m_startDateTime.GetAsDBDate());
- pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_DATE, 14067);
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_START_DATE, CGUIEditControl::INPUT_TYPE_DATE, 14067);
+ OnMessage(msg);
}
- pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_STOP_DATE);
- if (pEdit)
+ SET_CONTROL_LABEL2(CONTROL_EDIT_STOP_DATE, m_searchFilter->m_endDateTime.GetAsDBDate());
{
- pEdit->SetLabel2(m_searchFilter->m_endDateTime.GetAsDBDate());
- pEdit->SetInputType(CGUIEditControl::INPUT_TYPE_DATE, 14067);
+ CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CONTROL_EDIT_STOP_DATE, CGUIEditControl::INPUT_TYPE_DATE, 14067);
+ OnMessage(msg);
}
UpdateDurationSpin();
View
1 xbmc/pvr/dialogs/GUIDialogPVRGuideSearch.h
@@ -54,6 +54,7 @@ namespace PVR
bool IsRadioSelected(int controlID);
int GetSpinValue(int controlID);
+ std::string GetEditValue(int controlID);
bool m_bConfirmed;
bool m_bCanceled;

0 comments on commit 8d845b1

Please sign in to comment.
Something went wrong with that request. Please try again.