MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / AddItem

Method AddItem

Plugins/WakeOnLan/WakeOnLanModel.cpp:190–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190int CWakeOnLanModel::AddItem(QSharedPointer<CParameterWakeOnLan> para)
191{
192 if(!para)
193 return -1;
194 QString szIp = para->m_Net.GetHost();
195 if(szIp.isEmpty()) {
196 qCritical(log) << "The ip is empty";
197 return -1;
198 }
199 foreach(auto p, m_Data)
200 {
201 if(p->m_Net.GetHost() == szIp){
202 qDebug(log) << szIp << "is existed";
203 return 0;
204 }
205 }
206 bool check = connect(para.data(), SIGNAL(sigHostStateChanged()),
207 this, SLOT(slotHostStateChanged()));
208 Q_ASSERT(check);
209 beginResetModel();
210 m_Data.push_back(para);
211 endResetModel();
212 return 0;
213}
214
215bool CWakeOnLanModel::removeRows(int row, int count, const QModelIndex &parent)
216{

Callers 1

slotAddMethod · 0.45

Calls 3

GetHostMethod · 0.80
isEmptyMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected