Exemplo n.º 1
0
void InnerWidget::createBlocks() {
	auto user = _peer->asUser();
	auto chat = _peer->asChat();
	auto channel = _peer->asChannel();
	auto megagroup = _peer->isMegagroup() ? channel : nullptr;
	if (user || channel || megagroup) {
		_blocks.push_back({ new InfoWidget(this, _peer), BlockSide::Right });
	}
	_blocks.push_back({ new SettingsWidget(this, _peer), BlockSide::Right });
	if (chat || channel || megagroup) {
		_blocks.push_back({ new InviteLinkWidget(this, _peer), BlockSide::Right });
	}
	_blocks.push_back({ new SharedMediaWidget(this, _peer), BlockSide::Right });
	if (channel && !megagroup) {
		_blocks.push_back({ new ChannelMembersWidget(this, _peer), BlockSide::Right });
	}
	_blocks.push_back({ new ActionsWidget(this, _peer), BlockSide::Right });
	if (chat || megagroup) {
		auto membersWidget = new MembersWidget(this, _peer);
		connect(membersWidget, SIGNAL(onlineCountUpdated(int)), _cover, SLOT(onOnlineCountUpdated(int)));
		_cover->onOnlineCountUpdated(membersWidget->onlineCount());
		_blocks.push_back({ membersWidget, BlockSide::Left });
	}
	for_const (auto &blockData, _blocks) {
		connect(blockData.block, SIGNAL(heightUpdated()), this, SLOT(onBlockHeightUpdated()));
	}
Exemplo n.º 2
0
/**
* \brief 初始化排队系统
* \author fqnewman
*/
bool CSortM::init()
{
	//FunctionTimes times(69,__FUNCTION__);
	//bzero(leveltable, sizeof(leveltable));
	const dbCol sortlist_read_define[] = {
		{ "CHARID",			zDBConnPool::DB_DWORD,	sizeof(DWORD) }, 
		{ "LEVEL",			zDBConnPool::DB_WORD,	sizeof(WORD) }, 
		{ "EXP",			zDBConnPool::DB_QWORD,	sizeof(QWORD) }, 
		{ NULL, 0, 0}
	};

	struct 											// 数据库读取结构,请不要随意修改,修改注意更新所有代码
	{
		DWORD		dwCharID;  			// 角色ID
		WORD		wdLevel;   			// 人物等级
		QWORD 		qwExp;				// 人物经验
	}__attribute__ ((packed))	*recordList,*tempPoint;

	recordList = NULL;
	connHandleID handle = SessionService::dbConnPool->getHandle();
	if ((connHandleID)-1 == handle)
	{
		Zebra::logger->error("不能获取数据库句柄");
		return false;
	}

	unsigned int retcode = SessionService::dbConnPool->exeSelect(handle, "`SORTLIST`", sortlist_read_define, NULL, NULL, (BYTE **)&recordList);
	SessionService::dbConnPool->putHandle(handle);
	if ((unsigned int)-1 == retcode
			|| 0 == retcode)
	{
		return true;
	}
	if (recordList)
	{
		tempPoint = &recordList[0];
		for (unsigned int i=0; i< retcode; i++)
		{
			onlineCount(tempPoint->dwCharID, tempPoint->wdLevel, tempPoint->qwExp);
			tempPoint++;
		}
		SAFE_DELETE_VEC(recordList);
		return true;
	}
	else
	{
		Zebra::logger->error("角色排序数据初始化失败,exeSelect 返回无效buf指针");
	}
	return false;
}
Exemplo n.º 3
0
/**
* \brief 角色上线处理
* \param pUser 当前角色
* \author fqnewman
*/
void CSortM::onlineCount(UserSession *pUser)
{
	if (pUser->id <=100) return;
	onlineCount(pUser->id, pUser->level, pUser->qwExp);
}