本文整理汇总了C++中IAccount::GetParentProtocol方法的典型用法代码示例。如果您正苦于以下问题:C++ IAccount::GetParentProtocol方法的具体用法?C++ IAccount::GetParentProtocol怎么用?C++ IAccount::GetParentProtocol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAccount
的用法示例。
在下文中一共展示了IAccount::GetParentProtocol方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: joinAccountConfFromBM
void AccountActionsManager::joinAccountConfFromBM ()
{
IAccount *account = GetAccountFromSender (sender (), Q_FUNC_INFO);
if (!account)
return;
const QVariant& bmData = sender ()->property ("Azoth/BMData");
if (bmData.isNull ())
return;
const auto proto = qobject_cast<IMUCProtocol*> (account->GetParentProtocol ());
if (!proto)
{
qWarning () << Q_FUNC_INFO
<< account->GetAccountName ()
<< "parent protocol does not implement IMUCProtocol";
return;
}
auto jWidget = proto->GetMUCJoinWidget ();
IMUCJoinWidget *imjw = qobject_cast<IMUCJoinWidget*> (jWidget);
imjw->SetIdentifyingData (bmData.toMap ());
imjw->Join (account->GetQObject ());
jWidget->deleteLater ();
}
示例2: on_Delete__released
void AccountsListWidget::on_Delete__released()
{
QModelIndex index = Ui_.Accounts_->
selectionModel ()->currentIndex ();
if (!index.isValid ())
return;
IAccount *acc = index
.data (RAccObj).value<IAccount*> ();
if (QMessageBox::question (this,
"LeechCraft",
tr ("Are you sure you want to remove the account %1?")
.arg (acc->GetAccountName ()),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return;
QObject *protoObj = acc->GetParentProtocol ();
IProtocol *proto = qobject_cast<IProtocol*> (protoObj);
if (!proto)
{
qWarning () << Q_FUNC_INFO
<< "parent protocol for"
<< acc->GetAccountID ()
<< "doesn't implement IProtocol";
return;
}
proto->RemoveAccount (acc->GetObject ());
}
示例3: DrawAccount
void ContactListDelegate::DrawAccount (QPainter *painter,
QStyleOptionViewItemV4 o, const QModelIndex& index) const
{
QStyle *style = o.widget ?
o.widget->style () :
QApplication::style ();
painter->save ();
painter->setRenderHints (QPainter::HighQualityAntialiasing | QPainter::Antialiasing);
style->drawPrimitive (QStyle::PE_PanelButtonCommand,
&o, painter, o.widget);
painter->restore ();
o.font.setBold (true);
QStyledItemDelegate::paint (painter, o, index);
QObject *accObj = index.data (Core::CLRAccountObject).value<QObject*> ();
IAccount *acc = qobject_cast<IAccount*> (accObj);
IExtSelfInfoAccount *extAcc = qobject_cast<IExtSelfInfoAccount*> (accObj);
QIcon accIcon = extAcc ? extAcc->GetAccountIcon () : QIcon ();
if (accIcon.isNull ())
accIcon = qobject_cast<IProtocol*> (acc->GetParentProtocol ())->GetProtocolIcon ();
const QRect& r = o.rect;
const int iconSize = r.height () - 2 * CPadding;
QImage avatarImg;
if (extAcc)
avatarImg = extAcc->GetSelfAvatar ();
if (avatarImg.isNull ())
avatarImg = Core::Instance ().GetDefaultAvatar (iconSize);
else
avatarImg = avatarImg.scaled (iconSize, iconSize,
Qt::KeepAspectRatio, Qt::SmoothTransformation);
QPoint pxDraw = o.rect.topRight () - QPoint (CPadding, 0);
if (!avatarImg.isNull ())
{
pxDraw.rx () -= avatarImg.width ();
const QPoint& delta = QPoint (0, (iconSize - avatarImg.height ()) / 2);
painter->drawPixmap (pxDraw + delta,
QPixmap::fromImage (avatarImg));
pxDraw.rx () -= CPadding;
}
if (!accIcon.isNull ())
{
const int size = std::min (16, iconSize);
const QPixmap& px = accIcon.pixmap (size, size);
pxDraw.rx () -= px.width ();
const QPoint& delta = QPoint (0, (iconSize - px.height ()) / 2);
painter->drawPixmap (pxDraw + delta, px);
}
}
示例4: on_Delete__released
void AccountsListDialog::on_Delete__released()
{
QModelIndex index = Ui_.Accounts_->
selectionModel ()->currentIndex ();
if (!index.isValid ())
return;
IAccount *acc = index
.data (RAccObj).value<IAccount*> ();
QObject *protoObj = acc->GetParentProtocol ();
IProtocol *proto = qobject_cast<IProtocol*> (protoObj);
if (!proto)
{
qWarning () << Q_FUNC_INFO
<< "parent protocol for"
<< acc->GetAccountID ()
<< "doesn't implement IProtocol";
return;
}
proto->RemoveAccount (acc->GetObject ());
}