2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Show Info if writing is forbidden.

This commit is contained in:
John Preston
2017-09-19 22:44:34 +03:00
parent 48cbdd9d40
commit 1a4d326abb
7 changed files with 68 additions and 11 deletions

View File

@@ -169,13 +169,10 @@ MainWidget::MainWidget(
checkFloatPlayerVisibility();
});
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
if (!peer) {
_thirdSection.destroy();
_thirdShadow.destroy();
} else if (Adaptive::ThreeColumn()
&& Auth().data().thirdSectionInfoEnabled()) {
_controller->showPeerInfo(peer, anim::type::instant);
}
updateThirdColumnToCurrentPeer(peer);
});
subscribe(_controller->historyPeerCanWriteChanged(), [this](PeerData *peer) {
updateThirdColumnToCurrentPeer(peer);
});
QCoreApplication::instance()->installEventFilter(this);
@@ -3529,6 +3526,30 @@ void MainWidget::updateDialogsWidthAnimated() {
}
}
void MainWidget::updateThirdColumnToCurrentPeer(PeerData *peer) {
if (Adaptive::ThreeColumn()
&& Auth().data().tabbedSelectorSectionEnabled()
&& peer) {
if (!peer->canWrite()) {
_controller->showPeerInfo(peer);
Auth().data().setTabbedSelectorSectionEnabled(true);
Auth().data().setTabbedReplacedWithInfo(true);
} else if (Auth().data().tabbedReplacedWithInfo()) {
Auth().data().setTabbedReplacedWithInfo(false);
_history->pushTabbedSelectorToThirdSection();
}
} else {
Auth().data().setTabbedReplacedWithInfo(false);
if (!peer) {
_thirdSection.destroy();
_thirdShadow.destroy();
} else if (Adaptive::ThreeColumn()
&& Auth().data().thirdSectionInfoEnabled()) {
_controller->showPeerInfo(peer, anim::type::instant);
}
}
}
void MainWidget::updateMediaPlayerPosition() {
_playerPanel->moveToRight(0, 0);
if (_player && _playerVolume) {