本文整理汇总了C++中QSharedPointer::GetInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ QSharedPointer::GetInfo方法的具体用法?C++ QSharedPointer::GetInfo怎么用?C++ QSharedPointer::GetInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSharedPointer
的用法示例。
在下文中一共展示了QSharedPointer::GetInfo方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slotMonitor
void CFrmUserList::slotMonitor()
{
QString szId = GetCurrentRoster();
if(szId.isEmpty())
return;
QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
if(roster.isNull())
return;
roster->GetInfo()->SetMonitor(!roster->GetInfo()->GetIsMonitor());
}
示例2: slotUpdateRoster
void CDlgUservCard::slotUpdateRoster(const QString& szId, QSharedPointer<CUser> userInfo)
{
if(szId == m_szJid)
{
if(m_UserInfo.isNull())
{
m_UserInfo = userInfo->GetInfo();
}
showEvent(NULL);
}
}
示例3: slotMoveRoster
void CFrmUserList::slotMoveRoster()
{
QString szName;
QSharedPointer<CUser> user = GLOBAL_USER->GetUserInfoRoster(GetCurrentRoster());
if(user.isNull())
return;
szName = user->GetInfo()->GetShowName();
QStringList items;
int nIndex = 0, i = 0;
QMap<QString, QStandardItem*>::iterator it;
for(it = m_Groups.begin(); it != m_Groups.end(); it++)
{
items << it.key();
if(user->GetInfo()->GetGroups().contains(it.key()))
nIndex = i;
i++;
}
bool ok;
QString item = QInputDialog::getItem(this,
tr("Move roster").arg(szName),
tr("Move roster %1 to group:").arg(szName),
items,
nIndex,
true,
&ok);
if (ok && !item.isEmpty())
{
QSet<QString> groups;
groups << item;
GET_CLIENT->RosterRemove(user->GetInfo()->GetId());
GET_CLIENT->RosterAdd(user->GetInfo()->GetId(),
CClient::SUBSCRIBE_ACCEPT,
user->GetInfo()->GetNick(),
groups);
}
}
示例4: ItemInsertRoster
int CFrmUserList::ItemInsertRoster(const QString& szId)
{
int nRet = 0;
QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
if(roster.isNull())
{
LOG_MODEL_ERROR("FrmUserList", "Dn't the roster:%s", qPrintable(szId));
return -1;
}
QSharedPointer<CUserInfo> info = roster->GetInfo();
if(info.isNull())
return -2;
ItemUpdateGroup(info);
return nRet;
}
示例5: Call
int CManageCallWebrtcXmpp::Call(const QString &szId, bool bVideo)
{
//检查是否是好友
QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
if(roster.isNull())
{
LOG_MODEL_ERROR("CManageCall", "Don't get roster:%s", qPrintable(szId));
return -1;
}
QSharedPointer<CUserInfo> info = roster->GetInfo();
CUserInfoXmpp* pInfo = (CUserInfoXmpp*)info.data();
if(pInfo->GetResource().isEmpty())
{
LOG_MODEL_ERROR("Call", "CClientXmpp::Call the roster resource is null");
roster->GetMessage()->AddMessage(szId,
tr("The roster is offline, don't launch a call."), true);
emit GET_CLIENT->sigMessageUpdate(szId);
return -2;
}
return CManageCall::Call(szId, bVideo);
}
示例6: slotFileReceived
void CManageFileTransfer::slotFileReceived(const QString& szId, QSharedPointer<CFileTransfer> file)
{
bool check = connect(file.data(), SIGNAL(sigFinished(const QString&, const QString&)),
SLOT(slotFinished(const QString&, const QString&)));
Q_ASSERT(check);
m_FileTransfer.insertMulti(szId, file);
QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
if(roster.isNull())
{
LOG_MODEL_ERROR("CManageFileTransfer", "There isn't roster:%s", szId.toStdString().c_str());
return;
}
if(CTool::isImageFile(file->GetFile()))
{
Accept(file);
}
QSharedPointer<CFileTransferAction> action(new CFileTransferAction(file, szId, QTime::currentTime(), false));
roster->GetMessage()->AddMessage(action);
GET_MAINWINDOW->ShowTrayIconMessage(roster->GetInfo()->GetShowName() + ":", tr("Send file %1").arg(file->GetFile()));
emit GET_CLIENT->sigMessageUpdate(szId);
}
示例7: OnCall
int CManageCallWebrtcXmpp::OnCall(const QString &szId,
QSharedPointer<CCallObject> &call, bool bVideo)
{
QSharedPointer<CClient> client = GETMANAGER->GetClient();
CClientXmpp* pClient = (CClientXmpp*)client.data();
if(!pClient)
{
LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "pClient is null");
return -1;
}
QXmppCallWebrtcManager* pCallManager = pClient->m_Client.findExtension<QXmppCallWebrtcManager>();
if(!pCallManager)
return -2;
QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
if(roster.isNull())
{
LOG_MODEL_ERROR("CManageCallWebrtcXmpp",
"CManageCallWebrtcXmpp::OnCall the roster is null");
return -3;
}
//因为 xmpp iq 协议需要用户的资源(jid)才会进行转发
QSharedPointer<CUserInfo> info = roster->GetInfo();
CUserInfoXmpp* pInfo = (CUserInfoXmpp*)info.data();
QSharedPointer<CCallObjectQXmppWebrtc> callWebrtc(
new CCallObjectQXmppWebrtc(pInfo->GetJid(), bVideo, pCallManager));
if(callWebrtc.isNull())
{
LOG_MODEL_ERROR("CManageCallWebrtcXmpp", "CManageCallWebrtcXmpp::CallVideo fail");
return -3;
}
call = callWebrtc;
return callWebrtc->Call();
}
示例8: ItemUpdateRoster
int CFrmUserList::ItemUpdateRoster(const QString &szId)
{
QSharedPointer<CUser> roster = GLOBAL_USER->GetUserInfoRoster(szId);
if(roster.isNull())
{
LOG_MODEL_ERROR("FrmUserList", "Dn't the roster:%s", qPrintable(szId));
return -1;
}
QSharedPointer<CUserInfo> info = roster->GetInfo();
QModelIndexList lstIndexs = m_pModel->match(m_pModel->index(0, 0),
USERLIST_ITEM_ROLE_JID,
info->GetId(),
-1,
Qt::MatchStartsWith | Qt::MatchWrap | Qt::MatchRecursive | Qt::MatchCaseSensitive);
if(lstIndexs.isEmpty())
{
int nRet = 0;
nRet = ItemInsertRoster(szId);
if(nRet)
{
LOG_MODEL_ERROR("FrmUserList", "Insert roster %s fail", qPrintable(szId));
return nRet;
}
LOG_MODEL_DEBUG("FrmUserList", "Insert roster %s", qPrintable(szId));
lstIndexs = m_pModel->match(m_pModel->index(0, 0),
USERLIST_ITEM_ROLE_JID,
info->GetId(),
-1,
Qt::MatchStartsWith | Qt::MatchWrap | Qt::MatchRecursive | Qt::MatchCaseSensitive);
}
QModelIndex index;
foreach(index, lstIndexs)
{
LOG_MODEL_DEBUG("FrmUserList", "index:row:%d;column:%d;id:%s", index.row(), index.column(), qPrintable(info->GetId()));
QStandardItem* pItem = m_pModel->itemFromIndex(index);
if(!pItem) continue;
if(pItem->data(USERLIST_ITEM_ROLE_PROPERTIES) == PROPERTIES_ROSTER)
{
//pItem->setData(roster->GetBareJid(), USERLIST_ITEM_ROLE_JID);
//pItem->setData(PROPERTIES_ROSTER, USERLIST_ITEM_ROLE_PROPERTIES);
//改变item背景颜色
//pItem->setData(CGlobal::Instance()->GetRosterStatusColor(info->GetStatus()), Qt::BackgroundRole);
//pItem->setBackground(QBrush(CGlobal::Instance()->GetRosterStatusColor(info->GetStatus())));
// if(CGlobal::Instance()->GetRosterShowType() == CGlobal::E_ROSTER_SHOW_NICK)
// pItem->setEditable(true);
// else
// pItem->setEditable(false);//禁止双击编辑
QString szText;
szText = info->GetShowName()
#ifdef DEBUG
+ "[" + CGlobal::Instance()->GetRosterStatusText(info->GetStatus()) + "]"
#endif
+ info->GetSubscriptionTypeStr(info->GetSubScriptionType())
;
pItem->setData(szText, Qt::DisplayRole); //改变item文本
#ifdef DEBUG
pItem->setToolTip(info->GetId());
#endif
//改变item图标
QPixmap pmp;
MainWindow::ComposeAvatarStatus(info, pmp);
pItem->setData(pmp.scaled(RABBITIM_ICON_SIZE, RABBITIM_ICON_SIZE), Qt::DecorationRole);
}
if(NULL == pItem || NULL == pItem->parent()) continue;
QStandardItem* pItemUnReadMessageCount = pItem->parent()->child(index.row(), index.column() + 1);
if(pItemUnReadMessageCount->data(USERLIST_ITEM_ROLE_PROPERTIES) == PROPERTIES_UNREAD_MESSAGE_COUNT)
{
//设置未读消息数
int nCount = roster->GetMessage()->GetUnReadCount();
if(nCount)
pItemUnReadMessageCount->setText(QString::number(nCount));
else
pItemUnReadMessageCount->setText(QString(""));
pItemUnReadMessageCount->setData(CGlobal::Instance()->GetUnreadMessageCountColor(), Qt::TextColorRole);
//pItemUnReadMessageCount->setData(roster->GetBareJid(), USERLIST_ITEM_ROLE_JID);
//pItemUnReadMessageCount->setData(PROPERTIES_UNREAD_MESSAGE_COUNT, USERLIST_ITEM_ROLE_PROPERTIES);
//pItemUnReadMessageCount->setEditable(false);//禁止双击编辑
}
}
示例9: slotUpdateMenu
void CFrmUserList::slotUpdateMenu()
{
m_Menu.setTitle(tr("Operator roster(&O)"));
m_Menu.setEnabled(true);
EnableAllActioins(false);
if(this->isHidden())
return;
//如果是组上,显示增加好友
EnableAction(ui->actionAddRoster_A);
//判断是在组上还是在好友上
QString bareJid = GetCurrentRoster();
if(bareJid.isEmpty())
{
//TODO:新建组
//判断子节点是否为空
QModelIndex index = m_UserList.currentIndex();
if(!m_pModel->hasChildren(index))
EnableAction(ui->actionRemove_Group);
}
else
{
QSharedPointer<CUser> user = GLOBAL_USER->GetUserInfoRoster(bareJid);
if(user.isNull())
{
LOG_MODEL_ERROR("FrmUserList", "Don't roster:%s", bareJid.toStdString().c_str());
return;
}
QSharedPointer<CUserInfo> info = user->GetInfo();
if(info.isNull())
{
LOG_MODEL_ERROR("FrmUserList", "Don't roster:%s", bareJid.toStdString().c_str());
return;
}
//增加订阅
if(CUserInfo::Both != info->GetSubScriptionType())
EnableAction(ui->actionAgreeAddRoster);
//显示重命名菜单
EnableAction(ui->actionRename);
//如果是好友上,显示删除好友
EnableAction(ui->actionRemoveRoster_R);
//查看好友信息
EnableAction(ui->actionInformation_I);
//移动到组
EnableAction(ui->actionMove_roster);
EnableAction(ui->actionSendMessage);
EnableAction(ui->actionSendFile);
EnableAction(ui->actionVideo);
EnableAction(ui->actionAudio);
if(CGlobal::Instance()->GetIsMonitor())
{
ui->actionAllowMonitor->setChecked(info->GetIsMonitor());
EnableAction(ui->actionAllowMonitor);
}
//TODO:3新增菜单
}
return;
}