void CGUIDialogNetworkSetup::OnProtocolChange() { CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(CONTROL_PROTOCOL); if (!pSpin) return; m_protocol = (NET_PROTOCOL)pSpin->GetValue(); // set defaults for the port if (m_protocol == NET_PROTOCOL_FTP) m_port = "21"; else if (m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_TUXBOX || m_protocol == NET_PROTOCOL_DAV) m_port = "80"; else if (m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAVS) m_port = "443"; else if (m_protocol == NET_PROTOCOL_DAAP) m_port = "3689"; else if (m_protocol == NET_PROTOCOL_HTSP) m_port = "9982"; else if (m_protocol == NET_PROTOCOL_VTP) m_port = "2004"; else if (m_protocol == NET_PROTOCOL_MYTH) m_port = "6543"; else if (m_protocol == NET_PROTOCOL_SFTP) m_port = "22"; else m_port = "0"; UpdateButtons(); }
void CGUIDialogPVRGuideSearch::UpdateChannelSpin(void) { CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_CHANNELS); CGUISpinControlEx *pSpinGroups = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS); if (!pSpin || !pSpinGroups) return; int iChannelGroup = pSpin->GetValue(); pSpin->Clear(); pSpin->AddLabel(g_localizeStrings.Get(19217), EPG_SEARCH_UNSET); int iGroupId = (iChannelGroup == EPG_SEARCH_UNSET) ? XBMC_INTERNAL_GROUP_TV : iChannelGroup; CPVRChannelGroupPtr group = g_PVRChannelGroups->GetByIdFromAll(iGroupId); if (!group) group = g_PVRChannelGroups->GetGroupAllTV(); for (int iChannelPtr = 0; iChannelPtr < group->Size(); iChannelPtr++) { CFileItemPtr channel = group->GetByIndex(iChannelPtr); if (!channel || !channel->HasPVRChannelInfoTag()) continue; int iChannelNumber = group->GetChannelNumber(*channel->GetPVRChannelInfoTag()); pSpin->AddLabel(channel->GetPVRChannelInfoTag()->ChannelName().c_str(), iChannelNumber); } }
void CGUIDialogSettings::OnClick(int iID) { if (iID == CONTROL_OKAY_BUTTON) { OnOkay(); Close(); return; } if (iID == CONTROL_CANCEL_BUTTON) { OnCancel(); Close(); return; } unsigned int settingNum = iID - CONTROL_START; if (settingNum >= m_settings.size()) return; SettingInfo &setting = m_settings.at(settingNum); if (setting.type == SettingInfo::SPIN) { CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID); if (setting.data) *(int *)setting.data = pControl->GetValue(); } else if (setting.type == SettingInfo::CHECK) { CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID); if (setting.data) *(bool *)setting.data = pControl->IsSelected(); } else if (setting.type == SettingInfo::CHECK_UCHAR) { CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID); if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0; } else if (setting.type == SettingInfo::SLIDER) { CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID); if (setting.data) *(float *)setting.data = pControl->GetFloatValue(); if (setting.formatFunction) pControl->SetTextValue(setting.formatFunction(pControl->GetFloatValue(), setting.interval)); } else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data) { // we're using popup sliders CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting); if (setting.formatFunction) SET_CONTROL_LABEL2(iID, setting.formatFunction(*(float *)setting.data, setting.interval)); } else if (setting.type == SettingInfo::STRING) { CGUIDialogKeyboard::ShowAndGetInput(*(CStdString *) setting.data, true); string strNewValue = string(*(CStdString *)setting.data); if (strNewValue.empty()) strNewValue = "-"; SET_CONTROL_LABEL2(iID, strNewValue); } OnSettingChanged(setting); }
void CGUIDialogVisualisationSettings::OnClick(int iID) { if (!m_pSettings || !m_pVisualisation) return; unsigned int settingNum = iID - CONTROL_START; if (settingNum >= m_pSettings->size()) return; VisSetting &setting = m_pSettings->at(settingNum); if (setting.type == VisSetting::SPIN) { CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID); setting.current = pControl->GetValue(); } else if (setting.type == VisSetting::CHECK) { CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID); setting.current = pControl->IsSelected() ? 1 : 0; } m_pVisualisation->UpdateSetting(settingNum); UpdateSettings(); }
void CGUIDialogNetworkSetup::OnProtocolChange() { CGUISpinControlEx *pSpin = (CGUISpinControlEx *)GetControl(CONTROL_PROTOCOL); if (!pSpin) return; m_protocol = (NET_PROTOCOL)pSpin->GetValue(); // set defaults for the port if (m_protocol == NET_PROTOCOL_FTP) m_port = "21"; if (m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_RSS) m_port = "80"; if (m_protocol == NET_PROTOCOL_HTTPS) m_port = "443"; if (m_protocol == NET_PROTOCOL_TUXBOX) m_port = "80"; else if (m_protocol == NET_PROTOCOL_XBMSP) m_port = "1400"; else if (m_protocol == NET_PROTOCOL_DAAP) m_port = "3689"; UpdateButtons(); }
void CGUIDialogPVRGuideSearch::OnSearch() { CStdString strTmp; CGUISpinControlEx *pSpin; CGUIEditControl *pEdit; CGUIRadioButtonControl *pRadioButton; if (!m_searchFilter) return; pEdit = (CGUIEditControl *)GetControl(CONTROL_EDIT_SEARCH); if (pEdit) m_searchFilter->m_strSearchTerm = pEdit->GetLabel2(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_INC_DESC); if (pRadioButton) m_searchFilter->m_bSearchInDescription = pRadioButton->IsSelected(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_CASE_SENS); if (pRadioButton) m_searchFilter->m_bIsCaseSensitive = pRadioButton->IsSelected(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_FTA_ONLY); if (pRadioButton) m_searchFilter->m_bFTAOnly = pRadioButton->IsSelected(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_UNK_GENRE); if (pRadioButton) m_searchFilter->m_bIncludeUnknownGenres = pRadioButton->IsSelected(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_REC); if (pRadioButton) m_searchFilter->m_bIgnorePresentRecordings = pRadioButton->IsSelected(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_BTN_IGNORE_TMR); if (pRadioButton) m_searchFilter->m_bIgnorePresentTimers = pRadioButton->IsSelected(); pRadioButton = (CGUIRadioButtonControl *)GetControl(CONTROL_SPIN_NO_REPEATS); if (pRadioButton) m_searchFilter->m_bPreventRepeats = pRadioButton->IsSelected(); pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GENRE); if (pSpin) m_searchFilter->m_iGenreType = pSpin->GetValue(); pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MIN_DURATION); if (pSpin) m_searchFilter->m_iMinimumDuration = pSpin->GetValue(); pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_MAX_DURATION); if (pSpin) m_searchFilter->m_iMaximumDuration = pSpin->GetValue(); pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_CHANNELS); if (pSpin) m_searchFilter->m_iChannelNumber = pSpin->GetValue(); pSpin = (CGUISpinControlEx *)GetControl(CONTROL_SPIN_GROUPS); if (pSpin) m_searchFilter->m_iChannelGroup = pSpin->GetValue(); 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); }
void CGUIDialogSettings::OnClick(int iID) { if (iID == CONTROL_OKAY_BUTTON) { OnOkay(); Close(); return; } if (iID == CONTROL_CANCEL_BUTTON) { OnCancel(); Close(); return; } unsigned int settingNum = iID - CONTROL_START; if (settingNum >= m_settings.size()) return; SettingInfo &setting = m_settings.at(settingNum); if (setting.type == SettingInfo::SPIN) { CGUISpinControlEx *pControl = (CGUISpinControlEx *)GetControl(iID); if (setting.data) *(int *)setting.data = pControl->GetValue(); } else if (setting.type == SettingInfo::BUTTON_DIALOG) { CGUIButtonControl *pControl = (CGUIButtonControl *)GetControl(iID); if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2(); } else if (setting.type == SettingInfo::EDIT) { CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID); if (setting.data) *(CStdString *)setting.data = pControl->GetLabel2(); } else if (setting.type == SettingInfo::EDIT_NUM) { CGUIEditControl *pControl = (CGUIEditControl *)GetControl(iID); if (setting.data) { CStdString strIndex = pControl->GetLabel2(); *(int *)setting.data = atol(strIndex.c_str()); } } else if (setting.type == SettingInfo::CHECK) { CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID); if (setting.data) *(bool *)setting.data = pControl->IsSelected(); } else if (setting.type == SettingInfo::CHECK_UCHAR) { CGUIRadioButtonControl *pControl = (CGUIRadioButtonControl *)GetControl(iID); if (setting.data) *(unsigned char*)setting.data = pControl->IsSelected() ? 1 : 0; } else if (setting.type == SettingInfo::SLIDER) { CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID); if (setting.data) *(float *)setting.data = pControl->GetFloatValue(); if (setting.formatFunction.standard) pControl->SetTextValue(setting.formatFunction.standard(pControl->GetFloatValue(), setting.interval)); } else if (setting.type == SettingInfo::BUTTON && m_usePopupSliders && setting.data) { // we're using popup sliders CGUIDialogSlider::ShowAndGetInput(setting.name, *(float *)setting.data, setting.min, setting.interval, setting.max, this, &setting); if (setting.formatFunction.standard) SET_CONTROL_LABEL2(iID, setting.formatFunction.standard(*(float *)setting.data, setting.interval)); } else if (setting.type == SettingInfo::STRING) { CGUIKeyboardFactory::ShowAndGetInput(*(CStdString *) setting.data, true); string strNewValue = string(*(CStdString *)setting.data); if (strNewValue.empty()) strNewValue = "-"; SET_CONTROL_LABEL2(iID, strNewValue); } else if (setting.type == SettingInfo::RANGE) { CGUISettingsSliderControl *pControl = (CGUISettingsSliderControl *)GetControl(iID); if (setting.data) { *((float **)setting.data)[0] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower); *((float **)setting.data)[1] = pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper); } if (setting.formatFunction.range) pControl->SetTextValue(setting.formatFunction.range(pControl->GetFloatValue(CGUISliderControl::RangeSelectorLower), pControl->GetFloatValue(CGUISliderControl::RangeSelectorUpper), setting.interval)); } OnSettingChanged(setting); }