本文整理汇总了C++中DCOPClient::setServerAddress方法的典型用法代码示例。如果您正苦于以下问题:C++ DCOPClient::setServerAddress方法的具体用法?C++ DCOPClient::setServerAddress怎么用?C++ DCOPClient::setServerAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DCOPClient
的用法示例。
在下文中一共展示了DCOPClient::setServerAddress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runDCOP
//.........这里部分代码省略.........
// Main loop
// If users is an empty list we're calling for the currently logged
// in user. In this case we don't have a session, but still want
// to iterate the loop once.
QStringList::Iterator sIt = sessions.begin();
for(; sIt != sessions.end() || users.isEmpty(); ++sIt)
{
if(!presetDCOPServer && !users.isEmpty())
{
QString dcopFile = it.data() + "/" + *sIt;
QFile f(dcopFile);
if(!f.open(IO_ReadOnly))
{
cerr_ << "Can't open " << dcopFile << " for reading!" << endl;
exit(-1);
}
QStringList l(QStringList::split('\n', f.readAll()));
dcopServer = l.first();
if(dcopServer.isEmpty())
{
cerr_ << "WARNING: Unable to determine DCOP server for session " << *sIt << "!" << endl
<< "Please check permissions or set the $DCOPSERVER variable manually before" << endl
<< "calling dcop." << endl;
exit(-1);
}
}
delete client;
client = new DCOPClient;
if(!dcopServer.isEmpty())
client->setServerAddress(dcopServer.ascii());
bool success = client->attach();
if(!success)
{
cerr_ << "ERROR: Couldn't attach to DCOP server!" << endl;
retval = QMAX(retval, 1);
if(users.isEmpty())
break;
else
continue;
}
dcop = client;
int argscount = args.count();
if(DCOPrefmode)
argscount++;
switch(argscount)
{
case 0:
queryApplications("");
break;
case 1:
if(endsWith(app, '*'))
queryApplications(app);
else
queryObjects(app, "");
break;
case 2:
if(endsWith(objid, '*'))
queryObjects(app, objid);
else
queryFunctions(app, objid);
break;