本文整理汇总了C++中QDBusPendingReply::waitForFinished方法的典型用法代码示例。如果您正苦于以下问题:C++ QDBusPendingReply::waitForFinished方法的具体用法?C++ QDBusPendingReply::waitForFinished怎么用?C++ QDBusPendingReply::waitForFinished使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDBusPendingReply
的用法示例。
在下文中一共展示了QDBusPendingReply::waitForFinished方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getPublications
QVariantMap TweetSupplier::getPublications(QString pluginMethod)
{
//connecting the QDBus with the widget
QDBusMessage busMsg = QDBusMessage::createMethodCall("org.plexydesk.social", "/services","local.socioplexy.Configuration","getPluginsList");
//creating the QDBus connection with the sessionBus.
QDBusConnection bus = QDBusConnection::connectToBus(QDBusConnection::SessionBus, "socioplexy");
/*Bus connection Checking..
if(bus.isConnected())
qDebug() << "QDBusConnection is successfull";
else
qDebug()<<"QDBusConnection is unsuccessfull";*/
//listening for the reply from the QDBus
QDBusPendingReply<QStringList> msgRep = bus.asyncCall(busMsg,10000);
msgRep.waitForFinished();
//if reply is valid only proceed the QDBus connection method calling
if (msgRep.isValid())
{
QStringList plugins = msgRep.value();
if (!plugins.isEmpty())
{
int i=0,j;
//checking for the twitterplugin in the plugins list loaded.
for (j=0;j<plugins.count();j++)
{
if (plugins.value(j)=="weatherplugin"){
i = 1; //Flag for plugin found
break;
}
}
//if plugin twitterplugin is found then request data from the plugin
if (i == 1)
{
QString pluginName = plugins.value(j);
QDBusMessage pluginBusMsg;
pluginBusMsg = QDBusMessage::createMethodCall("org.plexydesk.social", "/services","local.socioplexy.Configuration","supportedMethods");
QList<QVariant> argsSuppMethods;
argsSuppMethods << QVariant(pluginName);
pluginBusMsg.setArguments(argsSuppMethods);
qDebug()<<pluginBusMsg.arguments();
QDBusPendingReply<QStringList> supportMsgRep = bus.asyncCall(pluginBusMsg,1000);
supportMsgRep.waitForFinished();
if (supportMsgRep.isValid())
{
QStringList supportedMethodsList = supportMsgRep.value();
if(supportedMethodsList.contains(pluginMethod))
{
QDBusMessage getDataMsg;
QVariantMap args;
QList<QVariant> argsData;
getDataMsg = QDBusMessage::createMethodCall("org.plexydesk.social", "/services", "local.socioplexy.Configuration", "data");
argsData << QVariant("weatherplugin") << QVariant(pluginMethod) << QVariant(args);
getDataMsg.setArguments(argsData);
QDBusPendingReply<QVariantMap> recvData = bus.asyncCall(getDataMsg,10000);
recvData.waitForFinished();
if(recvData.isValid())
return recvData.value();
else
{
QVariantMap dummy;
dummy["Network Error"] = "Data not recieved";
return dummy;
}
}
else
qDebug() << "supportedMethods doesn't contain getPublicTimeline";
}
else
{
qDebug()<<"Error reply "<<supportMsgRep.error();
}
}
else
{
qDebug()<<"No matching plugin loaded...";
}
}
else
{
qDebug()<<"No plugin name was retireved.";
}
}
else
{
qDebug()<<"error reply"<<msgRep.error();
}
}