From 485a6b551f86358150ef9673c9249c900fa7f7e6 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sun, 6 Dec 2015 19:28:07 +0300 Subject: [PATCH] music player glitch fixed, added phrase about the members viewing in channels --- Telegram/Resources/lang.strings | 1 + Telegram/SourceFiles/boxes/contactsbox.cpp | 17 +++++++++++++++-- Telegram/SourceFiles/boxes/contactsbox.h | 4 ++++ Telegram/SourceFiles/mainwidget.cpp | 2 ++ 4 files changed, 22 insertions(+), 2 deletions(-) diff --git a/Telegram/Resources/lang.strings b/Telegram/Resources/lang.strings index a56ffb0fa9fc3c..f9877845b83df5 100644 --- a/Telegram/Resources/lang.strings +++ b/Telegram/Resources/lang.strings @@ -431,6 +431,7 @@ Copyright (c) 2014-2015 John Preston, https://desktop.telegram.org "lng_channel_add_admins" = "New administrator"; "lng_channel_add_members" = "Add members"; "lng_channel_members" = "Members"; +"lng_channel_only_last_shown" = "Only last {count:_not_used_|# member|# members} are shown here"; "lng_channel_admins" = "Administrators"; "lng_channel_add_admin" = "Add Administrator"; "lng_channel_admin_sure" = "Add {user} to administrators?"; diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 3c6c7b18dee8af..7b980133af4804 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -1773,7 +1773,10 @@ MembersInner::MembersInner(ChannelData *channel, MembersFilter filter) : TWidget , _kickRequestId(0) , _kickBox(0) , _loading(true) -, _loadingRequestId(0) { +, _loadingRequestId(0) +, _aboutWidth(st::boxWideWidth - st::contactsPadding.left() - st::contactsPhotoSize - st::contactsPadding.left() - st::contactsPadding.right()) +, _about(_aboutWidth) +, _aboutHeight(0) { connect(App::wnd(), SIGNAL(imageLoaded()), this, SLOT(update())); connect(App::main(), SIGNAL(peerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&)), this, SLOT(onPeerNameChanged(PeerData*, const PeerData::Names&, const PeerData::NameFirstChars&))); connect(App::main(), SIGNAL(peerPhotoChanged(PeerData*)), this, SLOT(peerUpdated(PeerData*))); @@ -1824,6 +1827,10 @@ void MembersInner::paintEvent(QPaintEvent *e) { paintDialog(p, _rows[from], data(from), sel, kickSel, kickDown); p.translate(0, _rowHeight); } + if (to == _rows.size() && (_rows.size() < _channel->count || _rows.size() >= cMaxGroupCount())) { + p.setPen(st::stickersReorderFg); + _about.drawLeft(p, st::contactsPadding.left() + st::contactsPhotoSize + st::contactsPadding.left(), st::stickersReorderPadding.top(), _aboutWidth, width()); + } } } @@ -1995,8 +2002,14 @@ void MembersInner::chooseParticipant() { void MembersInner::refresh() { if (_rows.isEmpty()) { resize(width(), st::membersPadding.top() + st::noContactsHeight + st::membersPadding.bottom()); + _aboutHeight = 0; } else { - resize(width(), st::membersPadding.top() + _newItemHeight + _rows.size() * _rowHeight + st::membersPadding.bottom()); + _about.setText(st::boxTextFont, lng_channel_only_last_shown(lt_count, _rows.size())); + _aboutHeight = st::stickersReorderPadding.top() + _about.countHeight(_aboutWidth) + st::stickersReorderPadding.bottom(); + if (_rows.size() >= _channel->count && _rows.size() < cMaxGroupCount()) { + _aboutHeight = 0; + } + resize(width(), st::membersPadding.top() + _newItemHeight + _rows.size() * _rowHeight + st::membersPadding.bottom() + _aboutHeight); } update(); } diff --git a/Telegram/SourceFiles/boxes/contactsbox.h b/Telegram/SourceFiles/boxes/contactsbox.h index 994c547c7ae3ee..669e039f3078be 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.h +++ b/Telegram/SourceFiles/boxes/contactsbox.h @@ -386,6 +386,10 @@ public slots: MemberRoles _roles; MemberDatas _datas; + int32 _aboutWidth; + Text _about; + int32 _aboutHeight; + QPoint _lastMousePos; }; diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index 0fa3ed35e9346f..7c5e1a05709ede 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -2716,6 +2716,7 @@ void MainWidget::hideAll() { _topBar.hide(); _mediaType.hide(); _player.hide(); + _playerHeight = 0; } void MainWidget::showAll() { @@ -2790,6 +2791,7 @@ void MainWidget::showAll() { } } } + resizeEvent(0); App::wnd()->checkHistoryActivation(); }