当前位置: 首页>>代码示例>>C++>>正文


C++ IAccount::GetParentProtocol方法代码示例

本文整理汇总了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 ();
	}
开发者ID:ForNeVeR,项目名称:leechcraft,代码行数:26,代码来源:accountactionsmanager.cpp

示例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 ());
	}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例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);
		}
	}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:59,代码来源:contactlistdelegate.cpp

示例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 ());
}
开发者ID:Mezomish,项目名称:leechcraft,代码行数:21,代码来源:accountslistdialog.cpp


注:本文中的IAccount::GetParentProtocol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。