本文整理汇总了C++中KviPointerList::append方法的典型用法代码示例。如果您正苦于以下问题:C++ KviPointerList::append方法的具体用法?C++ KviPointerList::append怎么用?C++ KviPointerList::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KviPointerList
的用法示例。
在下文中一共展示了KviPointerList::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deleteCurrent
void LogViewWindow::deleteCurrent()
{
LogListViewItem * pItem = (LogListViewItem *)(m_pListView->currentItem());
if(!pItem)
return;
if(!pItem->childCount())
{
if(!pItem->fileName().isNull())
{
if(QMessageBox::question(
this,
__tr2qs_ctx("Confirm Current User Log Deletion","log"),
__tr2qs_ctx("Do you really wish to delete this log?","log"),
__tr2qs("Yes"),__tr2qs("No"),0,1) != 0)
return;
KviFileUtils::removeFile(pItem->fileName());
delete pItem;
m_pIrcView->clearBuffer();
if(!pItem->parent()->childCount())
delete pItem->parent();
}
return;
}
if(QMessageBox::question(
this,
__tr2qs_ctx("Confirm Current User Logs Deletion","log"),
__tr2qs_ctx("Do you really wish to delete all these logs?","log"),
__tr2qs("Yes"),__tr2qs("No"),0,1) != 0)
return;
KviPointerList<LogListViewItem> itemsList;
itemsList.setAutoDelete(false);
for(int i=0; i < pItem->childCount(); i++)
{
if(!pItem->child(i)->childCount())
{
itemsList.append((LogListViewItem *)pItem->child(i));
continue;
}
LogListViewItem * pChild = (LogListViewItem *)pItem->child(i);
for(int j=0; j < pChild->childCount(); j++)
{
if(!(LogListViewItem *)pChild->child(j))
{
qDebug("Null pointer in logviewitem");
continue;
}
itemsList.append((LogListViewItem *)pChild->child(j));
}
}
for(unsigned int u=0; u < itemsList.count(); u++)
{
LogListViewItem * pCurItem = itemsList.at(u);
if(!pCurItem->fileName().isNull())
KviFileUtils::removeFile(pCurItem->fileName());
}
delete pItem;
}
示例2: cleanupUnusedModules
void KviModuleManager::cleanupUnusedModules()
{
KviPointerHashTableIterator<QString,KviModule> it(*m_pModuleDict);
KviPointerList<KviModule> lModulesToUnload;
lModulesToUnload.setAutoDelete(false);
while(it.current())
{
if(it.current()->secondsSinceLastAccess() > KVI_OPTION_UINT(KviOption_uintModuleCleanupTimeout))
{
if(it.current()->moduleInfo()->can_unload)
{
if((it.current()->moduleInfo()->can_unload)(it.current()))
lModulesToUnload.append(it.current());
else {
// the module don't want to be unloaded
// keep it memory for a while
it.current()->updateAccessTime();
}
} else {
if(!(it.current()->isLocked()))
lModulesToUnload.append(it.current());
}
}
++it;
}
for(KviModule * pModule = lModulesToUnload.first();pModule;pModule = lModulesToUnload.next())
unloadModule(pModule);
}
示例3: removeAllScriptRawHandlers
void KviKvsEventManager::removeAllScriptRawHandlers()
{
for(auto & i : m_rawEventTable)
{
if(i)
{
KviPointerList<KviKvsEventHandler> dl;
dl.setAutoDelete(false);
KviKvsEventHandler * e;
for(e = i->first(); e; e = i->next())
{
if(e->type() == KviKvsEventHandler::Script)
dl.append(e);
}
for(e = dl.first(); e; e = dl.next())
{
i->removeRef(e);
}
if(i->isEmpty())
{
delete i;
i = nullptr;
}
}
}
}
示例4: removeAllModuleRawHandlers
void KviKvsEventManager::removeAllModuleRawHandlers(KviKvsModuleInterface * pIface)
{
KviKvsEventHandler * h;
for(auto & i : m_rawEventTable)
{
if(!i)
continue;
KviPointerList<KviKvsEventHandler> l;
l.setAutoDelete(false);
for(h = i->first(); h; h = i->next())
{
if(h->type() == KviKvsEventHandler::Module)
{
if(((KviKvsModuleEventHandler *)h)->moduleInterface() == pIface)
{
l.append(h);
}
}
}
for(h = l.first(); h; h = l.next())
i->removeRef(h);
if(i->isEmpty())
{
delete i;
i = nullptr;
}
}
}
示例5: removeAllScriptRawHandlers
void KviKvsEventManager::removeAllScriptRawHandlers()
{
for(int i=0;i< KVI_KVS_NUM_RAW_EVENTS;i++)
{
if(m_rawEventTable[i])
{
KviPointerList<KviKvsEventHandler> dl;
dl.setAutoDelete(false);
KviKvsEventHandler * e;
for(e = m_rawEventTable[i]->first();e;e = m_rawEventTable[i]->next())
{
if(e->type() == KviKvsEventHandler::Script)dl.append(e);
}
for(e = dl.first();e;e = dl.next())
{
m_rawEventTable[i]->removeRef(e);
}
if(m_rawEventTable[i]->isEmpty())
{
delete m_rawEventTable[i];
m_rawEventTable[i] = 0;
}
}
}
}
示例6: killAllObjectsWithClass
void KviKvsObjectController::killAllObjectsWithClass(KviKvsObjectClass * pClass)
{
if(!m_pObjectDict)
return; // no more objects at all...
KviPointerList< QPointer<KviKvsObject> > lDying;
lDying.setAutoDelete(true);
KviKvsObject * pObject;
for(pObject = m_pTopLevelObjectList->first();pObject;pObject = m_pTopLevelObjectList->next())
{
if(pObject->getClass() == pClass)
{
lDying.append(new QPointer<KviKvsObject>(pObject));
} else {
pObject->killAllChildrenWithClass(pClass);
}
}
for(QPointer<KviKvsObject> * pObject = lDying.first();pObject;pObject = lDying.next())
{
if(pObject->isNull())
continue; // already dead ?
(*pObject)->dieNow();
}
}
示例7: load
void KviKvsAliasManager::load(const QString & filename)
{
m_pAliasDict->clear();
KviConfigurationFile cfg(filename,KviConfigurationFile::Read);
KviConfigurationFileIterator it(*(cfg.dict()));
KviPointerList<QString> l;
l.setAutoDelete(true);
while(it.current())
{
l.append(new QString(it.currentKey()));
++it;
}
for(QString * s = l.first();s;s = l.next())
{
cfg.setGroup(*s);
QString szCode = cfg.readEntry("_Buffer","");
if(!szCode.isEmpty())
{
KviKvsScript * m = new KviKvsScript(*s,szCode);
m_pAliasDict->insert(*s,m);
}
++it;
}
}
示例8: removeAllModuleAppHandlers
void KviKvsEventManager::removeAllModuleAppHandlers(KviKvsModuleInterface *pIface)
{
KviKvsEventHandler * h;
for(unsigned int i =0;i< KVI_KVS_NUM_APP_EVENTS;i++)
{
if(!m_appEventTable[i].handlers())continue;
KviPointerList<KviKvsEventHandler> l;
l.setAutoDelete(false);
for(h = m_appEventTable[i].handlers()->first();h;h = m_appEventTable[i].handlers()->next())
{
if(h->type() == KviKvsEventHandler::Module)
{
if(((KviKvsModuleEventHandler *)h)->moduleInterface() == pIface)
{
l.append(h);
}
}
// COMPAT
/*
} else if(h->type() == KviKvsEventHandler::OldModule)
{
if(((KviKvsOldModuleEventHandler *)h)->module() == pIface)
{
l.append(h);
}
}
*/
// END COMPAT
}
for(h = l.first();h;h = l.next())m_appEventTable[i].removeHandler(h);
}
}
示例9: unregisterExtensionsByModule
void KviModuleExtensionManager::unregisterExtensionsByModule(KviModule * m)
{
KviPointerHashTableIterator<const char *,KviModuleExtensionDescriptorList> it(*m_pExtensionDict);
KviPointerList<KviCString> dying;
dying.setAutoDelete(true);
while(KviModuleExtensionDescriptorList * l = it.current())
{
KviPointerList<KviModuleExtensionDescriptor> dying2;
dying2.setAutoDelete(true);
for(KviModuleExtensionDescriptor * d = l->first();d;d = l->next())
{
if(d->module() == m)dying2.append(d);
}
for(KviModuleExtensionDescriptor * de = dying2.first();de;de = dying2.next())
{
l->removeRef(de);
}
if(l->isEmpty())dying.append(new KviCString(it.currentKey()));
++it;
}
for(KviCString * li = dying.first();li;li = dying.next())
{
m_pExtensionDict->remove(li->ptr());
}
}
示例10: exportLog
void LogViewWindow::exportLog(int iId)
{
LogListViewItem * pItem = (LogListViewItem *)(m_pListView->currentItem());
if(!pItem)
return;
if(!pItem->childCount())
{
// Export the log
createLog(pItem->log(), iId);
return;
}
// We selected a node in the log list, scan the children
KviPointerList<LogListViewItem> logList;
logList.setAutoDelete(false);
for(int i = 0; i < pItem->childCount(); i++)
{
if(!pItem->child(i)->childCount())
{
// The child is a log file, append it to the list
logList.append((LogListViewItem *)pItem->child(i));
continue;
}
// The child is a node, scan it
LogListViewItem * pChild = (LogListViewItem *)pItem->child(i);
for(int j=0; j < pChild->childCount(); j++)
{
if(!(LogListViewItem *)pChild->child(j))
{
qDebug("Null pointer in logviewitem");
continue;
}
// Add the child to the list
logList.append((LogListViewItem *)pChild->child(j));
}
}
// Scan the list
for(unsigned int u = 0; u < logList.count(); u++)
{
LogListViewItem * pCurItem = logList.at(u);
createLog(pCurItem->log(), iId);
}
}
示例11: cleanup
void KviSharedFilesManager::cleanup()
{
KviPointerHashTableIterator<QString, KviSharedFileList> it(*m_pSharedListDict);
time_t curTime = time(nullptr);
bool bOtherStuffToCleanup = false;
KviPointerList<QString> lDying;
lDying.setAutoDelete(true);
while(KviSharedFileList * l = it.current())
{
KviPointerList<KviSharedFile> tmp;
tmp.setAutoDelete(false);
for(KviSharedFile * o = l->first(); o; o = l->next())
{
if(o->expireTime() > 0)
{
if(((int)o->expireTime()) <= ((int)curTime))
{
tmp.append(o);
}
else
{
bOtherStuffToCleanup = true;
}
}
}
for(KviSharedFile * fo = tmp.first(); fo; fo = tmp.next())
{
l->removeRef(fo);
emit sharedFileRemoved(fo);
}
if(l->count() == 0)
lDying.append(new QString(it.currentKey()));
++it;
}
for(QString * pDyingKey = lDying.first(); pDyingKey; pDyingKey = lDying.next())
m_pSharedListDict->remove(*pDyingKey);
if(!bOtherStuffToCleanup)
m_pCleanupTimer->stop();
}
示例12: removeClicked
void KviChannelListSelector::removeClicked()
{
KviPointerList<QTreeWidgetItem> lst;
QList<QTreeWidgetItem *> items=m_pTreeWidget->selectedItems () ;
for (int i=0;i<items.count();i++)
{
lst.append((QTreeWidgetItem *)items.at(i));
}
lst.setAutoDelete(true);
lst.clear();
}
示例13: theme_kvs_cmd_pack
static bool theme_kvs_cmd_pack(KviKvsModuleCommandCall * c)
{
QString szPath, szName, szVersion, szDescription, szAuthor, szImage;
KviKvsArrayCast aCast;
KVSM_PARAMETERS_BEGIN(c)
KVSM_PARAMETER("package_path", KVS_PT_NONEMPTYSTRING, 0, szPath)
KVSM_PARAMETER("package_name", KVS_PT_NONEMPTYSTRING, 0, szName)
KVSM_PARAMETER("package_version", KVS_PT_NONEMPTYSTRING, 0, szVersion)
KVSM_PARAMETER("package_description", KVS_PT_STRING, 0, szDescription)
KVSM_PARAMETER("package_author", KVS_PT_NONEMPTYSTRING, 0, szAuthor)
KVSM_PARAMETER("package_image", KVS_PT_STRING, 0, szImage)
KVSM_PARAMETER("theme", KVS_PT_ARRAYCAST, 0, aCast)
KVSM_PARAMETERS_END(c)
KviKvsArray * pArray = aCast.array();
if((!pArray) || (pArray->size() < 1))
{
c->error(__tr2qs_ctx("No themes specified", "theme"));
return false;
}
kvs_uint_t s = pArray->size();
QStringList lThemeList;
for(kvs_uint_t i = 0; i < s; i++)
{
KviKvsVariant * v = pArray->at(i);
if(!v)
continue; // ?
QString szVal;
v->asString(szVal);
if(szVal.isEmpty())
continue;
lThemeList.append(szVal);
}
KviPointerList<KviThemeInfo> lThemeInfoList;
lThemeInfoList.setAutoDelete(true);
Q_FOREACH(QString szTheme, lThemeList)
{
KviThemeInfo * pInfo = new KviThemeInfo();
if(!pInfo->load(szTheme, KviThemeInfo::External))
{
QString szErr = pInfo->lastError();
c->error(__tr2qs_ctx("Failed to load theme from directory %Q: %Q", "theme"), &szTheme, &szErr);
delete pInfo;
return false;
}
lThemeInfoList.append(pInfo);
}
示例14: packTheme
void ThemeManagementDialog::packTheme()
{
KviPointerList<KviThemeInfo> dl;
dl.setAutoDelete(false);
QList<QListWidgetItem*> itemsSelected = m_pListWidget->selectedItems ();
for(int i=0;i<itemsSelected.count();i++)
dl.append(((ThemeListWidgetItem *)itemsSelected.at(i))->themeInfo());
if(dl.isEmpty())return;
PackThemeDialog * pDialog = new PackThemeDialog(this,&dl);
pDialog->exec();
pDialog->deleteLater();
}
示例15: lagCheckAbort
void KviLagMeter::lagCheckAbort(const char * key)
{
KviPointerList<KviLagCheck> l;
l.setAutoDelete(false);
KviLagCheck * c;
if(_OUTPUT_PARANOIC)
m_pConnection->console()->output(KVI_OUT_VERBOSE,__tr2qs("Lag check aborted (%s)"),key);
for(c = m_pCheckList->first();c;c = m_pCheckList->next())
if(kvi_strEqualCS(c->szKey.ptr(),key))l.append(c);
for(c = l.first();c;c = l.next())m_pCheckList->removeRef(c);
}