CGUIControlEditSetting::CGUIControlEditSetting(CGUIEditControl *pEdit, int id, CSetting *pSetting) : CGUIControlBaseSetting(id, pSetting) { m_pEdit = pEdit; m_pEdit->SetID(id); int heading = m_pSetting->GetLabel(); if (m_pSetting->GetType() == SettingTypeString) { CSettingString *pSettingString = (CSettingString *)m_pSetting; if (pSettingString->GetHeading() > 0) heading = pSettingString->GetHeading(); } if (heading < 0) heading = 0; CGUIEditControl::INPUT_TYPE inputType = CGUIEditControl::INPUT_TYPE_TEXT; const CSettingControl& control = pSetting->GetControl(); switch (control.GetFormat()) { case SettingControlFormatString: if (control.GetAttributes() & SettingControlAttributeHidden) inputType = CGUIEditControl::INPUT_TYPE_PASSWORD; break; case SettingControlFormatInteger: if (control.GetAttributes() & SettingControlAttributeVerifyNew) inputType = CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW; else inputType = CGUIEditControl::INPUT_TYPE_NUMBER; break; case SettingControlFormatIP: inputType = CGUIEditControl::INPUT_TYPE_IPADDRESS; break; case SettingControlFormatMD5: inputType = CGUIEditControl::INPUT_TYPE_PASSWORD_MD5; break; default: break; } m_pEdit->SetInputType(inputType, heading); Update(); // this will automatically trigger validation so it must be executed after // having set the value of the control based on the value of the setting m_pEdit->SetInputValidation(InputValidation, this); }
CGUIControlEditSetting::CGUIControlEditSetting(CGUIEditControl *pEdit, int id, CSetting *pSetting) : CGUIControlBaseSetting(id, pSetting) { m_pEdit = pEdit; m_pEdit->SetID(id); int heading = m_pSetting->GetLabel(); if (m_pSetting->GetType() == SettingTypeString) { CSettingString *pSettingString = (CSettingString *)m_pSetting; if (pSettingString->GetHeading() > 0) heading = pSettingString->GetHeading(); } if (heading < 0) heading = 0; CGUIEditControl::INPUT_TYPE inputType = CGUIEditControl::INPUT_TYPE_TEXT; const CSettingControl& control = pSetting->GetControl(); switch (control.GetFormat()) { case SettingControlFormatString: if (control.GetAttributes() & SettingControlAttributeHidden) inputType = CGUIEditControl::INPUT_TYPE_PASSWORD; break; case SettingControlFormatInteger: if (control.GetAttributes() & SettingControlAttributeVerifyNew) inputType = CGUIEditControl::INPUT_TYPE_PASSWORD_NUMBER_VERIFY_NEW; else inputType = CGUIEditControl::INPUT_TYPE_NUMBER; break; case SettingControlFormatIP: inputType = CGUIEditControl::INPUT_TYPE_IPADDRESS; break; case SettingControlFormatMD5: inputType = CGUIEditControl::INPUT_TYPE_PASSWORD_MD5; break; default: break; } m_pEdit->SetInputType(inputType, heading); Update(); }