void VidStorAdd::TreeWidgetUpdate() { VidStorList storList; m_pFactory.GetConfDB().GetStorListConf(storList); int storSize = storList.cvidstor_size(); int nRowCnt = ui.tableWidget->rowCount(); for (s32 j = nRowCnt - 1; j >= 0; j --) { ui.tableWidget->removeRow(j); } ui.tableWidget->clear(); ui.tableWidget->clearSpans(); for (s32 i = 0; i < storList.cvidstor_size(); i ++) { VidStor pStor = storList.cvidstor(i); //int insertRow = ui.tableWidget->rowCount(); int insertRow = i; ui.tableWidget->insertRow(insertRow); QTableWidgetItem *firstCheck = new VidStorTableItem(pStor, false); firstCheck->setCheckState(Qt::Checked); ui.tableWidget->setItem(insertRow, 0, firstCheck); ui.tableWidget->setItem(insertRow, 1, new QTableWidgetItem(pStor.strname().c_str())); ui.tableWidget->setItem(insertRow, 2, new QTableWidgetItem(pStor.strip().c_str())); ui.tableWidget->setItem(insertRow, 3, new QTableWidgetItem(pStor.struser().c_str())); } }
inline BOOL StorFactory::Init() { /* Loop add the stor */ VidStorList storList; m_pConf.GetStorListConf(storList); int storSize = storList.cvidstor_size(); for (s32 i = 0; i < storList.cvidstor_size(); i ++) { VidStor pStor = storList.cvidstor(i); InitAddStor(pStor); } return TRUE; }
inline bool ClientConfDB::FindStor(astring strStorId) { XGuard guard(m_cMutex); VidStorList storList; GetStorListConf(storList); int storSize = storList.cvidstor_size(); for (s32 i = 0; i < storList.cvidstor_size(); i ++) { const VidStor &stor = storList.cvidstor(i); if (stor.strid() == strStorId) { return true; } } return false; }
inline bool ClientConfDB::DeleteStor(astring strStorId) { XGuard guard(m_cMutex); VidStorList storList; VidStorList storListNew; GetStorListConf(storList); int storSize = storList.cvidstor_size(); for (s32 i = 0; i < storList.cvidstor_size(); i ++) { const VidStor &stor = storList.cvidstor(i); if (stor.strid() != strStorId) { VidStor *pAddStor = storListNew.add_cvidstor(); *pAddStor = stor; } } UpdateStorListConf(storListNew); return true; }
void VSCVidTreeCam::TreeUpdate() { /* Delete all the child */ qDeleteAll(m_pRoot->takeChildren()); VidStorList storList; m_pFactory.GetConfDB().GetStorListConf(storList); int storSize = storList.cvidstor_size(); for (s32 i = 0; i < storList.cvidstor_size(); i ++) { VidStor pStor = storList.cvidstor(i); VSCVidItemVidStor *pItemStor = new VSCVidItemVidStor(pStor, m_pFactory, m_pRoot); QIcon icon1; icon1.addFile(QStringLiteral(":/device/resources/computer.png"), QSize(), QIcon::Normal, QIcon::Off); pItemStor->setIcon(0, icon1); pItemStor->setText(0, QApplication::translate(" ", pStor.strname().c_str(), 0)); } }