コード例 #1
0
ファイル: newgroupbox.cpp プロジェクト: 2k13yr/tdesktop
void NewGroupInner::paintDialog(QPainter &p, DialogRow *row, bool sel) {
	int32 left = st::profileListPadding.width();

	UserData *user = row->history->peer->asUser();
	ContactData *data = contactData(row);

	if (_selCount >= cMaxGroupCount() && !data->check) {
		sel = false;
	}

	if (sel || data->check) {
		p.fillRect(0, 0, width(), 2 * st::profileListPadding.height() + st::profileListPhotoSize, (data->check ? st::profileActiveBG : st::profileHoverBG)->b);
	}

	p.drawPixmap(left, st::profileListPadding.height(), user->photo->pix(st::profileListPhotoSize));

	if (data->check) {
		p.setPen(st::white->p);
	} else {
		p.setPen(st::profileListNameColor->p);
	}
	data->name.drawElided(p, left + st::profileListPhotoSize + st::participantDelta, st::profileListNameTop, width() - st::profileListPadding.width() - st::profileListPhotoSize - st::profileListPadding.width() - st::participantDelta - st::scrollDef.width - st::profileCheckRect.pxWidth());

	if (sel || data->check) {
		p.drawPixmap(QPoint(width() - st::profileCheckRect.pxWidth() - st::profileCheckDeltaX, st::profileListPadding.height() + (st::profileListPhotoSize - st::profileCheckRect.pxHeight()) / 2 - st::profileCheckDeltaY), App::sprite(), (data->check ? st::profileCheckActiveRect : st::profileCheckRect));
	}

	p.setFont(st::profileSubFont->f);
	if (data->check) {
		p.setPen(st::white->p);
	} else {
		p.setPen((user->onlineTill >= _time ? st::profileOnlineColor : st::profileOfflineColor)->p);
	}
	p.drawText(left + st::profileListPhotoSize + st::participantDelta, st::profileListPadding.height() + st::profileListPhotoSize - 6, data->online);
}
コード例 #2
0
ファイル: newgroupbox.cpp プロジェクト: 2k13yr/tdesktop
void NewGroupInner::changeCheckState(DialogRow *row) {
	if (contactData(row)->check) {
		contactData(row)->check = false;
		--_selCount;
	} else if (_selCount < cMaxGroupCount()) {
		contactData(row)->check = true;
		++_selCount;
	}
}
コード例 #3
0
void AddParticipantInner::changeCheckState(DialogRow *row) {
	if (contactData(row)->check) {
		contactData(row)->check = false;
		--_selCount;
	} else if (_selCount + _chat->count < cMaxGroupCount()) {
		contactData(row)->check = true;
		++_selCount;
	}
}
コード例 #4
0
void ProfileInner::showAll() {
	if (_peerChat) {
		_sendMessage.hide();
		_shareContact.hide();
		if (_peerChat->forbidden) {
			_uploadPhoto.hide();
			_cancelPhoto.hide();
			_addParticipant.hide();
		} else {
			if (App::app()->isPhotoUpdating(_peer->id)) {
				_uploadPhoto.hide();
				_cancelPhoto.show();
			} else {
				_uploadPhoto.show();
				_cancelPhoto.hide();
			}
			if (_peerChat->count < cMaxGroupCount()) {
				_addParticipant.show();
			} else {
				_addParticipant.hide();
			}
		}
		_enableNotifications.show();
		_clearHistory.hide();
	} else {
		_uploadPhoto.hide();
		_cancelPhoto.hide();
		_addParticipant.hide();
		_sendMessage.show();
		if (_peerUser->phone.isEmpty()) {
			_shareContact.hide();
		} else {
			_shareContact.show();
		}
		_enableNotifications.show();
		_clearHistory.show();
	}
	updateNotifySettings();

	// participants
	reorderParticipants();
	int32 h;
	if (_peerUser) {
		h = _clearHistory.y() + _clearHistory.height() + st::profileHeaderSkip;
	} else {
		h = _enableNotifications.y() + _enableNotifications.height() + st::profileHeaderSkip;
		if (!_participants.isEmpty()) {
			h += st::profileHeaderSkip + _participants.size() * _pHeight;
		} else if (_peerChat->count > 0) {
			h += st::profileHeaderSkip;
		}
	}
	resize(width(), h);
}
コード例 #5
0
ファイル: confirmbox.cpp プロジェクト: neuroidss/tdesktop
MaxInviteBox::MaxInviteBox(const QString &link) : AbstractBox(st::boxWidth),
_close(this, lang(lng_box_ok), st::defaultBoxButton),
_text(st::boxTextFont, lng_participant_invite_sorry(lt_count, cMaxGroupCount()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right()),
_link(link), _linkOver(false),
a_goodOpacity(0, 0), a_good(animFunc(this, &MaxInviteBox::goodAnimStep)) {
	setMouseTracking(true);

	_textWidth = st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right();
	_textHeight = qMin(_text.countHeight(_textWidth), 16 * int(st::boxTextStyle.lineHeight));
	setMaxHeight(st::boxPadding.top() + _textHeight + st::boxTextFont->height + st::boxTextFont->height * 2 + st::newGroupLinkPadding.bottom() + st::boxButtonPadding.top() + _close.height() + st::boxButtonPadding.bottom());

	connect(&_close, SIGNAL(clicked()), this, SLOT(onClose()));

	prepare();
}
コード例 #6
0
ファイル: apiwrap.cpp プロジェクト: MobinRanjbar/tdesktop
void ApiWrap::requestBots(ChannelData *peer) {
	if (!peer || !peer->isMegagroup() || _botsRequests.contains(peer)) return;
	_botsRequests.insert(peer, MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsBots(), MTP_int(0), MTP_int(cMaxGroupCount())), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer)));
}
コード例 #7
0
ファイル: apiwrap.cpp プロジェクト: MobinRanjbar/tdesktop
void ApiWrap::requestLastParticipants(ChannelData *peer, bool fromStart) {
	if (!peer || !peer->isMegagroup()) return;
	bool needAdmins = peer->amEditor(), adminsOutdated = (peer->mgInfo->lastParticipantsStatus & MegagroupInfo::LastParticipantsAdminsOutdated);
	if ((needAdmins && adminsOutdated) || peer->lastParticipantsCountOutdated()) {
		fromStart = true;
	}
	QMap<PeerData*, mtpRequestId>::iterator i = _participantsRequests.find(peer);
	if (i != _participantsRequests.cend()) {
		if (fromStart && i.value() < 0) { // was not loading from start
			_participantsRequests.erase(i);
		} else {
			return;
		}
	}
	mtpRequestId req = MTP::send(MTPchannels_GetParticipants(peer->inputChannel, MTP_channelParticipantsRecent(), MTP_int(fromStart ? 0 : peer->mgInfo->lastParticipants.size()), MTP_int(cMaxGroupCount())), rpcDone(&ApiWrap::lastParticipantsDone, peer), rpcFail(&ApiWrap::lastParticipantsFail, peer));
	_participantsRequests.insert(peer, fromStart ? req : -req);
}