Esempio n. 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();
	}
}
Esempio n. 2
0
PLIST_ITEM CVCDlg::AddProfile(ProfileNode* pProfile, PLIST_ITEM pItemParent)
{
	if(pProfile == NULL)
	{
		return NULL;
	}
	std::string szText;
	AttribMap* pAttribMap = (AttribMap*)pProfile->GetData();
	if(!pAttribMap->Get(PF_ATTRIB_TAG, szText) || (szText.compare("device") != 0 && szText.compare("profile") != 0))
	{
		return NULL;
	}

	if(!pAttribMap->Get(PF_ATTRIB_DESC, szText))
	{
		cfl::tstring szLog;
		cfl::tformat(szLog, _T("Can't find the [desc] attribute"));
		LOG4CPLUS_INFO_STR(THE_LOGGER, szLog)
		return NULL;
	}
Esempio n. 3
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));
				}
			}
		}
	}
}