void VSCDeviceList::NotifyCameraRecording(int nId, BOOL bRecording) { QTreeWidgetItem *qtreewidgetitem = ui.treeWidget->topLevelItem(VSC_DEVICE_INDEX_IPC); bool setting = false; int cnt = qtreewidgetitem->childCount(); //VDC_DEBUG( "%s cnt %d\n",__FUNCTION__, cnt); for (int i = 0; i < cnt; i ++) { QTreeWidgetItem * pChild = qtreewidgetitem->child(i); VSCDeviceIPC *pIPC = dynamic_cast<VSCDeviceIPC*>(pChild); if (pIPC && pIPC->GetDeviceId() == nId) { pIPC->UpdateRecord(bRecording); setting = true; } } if (setting == false) { /* loop for del to the group */ int cnt = qtreewidgetitem->childCount(); for (int i = 0; i < cnt; i ++) { QTreeWidgetItem * pChild = qtreewidgetitem->child(i); VSCDeviceIPCGroup *pGroup = dynamic_cast<VSCDeviceIPCGroup*>(pChild); if (pGroup) { int cnt2 = pChild->childCount(); //VDC_DEBUG( "%s cnt %d\n",__FUNCTION__, cnt); for (int j = 0; j < cnt2; j ++) { QTreeWidgetItem * pChild2 = pChild->child(j); VSCDeviceIPC *pIPC = dynamic_cast<VSCDeviceIPC*>(pChild2); if (pIPC && pIPC->GetDeviceId() == nId) { pIPC->UpdateRecord(bRecording); setting = true; } } } } } return; }
void VSCDeviceList::AddIPCamera(DeviceParam &pParam, QTreeWidgetItem *qtreewidgetitem) { //QTreeWidgetItem *qtreewidgetitem = ui.treeWidget->topLevelItem(VSC_DEVICE_INDEX_IPC); QIcon icon1; icon1.addFile(QStringLiteral(":/device/resources/dome.png"), QSize(), QIcon::Normal, QIcon::Off); QTreeWidgetItem *qtreewidgetitemChild = new VSCDeviceIPC(qtreewidgetitem, pParam); qtreewidgetitemChild->setIcon(0, icon1); qtreewidgetitemChild->setText(0, QApplication::translate("", pParam.m_Conf.data.conf.Name, 0)); qtreewidgetitem->setExpanded(true); VSCDeviceIPC *pIPC = dynamic_cast<VSCDeviceIPC*>(qtreewidgetitemChild); if (pParam.m_Conf.data.conf.Recording == 1) { pIPC->UpdateRecord(TRUE); }else { pIPC->UpdateRecord(FALSE); } }