void VidStorAdd::SlotNewStor() { VidStor pStor; UUIDGenerator uuidCreator; astring strId = uuidCreator.createRandom().toString(); pStor.set_strid(strId); pStor.set_strname("New Stor"); pStor.set_strip("192.168.0.1"); pStor.set_strport("9080"); pStor.set_struser("admin"); pStor.set_strpasswd("admin"); int insertRow = ui.tableWidget->rowCount(); 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())); ui.tableWidget->selectRow(insertRow); emit(SignalSectionClicked(insertRow, 0)); }
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())); } }
void VidStorAdd::GetStorUI(VidStor &pStor) { pStor.set_strname(ui.lineEditName->text().toStdString()); pStor.set_strip(ui.lineEditIP->text().toStdString()); pStor.set_strport(ui.lineEditPort->text().toStdString()); pStor.set_struser(ui.lineEditUser->text().toStdString()); pStor.set_strpasswd(ui.lineEditPassword->text().toStdString()); }
void VidStorAdd::SetStorUI(VidStor pStor) { ui.lineEditName->setText(pStor.strname().c_str()); ui.lineEditIP->setText(pStor.strip().c_str()); ui.lineEditPort->setText(pStor.strport().c_str()); ui.lineEditUser->setText(pStor.struser().c_str()); ui.lineEditPassword->setText(pStor.strpasswd().c_str()); }
inline bool StorFactory::InitAddStor(VidStor &pStor) { StorFactoryNotifyInterface &pNotify = *this; m_StorClientMap[pStor.strid()] = new StorClient(pStor, pNotify); m_StorClientOnlineMap[pStor.strid()] = false; 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)); } }
inline bool StorFactory::AddStor(VidStor & pParam) { XGuard guard(m_cMutex); StorFactoryChangeData change; if (m_pConf.FindStor(pParam.strid())) { m_pConf.DeleteStor(pParam.strid()); /* Call Change */ change.cId.set_strstorid(pParam.strid()); change.type = STOR_FACTORY_STOR_DEL; guard.Release(); CallChange(change); guard.Acquire(); delete m_StorClientMap[pParam.strid()]; m_StorClientMap[pParam.strid()] = NULL; m_StorClientMap.erase(pParam.strid()); m_StorClientOnlineMap.erase(pParam.strid()); } /* Add */ m_pConf.AddStor(pParam); InitAddStor(pParam); /* Call Change */ change.cId.set_strstorid(pParam.strid()); change.type = STOR_FACTORY_STOR_ADD; guard.Release(); CallChange(change); guard.Acquire(); return true; }