Exemple #1
0
void CVCDlg::InitDeviceComboBox()
{
	ProfileNode* pRoot = ProfileMgr::GetInstance()->GetRootProfile();
	int nChildCount = ((pRoot == NULL) ? 0 : pRoot->GetChildCount());

	std::string szText;
	AttribMap* pAttribMap = NULL;
	for(int i = 0; i < nChildCount; i++)
	{
		ProfileNode* pProfile = (ProfileNode*)pRoot->GetChild(i);

		pAttribMap = (AttribMap*)pProfile->GetData();
		if(!pAttribMap->Get(PF_ATTRIB_DESC, szText))
		{
			pAttribMap->Get(PF_ATTRIB_NAME, szText);
		}
		LIST_ITEM item;
		item.strText = CFL_A2T(szText.c_str());
		item.vpItemData = pProfile;
		m_deviceComboBox.AddItem(&item);
	}

	if(nChildCount > 0)
	{
		m_deviceComboBox.SetCurSel(0);
		OnCategorySelChanged();
	}
}
Exemple #2
0
void CVCDlg::OnProfileSelChanged()
{
	int nCurSel = m_profileComboBox.GetCurSel();
	if(nCurSel >= 0)
	{
		ProfileNode* pProfile = (ProfileNode*)m_profileComboBox.GetItemDataPtr(nCurSel);
		AttribMap* pAttribMap = NULL;
		std::string szProfileFile;
		if(pProfile != NULL)
		{
			pAttribMap = (AttribMap*)pProfile->GetData();
			if(pAttribMap->Get(PF_ATTRIB_FILE, szProfileFile))
			{
				//Initialize the profile tree firstly
				CString szPath;
				if(SysUtils::GetProfile(szPath, CFL_A2T(szProfileFile.c_str())))
				{
					m_propListMgr.Init(CFL_T2A((LPCTSTR)szPath));
				}
			}
		}
	}
}