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 VSCDeviceTree::CameraStopRecordClick() { QTreeWidgetItem *item = NULL; item = currentItem(); VDC_DEBUG( "%s Stop Record\n",__FUNCTION__); if(item != NULL) { VSCDeviceIPC *pIpc = dynamic_cast<VSCDeviceIPC * >(item); if (pIpc) { VDC_DEBUG( "%s Stop Record\n",__FUNCTION__); u32 nId = pIpc->GetDeviceId(); gFactory->StopRecord(nId); } } return; }
void VSCDeviceTree::CameraDeleteClick() { QTreeWidgetItem *item = NULL; item = currentItem(); VDC_DEBUG( "%s \n",__FUNCTION__); if(item != NULL) { VSCDeviceIPC *pIpc = dynamic_cast<VSCDeviceIPC * >(item); if (pIpc) { VDC_DEBUG( "%s \n",__FUNCTION__); u32 nId = pIpc->GetDeviceId(); emit CameraDeleteClicked(nId); } } return; }
void VSCDeviceList::NotifyDelCamera(int nId) { #if 0 QTreeWidgetItem *qtreewidgetitem = ui.treeWidget->topLevelItem(VSC_DEVICE_INDEX_IPC); 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) { qtreewidgetitem->removeChild(pChild); } } #else DelIPCameraByGroup(nId); #endif return; }
void VSCDeviceTree::mousePressEvent(QMouseEvent *event) { VDC_DEBUG( "%s \n",__FUNCTION__); // Get current selection QTreeWidgetItem *selectedItem = currentItem(); if (event->buttons() & Qt::RightButton) { return; } // If the selected Item exists if (selectedItem) { VSCDeviceIPC *pIpc = dynamic_cast<VSCDeviceIPC * >(selectedItem); //VSCDeviceIPC *pIpc = (VSCDeviceIPC * )(selectedItem); // Create data if (pIpc) { u32 nId = pIpc->GetDeviceId(); VDC_DEBUG( "%s id %d\n",__FUNCTION__, nId); QMimeData *mimeData = new QMimeData(); mimeData->setText(QString::number(nId)); // Create drag QPixmap pixmap(":/device/resources/camera1.png"); QPainter painter(&pixmap); QDrag *drag = new QDrag(this); drag->setMimeData(mimeData); drag->setPixmap(pixmap); drag->setHotSpot(QPoint(drag->pixmap().width()/2, drag->pixmap().height()/2)); drag->exec(); } } QTreeWidget::mousePressEvent(event); }
void VSCDeviceList::DelIPCameraByGroup(s32 nId) { DeviceParam pParam; QTreeWidgetItem *qtreewidgetitem = ui.treeWidget->topLevelItem(VSC_DEVICE_INDEX_IPC); bool deled = false; gFactory->GetDeviceParamById(pParam, nId); if (pParam.m_Conf.data.conf.GroupId == 0) { 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) { qtreewidgetitem->removeChild(pChild); deled = true; } } } if (deled == 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) { pChild->removeChild(pChild2); deled = true; } } } } } if (deled == 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) { qtreewidgetitem->removeChild(pChild); deled = true; } } } return; }