本文整理汇总了C++中KviKvsVariantList类的典型用法代码示例。如果您正苦于以下问题:C++ KviKvsVariantList类的具体用法?C++ KviKvsVariantList怎么用?C++ KviKvsVariantList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KviKvsVariantList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: transferWindow
void HttpFileTransfer::transferTerminated(bool bSuccess)
{
KviWindow * out = transferWindow();
m_tTransferEndTime = kvi_unixTime();
KviKvsVariantList vParams;
vParams.append(bSuccess);
vParams.append(new KviKvsVariant(m_pHttpRequest->url().url(), true));
vParams.append(new KviKvsVariant(m_pHttpRequest->fileName(), true));
vParams.append(new KviKvsVariant(m_vMagicIdentifier));
if(m_szCompletionCallback.isNull())
{
KVS_TRIGGER_EVENT(KviEvent_OnHTTPGetTerminated,out ? out : (KviWindow *)(g_pApp->activeConsole()),&vParams)
} else {
KviKvsScript::run(m_szCompletionCallback,out ? out : (KviWindow *)(g_pApp->activeConsole()),&vParams);
}
if(bSuccess)
{
m_szStatusString = __tr2qs_ctx("Transfer completed","http");
m_eGeneralStatus = Success;
displayUpdate();
if(out && (!m_bNoOutput))out->output(KVI_OUT_GENERICSUCCESS,__tr2qs_ctx("[HTTP %d]: Transfer completed","http"),id());
g_pApp->fileDownloadTerminated(
true,
m_pHttpRequest->url().url(),
m_pHttpRequest->fileName(),
QString(),
QString(),
!m_bNotifyCompletion
);
} else {
m_szStatusString = __tr2qs_ctx("Transfer failed","http");
m_szStatusString += ": ";
m_szStatusString += m_pHttpRequest->lastError();
m_eGeneralStatus = Failure;
displayUpdate();
if(out && (!m_bNoOutput))out->output(KVI_OUT_GENERICERROR,__tr2qs_ctx("[HTTP %d]: Transfer failed: %Q","http"),id(),&(m_pHttpRequest->lastError()));
g_pApp->fileDownloadTerminated(
false,
m_pHttpRequest->url().url(),
m_pHttpRequest->fileName(),
QString(),
m_pHttpRequest->lastError(),
!m_bNotifyCompletion
);
}
if(m_bAutoClean)
{
if(m_pAutoCleanTimer)delete m_pAutoCleanTimer;
m_pAutoCleanTimer = new QTimer();
connect(m_pAutoCleanTimer,SIGNAL(timeout()),this,SLOT(autoClean()));
m_pAutoCleanTimer->start(100);
m_TimerId=m_pAutoCleanTimer->timerId();
}
}
示例2: fatalError
void KvsObject_xmlReader::fatalError(const QString & szError)
{
m_szLastError = szError;
KviKvsVariantList vArgs;
vArgs.append(new KviKvsVariant(m_szLastError));
callFunction(this, "onError", &vArgs);
}
示例3: characters
bool characters(const QString & szChars) override
{
KviKvsVariant ret;
KviKvsVariantList par;
par.setAutoDelete(true);
par.append(new KviKvsVariant(szChars));
if(!m_pReader->callFunction(m_pReader, "onText", &ret, &par))
return kvsCodeFailure();
return handleKvsCallReturnValue(&ret);
}
示例4: setup_finish
// this is called just after the first startup
// all the subsystems are up and running (we even have a nice console
// to write on if needed).
// all the options are loaded.
KVIMODULEEXPORTFUNC void setup_finish()
{
if(bNeedToApplyDefaults)
{
KVI_OPTION_STRING(KviOption_stringIncomingPath) = g_szChoosenIncomingDirectory;
// Reset the quit message and the real name... if they contain the KVIrc version
// then probably the user hasn't even edited them.
if(KVI_OPTION_STRING(KviOption_stringQuitMessage).indexOf("KVIrc",0,Qt::CaseInsensitive) != -1)
KVI_OPTION_STRING(KviOption_stringQuitMessage) = KVI_DEFAULT_QUIT_MESSAGE;
// We deserve to change the user's part message in something nice :)
KVI_OPTION_STRING(KviOption_stringPartMessage) = KVI_DEFAULT_PART_MESSAGE;
// FIXME: Should we also change these ?
// #define KVI_DEFAULT_CTCP_USERINFO_REPLY "I'm too lazy to edit this field."
// #define KVI_DEFAULT_AWAY_MESSAGE "I'm off to see the wizard."
// Apply the chosen default theme
KviThemeInfo out;
switch(g_iThemeToApply)
{
case THEME_APPLY_HIRES:
KviTheme::load("Aria-1.0.0",out,BUILTIN);
break;
case THEME_APPLY_LORES:
KviTheme::load("MinimalDark-1.0.0",out,BUILTIN);
break;
// default: no theme
}
if(!szMircServers.isEmpty())
{
g_pServerDataBase->importFromMircIni(szMircServers,szMircIni,
KVI_OPTION_STRINGLIST(KviOption_stringlistRecentServers));
g_pApp->saveIrcServerDataBase();
}
g_pApp->loadDefaultScript();
if(!szUrl.isEmpty())
{
KviKvsVariantList * pParams = new KviKvsVariantList();
pParams->append(szUrl);
KviKvsScript::run("openurl $0",g_pActiveWindow,pParams);
delete pParams;
KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = TRUE;
} else if(!szHost.isEmpty()) {
KviKvsVariantList * pParams = new KviKvsVariantList();
pParams->append(szHost);
pParams->append((kvs_int_t)uPort);
KviKvsScript::run("server $0 $1",g_pActiveWindow,pParams);
delete pParams;
KVI_OPTION_BOOL(KviOption_boolShowServersConnectDialogOnStart) = TRUE;
}
}
}
示例5: window
void KviScriptUserButton::btnClicked()
{
KviWindow * pWnd = window();
if(!pWnd)return; // ops...
QPoint pos = mapToGlobal(QPoint(0,height()));
KviKvsVariantList vList;
vList.append((kvs_int_t)pos.x());
vList.append((kvs_int_t)pos.y());
m_pScript->run(pWnd,&vList,0,KviKvsScript::PreserveParams);
}
示例6: endElement
bool endElement(const QString & szNamespaceUri, const QString & szLocalName, const QString & szQualifiedName) override
{
KviKvsVariant ret;
KviKvsVariantList par;
par.setAutoDelete(true);
par.append(new KviKvsVariant(szQualifiedName));
par.append(new KviKvsVariant(szNamespaceUri));
par.append(new KviKvsVariant(szLocalName));
if(!m_pReader->callFunction(m_pReader, "onElementEnd", &ret, &par))
return kvsCodeFailure();
return handleKvsCallReturnValue(&ret);
}
示例7: error
bool error(const QXmlParseException & exception) override
{
// recoverable
QString szMsg;
decodeException(szMsg, false, exception);
KviKvsVariant ret;
KviKvsVariantList par;
par.setAutoDelete(true);
par.append(new KviKvsVariant(szMsg));
if(!m_pReader->callFunction(m_pReader, "onWarning", &ret, &par))
return kvsCodeFailure();
return handleKvsCallReturnValue(&ret);
}
示例8: execute
bool KviKvsTreeNodeCoreSimpleCommand::execute(KviKvsRunTimeContext * c)
{
KviKvsVariantList l;
l.setAutoDelete(true);
if(!(m_pParams->evaluate(c,&l)))return false;
KviKvsSwitchList swl;
if(m_pSwitches)
{
if(!(m_pSwitches->evaluate(c,&swl)))return false;
}
c->setDefaultReportLocation(this);
return m_pExecRoutine->proc(c,&l,&swl);
}
示例9: if
void KvsObject_trayIcon::slotActivated(QSystemTrayIcon::ActivationReason reason)
{
QString szReason;
if (reason==QSystemTrayIcon::Unknown)
szReason="Unknown";
else if(reason==QSystemTrayIcon::Context)
szReason="Context";
else if(reason==QSystemTrayIcon::DoubleClick)
szReason="DoubleClick";
else if(reason==QSystemTrayIcon::Trigger)
szReason="Trigger";
else szReason="MiddleClick";
KviKvsVariantList lParams;
lParams.append(new KviKvsVariant(szReason));
callFunction(this,"activatedEvent",0,&lParams);
}
示例10: getMenu
void SinglePopupEditor::testPopup()
{
if(m_pTestPopup)
delete m_pTestPopup;
m_pTestPopup = getMenu();
if(!m_pTestPopup)
return;
connect(m_pTestPopup, SIGNAL(testModeItemClicked(KviKvsPopupMenuItem *)), this, SLOT(testModeMenuItemClicked(KviKvsPopupMenuItem *)));
QPoint pnt = m_pMenuButton->mapToGlobal(QPoint(0, m_pMenuButton->height()));
KviKvsVariantList * parms = new KviKvsVariantList();
parms->append(new KviKvsVariant(QString("test1")));
parms->append(new KviKvsVariant(QString("test2")));
parms->append(new KviKvsVariant(QString("test3")));
parms->append(new KviKvsVariant(QString("test4")));
m_pTestPopup->doPopup(pnt, g_pActiveWindow, parms, true);
}
示例11: m_allocProc
KviKvsObject * KviKvsObjectClass::allocateInstance(KviKvsObject * pParent,const QString &szName,KviKvsRunTimeContext * pContext,KviKvsVariantList * pParams)
{
if(!m_allocProc)
return 0;
KviKvsObject * pObject = m_allocProc(this,pParent,szName);
if(!pObject)
return 0;
if(!pObject->init(pContext,pParams))
{
// internal init failure : abort
pObject->dieNow();
return 0;
}
// copy params
KviKvsVariantList copy;
copy.setAutoDelete(false);
KviKvsVariant * v = pParams->first();
while(v)
{
copy.append(v);
v = pParams->next();
}
KviKvsVariant ret;
if(!pObject->callFunction(pObject,"constructor",QString(),pContext,&ret,©))
{
// ops...constructor failed (script error!)
pObject->dieNow();
return 0;
}
if(!ret.isEmpty())
pContext->warning(__tr2qs_ctx("It's not allowed to return values in the constructor","kvs"));
return pObject;
}
示例12: execute
bool KviKvsTreeNodeParameterReturn::execute(KviKvsRunTimeContext * c)
{
KviKvsVariantList lBuffer;
if(!m_pDataList->evaluate(c, &lBuffer))
return false;
if(lBuffer.count() == 0)
{
c->returnValue()->setNothing();
return true;
}
if(lBuffer.count() == 1)
{
c->returnValue()->copyFrom(*(lBuffer.first()));
return true;
}
QString all;
lBuffer.allAsString(all);
c->returnValue()->setString(all);
return true;
}
示例13: startElement
bool startElement(const QString & szNamespaceUri, const QString & szLocalName, const QString & szQualifiedName, const QXmlAttributes & attrs) override
{
KviKvsVariant ret;
KviKvsVariantList par;
par.setAutoDelete(true);
par.append(new KviKvsVariant(szQualifiedName));
KviKvsHash * pHash = new KviKvsHash();
par.append(new KviKvsVariant(pHash));
par.append(new KviKvsVariant(szNamespaceUri));
par.append(new KviKvsVariant(szLocalName));
int c = attrs.count();
for(int i = 0; i < c; i++)
pHash->set(attrs.qName(i), new KviKvsVariant(attrs.value(i)));
if(!m_pReader->callFunction(m_pReader, "onElementStart", &ret, &par))
return kvsCodeFailure();
return handleKvsCallReturnValue(&ret);
}
示例14: killTimer
//mouse events
void KviIrcView::mouseDoubleClickEvent(QMouseEvent *e)
{
QString szKvsCommand;
QString szLinkCommandPart;
QString szLinkTextPart;
if(m_iMouseTimer)
{
killTimer(m_iMouseTimer);
m_iMouseTimer=0;
delete m_pLastEvent;
m_pLastEvent = 0;
}
getLinkUnderMouse(e->pos().x(),e->pos().y(),0,&szLinkCommandPart,&szLinkTextPart);
if(szLinkCommandPart.isEmpty())
{
KVS_TRIGGER_EVENT_0(KviEvent_OnTextViewDoubleClicked,m_pKviWindow);
return;
}
KviKvsVariantList lParams;
lParams.append(szLinkTextPart);
switch(szLinkCommandPart[0].unicode())
{
case 'n':
{
switch(m_pKviWindow->type())
{
case KviWindow::Channel:
if(((KviChannelWindow *)m_pKviWindow)->isOn(szLinkTextPart))
{
KVS_TRIGGER_EVENT(KviEvent_OnChannelNickDefaultActionRequest,m_pKviWindow,&lParams);
return;
}
break;
case KviWindow::Query:
if(KviQString::equalCI(((KviQueryWindow *)m_pKviWindow)->windowName(),szLinkTextPart))
{
KVS_TRIGGER_EVENT(KviEvent_OnQueryNickDefaultActionRequest,m_pKviWindow,&lParams);
return;
}
break;
default:
return; // unhandled window type (FIXME: Let it go anyway ?)
break;
}
if(console())
KVS_TRIGGER_EVENT(KviEvent_OnNickLinkDefaultActionRequest,m_pKviWindow,&lParams);
return;
}
break;
case 'm': // m+X[ param] / m-X[ param] (used to quickly undo mode changes)
{
// Syntax is
// m<plus_or_minus><mode_char>[ <parameter>]
if(szLinkCommandPart.length() < 3)
return; // malformed
if(m_pKviWindow->type() != KviWindow::Channel)
return; // must be on a channel to apply it
if(!(((KviChannelWindow *)m_pKviWindow)->isMeOp()))
return; // i'm not op, can't do mode changes
QString szPart = szLinkCommandPart.mid(1);
szKvsCommand = QString("mode $chan.name %1").arg(szPart);
}
break;
case 'h':
m_pKviWindow->output(KVI_OUT_HOSTLOOKUP,__tr2qs("Looking up host %Q..."),&szLinkTextPart);
szKvsCommand = "host -a $0";
break;
case 'u':
if(KVI_OPTION_UINT(KviOption_uintUrlMouseClickNum) == 2) // <-- ??????????
{
KVS_TRIGGER_EVENT(KviEvent_OnURLLinkClick,m_pKviWindow,&lParams);
return;
}
break;
case 'c':
{
if(!console())
return;
if(!console()->connection())
return;
// If there is a channel after the c flag, join that instead (as the text part may contain control codes)
if(szLinkCommandPart.length() > 1)
szLinkTextPart = szLinkCommandPart.mid(1);
if(KviChannelWindow * c = console()->connection()->findChannel(szLinkTextPart))
{
// already there
g_pMainWindow->setActiveWindow(c);
return;
}
//.........这里部分代码省略.........
示例15: window
void KviKvsAsyncDnsOperation::lookupTerminated(KviDnsResolver *)
{
KviWindow * pWnd = window();
if(!g_pApp->windowExists(pWnd))pWnd = g_pActiveWindow;
if(m_pCallback)
{
KviKvsVariantList params;
params.setAutoDelete(true);
if(m_pDns->state() == KviDnsResolver::Failure)
{
params.append(new KviKvsVariant(m_szQuery));
params.append(new KviKvsVariant((kvs_int_t)0));
params.append(new KviKvsVariant(m_pDns->errorString()));
params.append(new KviKvsVariant());
params.append(new KviKvsVariant(*m_pMagic));
} else {
QString szHostName = m_pDns->hostName();
QString * fi = m_pDns->ipAddressList()->first();
params.append(new KviKvsVariant(m_szQuery));
params.append(new KviKvsVariant((kvs_int_t)1));
params.append(new KviKvsVariant(fi ? *fi : QString("?.?.?.?")));
params.append(new KviKvsVariant(szHostName.isEmpty() ? QString("?.?") : szHostName));
params.append(new KviKvsVariant(*m_pMagic));
}
m_pCallback->run(pWnd,¶ms,0,KviKvsScript::PreserveParams);
delete this;
return;
}
// we have no callback : output the results
QString szQuery = m_pDns->query();
pWnd->output(KVI_OUT_HOSTLOOKUP,__tr2qs_ctx("DNS Lookup result for query \"%Q\"","kvs"),&szQuery);
if(m_pDns->state() == KviDnsResolver::Failure)
{
QString strDescription(m_pDns->errorString());
pWnd->output(KVI_OUT_HOSTLOOKUP,__tr2qs_ctx("Error: %Q","kvs"),&strDescription);
} else {
QString szHostName = m_pDns->hostName();
pWnd->output(KVI_OUT_HOSTLOOKUP,__tr2qs_ctx("Hostname: %Q","kvs"),&szHostName);
int idx = 1;
for(QString * a = m_pDns->ipAddressList()->first();a;a = m_pDns->ipAddressList()->next())
{
pWnd->output(KVI_OUT_HOSTLOOKUP,__tr2qs_ctx("IP address %d: %Q","kvs"),idx,a);
idx++;
}
}
delete this;
}