mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
merged to master
This commit is contained in:
@@ -59,10 +59,14 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
||||
// shared media
|
||||
_allMediaTypes(false),
|
||||
_mediaShowAll(this, lang(lng_profile_show_all_types)),
|
||||
_mediaPhotos(this, QString()),
|
||||
_mediaVideos(this, QString()),
|
||||
_mediaDocuments(this, QString()),
|
||||
_mediaAudios(this, QString()),
|
||||
|
||||
// actions
|
||||
_searchInPeer(this, lang(lng_profile_search_messages)),
|
||||
_clearHistory(this, lang(lng_profile_clear_history)),
|
||||
_deleteConversation(this, lang(_peer->chat ? lng_profile_clear_and_exit : lng_profile_delete_conversation)),
|
||||
_wasBlocked(_peerUser ? _peerUser->blocked : UserBlockUnknown),
|
||||
_blockRequest(0),
|
||||
_blockUser(this, lang((_peerUser && _peerUser->botInfo) ? lng_profile_block_bot : lng_profile_block_user), st::btnRedLink),
|
||||
|
||||
// actions
|
||||
_searchInPeer(this, lang(lng_profile_search_messages)),
|
||||
@@ -86,7 +90,7 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
||||
if (_peerUser->blocked == UserIsBlocked) {
|
||||
_blockUser.setText(lang(_peerUser->botInfo ? lng_profile_unblock_bot : lng_profile_unblock_user));
|
||||
}
|
||||
_phoneText = App::formatPhone(_peerUser->phone);
|
||||
_phoneText = App::formatPhone(_peerUser->phone.isEmpty() ? App::phoneFromSharedContact(App::userFromPeer(_peerUser->id)) : _peerUser->phone);
|
||||
PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0;
|
||||
if (userPhoto && userPhoto->date) {
|
||||
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
|
||||
@@ -161,14 +165,11 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
|
||||
|
||||
// shared media
|
||||
connect(&_mediaShowAll, SIGNAL(clicked()), this, SLOT(onMediaShowAll()));
|
||||
connect(&_mediaPhotos, SIGNAL(clicked()), this, SLOT(onMediaPhotos()));
|
||||
connect(&_mediaVideos, SIGNAL(clicked()), this, SLOT(onMediaVideos()));
|
||||
connect(&_mediaDocuments, SIGNAL(clicked()), this, SLOT(onMediaDocuments()));
|
||||
connect(&_mediaAudios, SIGNAL(clicked()), this, SLOT(onMediaAudios()));
|
||||
_mediaLinks[OverviewPhotos] = &_mediaPhotos;
|
||||
_mediaLinks[OverviewVideos] = &_mediaVideos;
|
||||
_mediaLinks[OverviewDocuments] = &_mediaDocuments;
|
||||
_mediaLinks[OverviewAudios] = &_mediaAudios;
|
||||
connect((_mediaButtons[OverviewPhotos] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaPhotos()));
|
||||
connect((_mediaButtons[OverviewVideos] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaVideos()));
|
||||
connect((_mediaButtons[OverviewDocuments] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaDocuments()));
|
||||
connect((_mediaButtons[OverviewAudios] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaAudios()));
|
||||
connect((_mediaButtons[OverviewLinks] = new LinkButton(this, QString())), SIGNAL(clicked()), this, SLOT(onMediaLinks()));
|
||||
App::main()->preloadOverviews(_peer);
|
||||
|
||||
// actions
|
||||
@@ -216,7 +217,7 @@ void ProfileInner::loadProfilePhotos(int32 yFrom) {
|
||||
int32 yTo = yFrom + (parentWidget() ? parentWidget()->height() : App::wnd()->height()) * 5;
|
||||
MTP::clearLoaderPriorities();
|
||||
|
||||
int32 partfrom = _mediaAudios.y() + _mediaAudios.height() + st::profileHeaderSkip;
|
||||
int32 partfrom = _mediaButtons[OverviewAudios]->y() + _mediaButtons[OverviewAudios]->height() + st::profileHeaderSkip;
|
||||
yFrom -= partfrom;
|
||||
yTo -= partfrom;
|
||||
|
||||
@@ -361,6 +362,10 @@ void ProfileInner::onMediaAudios() {
|
||||
App::main()->showMediaOverview(_peer, OverviewAudios);
|
||||
}
|
||||
|
||||
void ProfileInner::onMediaLinks() {
|
||||
App::main()->showMediaOverview(_peer, OverviewLinks);
|
||||
}
|
||||
|
||||
void ProfileInner::onInvitationLink() {
|
||||
QApplication::clipboard()->setText(_peerChat->invitationUrl);
|
||||
App::wnd()->showLayer(new ConfirmBox(lang(lng_group_invite_copied), true));
|
||||
@@ -437,7 +442,7 @@ void ProfileInner::peerUpdated(PeerData *data) {
|
||||
if (data == _peer) {
|
||||
PhotoData *photo = 0;
|
||||
if (_peerUser) {
|
||||
_phoneText = App::formatPhone(_peerUser->phone);
|
||||
_phoneText = App::formatPhone(_peerUser->phone.isEmpty() ? App::phoneFromSharedContact(App::userFromPeer(_peerUser->id)) : _peerUser->phone);
|
||||
if (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) photo = App::photo(_peerUser->photoId);
|
||||
if (_wasBlocked != _peerUser->blocked) {
|
||||
_wasBlocked = _peerUser->blocked;
|
||||
@@ -652,7 +657,7 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
|
||||
if (!_allMediaTypes) {
|
||||
break;
|
||||
}
|
||||
top += _mediaLinks[i]->height() + st::setLittleSkip;
|
||||
top += _mediaButtons[i]->height() + st::setLittleSkip;
|
||||
}
|
||||
}
|
||||
if (_allMediaTypes) {
|
||||
@@ -660,13 +665,13 @@ void ProfileInner::paintEvent(QPaintEvent *e) {
|
||||
top -= st::setLittleSkip;
|
||||
} else {
|
||||
p.drawText(_left, top + st::linkFont->ascent, lang(oneState < 0 ? lng_profile_loading : lng_profile_no_media));
|
||||
top += _mediaLinks[OverviewPhotos]->height();
|
||||
top += _mediaButtons[OverviewPhotos]->height();
|
||||
}
|
||||
} else {
|
||||
if (!oneState) {
|
||||
p.drawText(_left, top + st::linkFont->ascent, lang(lng_profile_no_media));
|
||||
}
|
||||
top += _mediaLinks[OverviewPhotos]->height();
|
||||
top += _mediaButtons[OverviewPhotos]->height();
|
||||
}
|
||||
|
||||
// actions
|
||||
@@ -934,13 +939,23 @@ void ProfileInner::resizeEvent(QResizeEvent *e) {
|
||||
if (_allMediaTypes) {
|
||||
int32 count = (_hist->_overviewCount[i] > 0) ? _hist->_overviewCount[i] : (_hist->_overviewCount[i] == 0 ? _hist->_overview[i].size() : -1);
|
||||
if (count > 0) {
|
||||
if (wasCount) top += _mediaLinks[i]->height() + st::setLittleSkip;
|
||||
if (wasCount) top += _mediaButtons[i]->height() + st::setLittleSkip;
|
||||
wasCount = count;
|
||||
}
|
||||
}
|
||||
_mediaLinks[i]->move(_left, top);
|
||||
_mediaButtons[i]->move(_left, top);
|
||||
}
|
||||
top += _mediaButtons[OverviewPhotos]->height();
|
||||
|
||||
// actions
|
||||
top += st::profileHeaderSkip;
|
||||
_searchInPeer.move(_left, top); top += _searchInPeer.height() + st::setLittleSkip;
|
||||
_clearHistory.move(_left, top); top += _clearHistory.height() + st::setLittleSkip;
|
||||
_deleteConversation.move(_left, top); top += _deleteConversation.height();
|
||||
if (_peerUser && App::userFromPeer(_peerUser->id) != MTP::authedId()) {
|
||||
top += st::setSectionSkip;
|
||||
_blockUser.move(_left, top); top += _blockUser.height();
|
||||
}
|
||||
top += _mediaLinks[OverviewPhotos]->height();
|
||||
|
||||
// actions
|
||||
top += st::profileHeaderSkip;
|
||||
@@ -1131,17 +1146,17 @@ void ProfileInner::showAll() {
|
||||
if (count > 0 || count < 0) {
|
||||
first = true;
|
||||
} else if (!_allMediaTypes) {
|
||||
_mediaLinks[i]->hide();
|
||||
_mediaButtons[i]->hide();
|
||||
continue;
|
||||
}
|
||||
if (count > 0) {
|
||||
_mediaLinks[i]->setText(overviewLinkText(i, count));
|
||||
_mediaLinks[i]->show();
|
||||
_mediaButtons[i]->setText(overviewLinkText(i, count));
|
||||
_mediaButtons[i]->show();
|
||||
} else {
|
||||
_mediaLinks[i]->hide();
|
||||
_mediaButtons[i]->hide();
|
||||
}
|
||||
} else {
|
||||
_mediaLinks[i]->hide();
|
||||
_mediaButtons[i]->hide();
|
||||
}
|
||||
}
|
||||
if (_allMediaTypes || !manyCounts) {
|
||||
@@ -1208,6 +1223,7 @@ QString ProfileInner::overviewLinkText(int32 type, int32 count) {
|
||||
case OverviewVideos: return lng_profile_videos(lt_count, count);
|
||||
case OverviewDocuments: return lng_profile_files(lt_count, count);
|
||||
case OverviewAudios: return lng_profile_audios(lt_count, count);
|
||||
case OverviewLinks: return lng_profile_shared_links(lt_count, count);
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user