本文整理汇总了C++中QXmppPresence::availableStatusType方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppPresence::availableStatusType方法的具体用法?C++ QXmppPresence::availableStatusType怎么用?C++ QXmppPresence::availableStatusType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppPresence
的用法示例。
在下文中一共展示了QXmppPresence::availableStatusType方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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());
}
}
示例2: 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 ());
}
示例3: 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;
}
示例4: 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;
}
示例5: 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"));
}
示例6: getPicPresence
QString MyXmppClient::getPicPresence( const QXmppPresence &presence ) const
{
QString picPresenceName;
QXmppPresence::Type status = presence.type();
if( status != QXmppPresence::Available ) picPresenceName = "qrc:/presence/offline";
else
{
QXmppPresence::AvailableStatusType availableStatus = presence.availableStatusType();
if( availableStatus == QXmppPresence::Online ) picPresenceName = "qrc:/presence/online";
else if ( availableStatus == QXmppPresence::Chat ) picPresenceName = "qrc:/presence/chatty";
else if ( availableStatus == QXmppPresence::Away ) picPresenceName = "qrc:/presence/away";
else if ( availableStatus == QXmppPresence::XA ) picPresenceName = "qrc:/presence/xa";
else if ( availableStatus == QXmppPresence::DND ) picPresenceName = "qrc:/presence/busy";
}
return picPresenceName;
}
示例7: presenceReceived
void MyXmppClient::presenceReceived( const QXmppPresence & presence ) {
QString bareJid = getBareJidByJid(presence.from());
QString resource = getResourceByJid(presence.from());
QString myResource = xmppClient->configuration().resource();
if ((presence.from().indexOf( m_myjid ) >= 0 && resource == myResource) || (bareJid == "" && resource == "")) {
if (presence.type() == QXmppPresence::Unavailable) m_status = Offline;
else {
switch (presence.availableStatusType()) {
case QXmppPresence::Online: m_status = Online; break;
case QXmppPresence::Chat: m_status = Chat; break;
case QXmppPresence::Away: m_status = Away; break;
case QXmppPresence::XA: m_status = XA; break;
case QXmppPresence::DND: m_status = DND; break;
}
}
emit statusChanged(m_accountId);
}
}