本文整理汇总了C++中IAccount类的典型用法代码示例。如果您正苦于以下问题:C++ IAccount类的具体用法?C++ IAccount怎么用?C++ IAccount使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IAccount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetPassword
QString Core::GetPassword (QObject *accObj)
{
QVariantList keys;
IAccount *account = qobject_cast<IAccount*> (accObj);
keys << account->GetAccountID ();
const QVariantList& result = Util::GetPersistentData (keys, this);
if (result.size () != 1)
{
qWarning () << Q_FUNC_INFO
<< "incorrect result size"
<< result;
return QString ();
}
const QVariantList& strVarList = result.at (0).toList ();
if (strVarList.isEmpty () ||
!strVarList.at (0).canConvert<QString> ())
{
qWarning () << Q_FUNC_INFO
<< "invalid string variant list"
<< strVarList;
return QString ();
}
return strVarList.at (0).toString ();
}
示例2: wmain
int wmain()
{
// CoInitialize(NULL);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
IInventory* pInv = NULL;
HRESULT hr = CoCreateInstance(CLSID_Trader, NULL, CLSCTX_INPROC_SERVER, IID_IInventory, reinterpret_cast<LPVOID*>(&pInv));
if(SUCCEEDED(hr))
{
int qty;
double bal;
wcout << L"Number of items to purchase : ";
wcin >> qty;
hr = pInv->Buy(qty, 100);
if(FAILED(hr))
wcout << L"Buy operation failed with error code of " << hex << hr << endl;
else
{
IAccount* pAcc = NULL;
pInv->QueryInterface(IID_IAccount, reinterpret_cast<LPVOID*>(&pAcc));
pInv->GetStock(&qty);
pAcc->GetBalance(&bal);
wcout << L"Current stock : " << qty << endl;
wcout << L"Current balance : " << bal << endl;
pAcc->Release();
}
pInv->Release();
}
else
示例3: GetAccountFromSender
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 ();
}
示例4: AFX_MANAGE_STATE
void CTradeLockDlg::OnShow(BOOL bShow)
{
if (bShow)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
m_edPsw.SetWindowText("");
m_cbFundAccount.ResetContent();
IAccount* pCurrAccount = m_pAccountMng->GetCurrentAccount(atTrade);
int nCurrIndex = 0;
for (int i = 0; i < m_pAccountMng->GetCount(atTrade); i++)
{
IAccount* pAccount = m_pAccountMng->GetAccount(i, atTrade);
CString sTmp = "";
sTmp.Format(_T("股票%s(%s)"), pAccount->GetAccountName(), pAccount->GetUserName());
int nIndex = m_cbFundAccount.AddString(sTmp);
m_cbFundAccount.SetItemDataPtr(nIndex, pAccount);
if (pAccount == pCurrAccount)
{
nCurrIndex = nIndex;
}
}
if (m_cbFundAccount.GetCount() > 0)
{
m_cbFundAccount.SetCurSel(nCurrIndex);
}
if (pCurrAccount->GetConnectHandle() == 0)
{
m_stErrorHint.SetWindowText("由于未知的原因连接被断开,请检查网络后重新连接!");
}
else
{
m_stErrorHint.SetWindowText("");
}
}
}
示例5: GetAccountID
IAccount* ImportManager::GetAccountID (Entity e)
{
const QString& accName = e.Additional_ ["AccountName"].toString ();
auto accs = Core::Instance ().GetAccounts ([] (IProtocol *proto)
{ return qobject_cast<ISupportImport*> (proto->GetQObject ()); });
IAccount *acc = 0;
Q_FOREACH (acc, accs)
if (acc->GetAccountName () == accName)
return acc;
const QString& impId = e.Additional_ ["AccountID"].toString ();
EntityQueues_ [impId] << e;
if (EntityQueues_ [impId].size () > 1)
return 0;
if (AccID2OurID_.contains (impId))
return AccID2OurID_ [impId];
AccountHandlerChooserDialog dia (accs,
tr ("Select account to import history from %1 into:").arg (accName));
if (dia.exec () != QDialog::Accepted)
return 0;
acc = dia.GetSelectedAccount ();
AccID2OurID_ [impId] = acc;
return acc;
}
示例6: qWarning
void Plugin::RequestLastMessages (QObject *entryObj, int num)
{
ICLEntry *entry = qobject_cast<ICLEntry*> (entryObj);
if (!entry)
{
qWarning () << Q_FUNC_INFO
<< entryObj
<< "doesn't implement ICLEntry";
return;
}
if (entry->GetEntryType () != ICLEntry::ETChat)
return;
IAccount *account = qobject_cast<IAccount*> (entry->GetParentAccount ());
if (!account)
{
qWarning () << Q_FUNC_INFO
<< entry->GetParentAccount ()
<< "doesn't implement IAccount";
return;
}
const QString& accId = account->GetAccountID ();
const QString& entryId = entry->GetEntryID ();
Core::Instance ()->GetChatLogs (accId, entryId, 0, num);
RequestedLogs_ [accId] [entryId] = entryObj;
}
示例7: QComboBox
QWidget* SelectTargetDelegate::createEditor (QWidget *parent,
const QStyleOptionViewItem&, const QModelIndex& index) const
{
QComboBox *box = new QComboBox (parent);
IAccount *acc = Dlg_->GetAccountFromIndex (index.sibling (index.row (),
SubmitToDialog::Account));
if (!acc)
return box;
auto ibp = qobject_cast<IBloggingPlatform*> (acc->GetParentBloggingPlatform ());
if (!ibp)
return box;
if (ibp->GetFeatures () & IBloggingPlatform::BPFSelectablePostDestination)
{
auto profile = qobject_cast<IProfile*> (acc->GetProfile ());
if (!profile)
box->addItem (tr ("<Default>"));
else
for (const auto& pair : profile->GetPostingTargets ())
box->addItem (pair.first, pair.second);
}
else
box->addItem (tr ("<Default>"));
box->setCurrentIndex (0);
Dlg_->GetModel ()->setData (index, box->currentText (), TargetRole);
return box;
}
示例8: on_Delete__released
void AccountsListWidget::on_Delete__released ()
{
auto index = Ui_.Accounts_->selectionModel ()->currentIndex ();
index = index.sibling (index.row (), Columns::Name);
if (!index.isValid ())
return;
QStandardItem *item = AccountsModel_->itemFromIndex (index);
IAccount *acc = 0;
if (item &&
Item2Account_.contains (item))
acc = Item2Account_ [item];
else
return;
if (QMessageBox::question (this,
"LeechCraft",
tr ("Are you sure you want to remove the account %1?")
.arg ("<em>" + acc->GetAccountName () + "</em>"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
return;
QObject *bpObj = acc->GetParentBloggingPlatform ();
IBloggingPlatform *ibp = qobject_cast<IBloggingPlatform*> (bpObj);
if (!ibp)
{
qWarning () << Q_FUNC_INFO
<< "parent blogging platform for"
<< acc->GetAccountID ()
<< "doesn't implement IBloggingPlatform";
return;
}
ibp->RemoveAccount (acc->GetObject ());
}
示例9: selectionModel
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 ());
}
示例10: handleAccountClicked
void AccountsListWidget::handleAccountClicked (const QModelIndex& idx)
{
QModelIndex index = idx.sibling (idx.row (), Columns::Name);
if (!index.isValid ())
return;
QStandardItem *item = AccountsModel_->itemFromIndex (index);
if (item &&
Item2Account_.contains (item))
{
IAccount *acc = Item2Account_ [item];
auto ibp = qobject_cast<IBloggingPlatform*> (acc->GetParentBloggingPlatform ());
if (!ibp)
{
qWarning () << Q_FUNC_INFO
<< "account"
<< acc->GetAccountID ()
<< "hasn't valid parent blogging platform"
<< acc->GetParentBloggingPlatform ();
return;
}
Ui_.Profile_->setEnabled ((ibp->GetFeatures () &
IBloggingPlatform::BPFSupportsProfiles) &&
acc->IsValidated ());
}
}
示例11: qWarning
void AccountsListWidget::handleAccountValidated (QObject *accObj, bool validated)
{
IAccount *acc = qobject_cast<IAccount*> (accObj);
if (!acc)
{
qWarning () << Q_FUNC_INFO
<< accObj
<< "is not an IAccount";
return;
}
if (!Account2Item_.contains (acc))
{
qWarning () << Q_FUNC_INFO
<< "account"
<< acc->GetAccountName ()
<< acc->GetObject ()
<< "from"
<< sender ()
<< "not found here";
return;
}
QStandardItem *item = Account2Item_ [acc];
AccountsModel_->item (item->row (), Columns::IsValidated)->setText (validated ?
tr ("Validated") :
tr ("Not validated"));
Ui_.Accounts_->header ()->setResizeMode (QHeaderView::ResizeToContents);
}
示例12: 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);
}
}
示例13: on_Modify__released
void AccountsListWidget::on_Modify__released ()
{
QModelIndex index = Ui_.Accounts_->selectionModel ()->currentIndex ();
if (!index.isValid ())
return;
IAccount *acc = index.data (RAccObj).value<IAccount*> ();
acc->OpenConfigurationDialog ();
}
示例14: DeletePassword
void Core::DeletePassword (QObject *accObj)
{
IAccount *account = qobject_cast<IAccount*> (accObj);
QVariantList keys;
keys << account->GetAccountID ();
Entity e = Util::MakeEntity (keys,
QString (),
Internal,
"x-leechcraft/data-persistent-clear");
emit gotEntity (e);
}
示例15: handleItemChanged
void AccountsListWidget::handleItemChanged (QStandardItem *item)
{
const auto type = item->data (Roles::RItemType).toInt ();
if (type != ItemTypes::ShowInRoster)
return;
IAccount *acc = item->data (Roles::RAccObj).value<IAccount*> ();
acc->SetShownInRoster (item->checkState () == Qt::Checked);
if (!acc->IsShownInRoster () && acc->GetState ().State_ != SOffline)
acc->ChangeState (EntryStatus (SOffline, QString ()));
emit accountVisibilityChanged (acc);
}