本文整理汇总了C++中QXmppPresence::statusText方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppPresence::statusText方法的具体用法?C++ QXmppPresence::statusText怎么用?C++ QXmppPresence::statusText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppPresence
的用法示例。
在下文中一共展示了QXmppPresence::statusText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetStatus
EntryStatus GlooxCLEntry::GetStatus (const QString& variant) const
{
if (ODS_)
return EntryStatus ();
if (AuthRequested_)
return EntryStatus (SOnline, QString ());
QXmppRosterManager& rm = Account_->
GetClientConnection ()->GetClient ()->rosterManager ();
if (!rm.isRosterReceived ())
return EntryBase::GetStatus (variant);
const QMap<QString, QXmppPresence>& press = rm.getAllPresencesForBareJid (GetJID ());
if (!press.size ())
return EntryBase::GetStatus (variant);
QXmppPresence max = press.begin ().value ();
Q_FOREACH (const QString& resource, press.keys ())
{
if (!variant.isEmpty () && variant == resource)
{
max = press [resource];
break;
}
const QXmppPresence& pres = press [resource];
if (pres.priority () > max.priority ())
max = pres;
}
return EntryStatus (static_cast<State> (max.availableStatusType () + 1),
max.statusText ());
}
示例2: PresenceToStatus
EntryStatus PresenceToStatus (const QXmppPresence& pres)
{
EntryStatus st (static_cast<State> (pres.availableStatusType () + 1), pres.statusText ());
if (pres.type () == QXmppPresence::Unavailable)
st.State_ = SOffline;
return st;
}
示例3: presenceToStatusText
QString presenceToStatusText(const QXmppPresence& presence)
{
QString statusText = presence.statusText();
if(statusText.isEmpty())
{
if(presence.type() == QXmppPresence::Available)
{
switch(presence.availableStatusType())
{
case QXmppPresence::Invisible:
statusText = "Offline";
break;
case QXmppPresence::Online:
case QXmppPresence::Chat:
statusText = "Available";
break;
case QXmppPresence::Away:
case QXmppPresence::XA:
statusText = "Idle";
break;
case QXmppPresence::DND:
statusText = "Busy";
break;
}
}
else
statusText = "Offline";
}
return statusText;
}
示例4: slotChangedPresence
//好友出席状态改变
void CFrmUserList::slotChangedPresence(const QXmppPresence &presence)
{
LOG_MODEL_DEBUG("Roster", "CFrmUserList::ChangedPresence jid:%s;status:%d;status text:%s",
qPrintable(presence.from()),
presence.availableStatusType(),
qPrintable(presence.statusText())
);
QString bareJid = QXmppUtils::jidToBareJid(presence.from());
QMap<QString, CRoster*>::iterator it = m_Rosters.find(bareJid);
if(m_Rosters.end() != it)
{
it.value()->ChangedPresence(presence.from(), presence.availableStatusType());
}
}
示例5: initPresence
void MyXmppClient::initPresence(const QString& bareJid, const QString& resource)
{
int indxItem = -1;
RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid, indxItem );
if( item == 0 ) {
return;
}
QXmppPresence xmppPresence = rosterManager->getPresence( bareJid, resource );
QXmppPresence::Type statusJid = xmppPresence.type();
QStringList _listResources = this->getResourcesByJid( bareJid );
if( (_listResources.count() > 0) && (!_listResources.contains(resource)) )
{
qDebug() << bareJid << "/" << resource << " ****************[" <<_listResources<<"]" ;
if( statusJid == QXmppPresence::Unavailable ) {
return;
}
}
item->setResource( resource );
QString picStatus = this->getPicPresence( xmppPresence );
item->setPresence( picStatus );
QString txtStatus = this->getTextStatus( xmppPresence.statusText(), xmppPresence );
item->setStatusText( txtStatus );
RosterItemModel *itemExists = (RosterItemModel*)cachedRoster->find( bareJid, indxItem );
if( itemExists != 0 ) {
itemExists->copy( item );
QString picStatusPrev = itemExists->presence();
if( picStatusPrev != picStatus )
{
//emit presenceJidChanged( bareJid, txtStatus, picStatus );
emit rosterChanged();
}
}
item = 0; itemExists = 0;
delete item; delete itemExists;
emit contactStatusChanged(m_accountId,bareJid);
}
示例6: setPresence
void rosterItem::setPresence(const QXmppPresence &presence)
{
// determine status text
QString statusText = presence.statusText();
if (statusText.isEmpty()) {
if(presence.type() == QXmppPresence::Available)
statusText = "Available";
else if(presence.type() == QXmppPresence::Unavailable)
statusText = "Offline";
}
// store data
setData(statusText, rosterItem::StatusText);
setData(static_cast<int>(presence.type()), PresenceType);
setData(static_cast<int>(presence.availableStatusType()), StatusType);
// update icon
QString icon;
if (presence.type() == QXmppPresence::Available) {
switch (presence.availableStatusType())
{
case QXmppPresence::Online:
case QXmppPresence::Chat:
icon = "green";
break;
case QXmppPresence::Away:
case QXmppPresence::XA:
icon = "orange";
break;
case QXmppPresence::DND:
icon = "red";
break;
case QXmppPresence::Invisible:
icon = "gray";
break;
}
} else {
icon = "gray";
}
if (!icon.isEmpty())
setIcon(QIcon(":/icons/resource/"+icon+".png"));
}