コード例 #1
0
void OrderEntryRightPane::OnInstrumentSelected( Instrument* pInstrument, QString sOrderBook )
{
	
	QString sInstrument = pInstrument->map_Fields["Symbol"].toString();

	RightPaneMap::iterator itr = map_Items.find(sInstrument);
	if(itr!= map_Items.end())
	{
		return;
	}
	listWidget->addItem(sInstrument);
	
	RightPaneItem oItem(pInstrument,sOrderBook);
	map_Items.insert(sInstrument,oItem);

}
コード例 #2
0
// getUserInfo
zz::CUserList srv::CDataManager::getFriendList( uint unId )
{
	QSqlQuery oQuery;
	oQuery.prepare( "SELECT friend_id FROM friendship WHERE user_id = ?" );
	oQuery.bindValue( 0, unId );
	oQuery.exec( );
	checkExecution( oQuery );
	// Get friend id list
	QList<uint> lstFriendIDs;
	while (oQuery.next())
	{
		bool bOk = false;
		uint unFriendID = oQuery.value( 0 ).toUInt( &bOk );
		if (bOk)
			lstFriendIDs.append( unFriendID );
	}

	zz::CUserList lstFriends;
	for (int i = 0; i < lstFriendIDs.size(); ++i)
	{
		uint unFriendID = lstFriendIDs[i];
		oQuery.prepare( "SELECT user_id, first_name, last_name, avatar FROM user_info WHERE user_id = ?" );
		oQuery.bindValue( 0, unFriendID );
		oQuery.exec();
		checkExecution( oQuery );
		//
		uint    unUserId = oQuery.value( 0 ).toUInt();
		// Double check
		ZZ_ASSERT( unUserId == unFriendID );
		QString sFirstName = oQuery.value( 1 ).toString( );
		QString sLastName = oQuery.value( 2 ).toString( );
		QImage  imgAvatar = oQuery.value( 3 ).value<QImage>( );
		//
		zz::CUserListItem oItem( unUserId, sFirstName, sLastName, imgAvatar );
		lstFriends.append( oItem );
	}

	return lstFriends;
}