mirror of https://github.com/procxx/kepka.git
Show Info if writing is forbidden.
This commit is contained in:
parent
48cbdd9d40
commit
1a4d326abb
|
@ -169,6 +169,7 @@ void AuthSessionData::setTabbedSelectorSectionEnabled(bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
setThirdSectionInfoEnabled(false);
|
setThirdSectionInfoEnabled(false);
|
||||||
}
|
}
|
||||||
|
setTabbedReplacedWithInfo(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AuthSessionData::setThirdSectionInfoEnabled(bool enabled) {
|
void AuthSessionData::setThirdSectionInfoEnabled(bool enabled) {
|
||||||
|
@ -177,10 +178,18 @@ void AuthSessionData::setThirdSectionInfoEnabled(bool enabled) {
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
setTabbedSelectorSectionEnabled(false);
|
setTabbedSelectorSectionEnabled(false);
|
||||||
}
|
}
|
||||||
|
setTabbedReplacedWithInfo(false);
|
||||||
_thirdSectionInfoEnabledValue.fire_copy(enabled);
|
_thirdSectionInfoEnabledValue.fire_copy(enabled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AuthSessionData::setTabbedReplacedWithInfo(bool enabled) {
|
||||||
|
if (_tabbedReplacedWithInfo != enabled) {
|
||||||
|
_tabbedReplacedWithInfo = enabled;
|
||||||
|
_tabbedReplacedWithInfoValue.fire_copy(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString AuthSessionData::getSoundPath(const QString &key) const {
|
QString AuthSessionData::getSoundPath(const QString &key) const {
|
||||||
auto it = _variables.soundOverrides.constFind(key);
|
auto it = _variables.soundOverrides.constFind(key);
|
||||||
if (it != _variables.soundOverrides.end()) {
|
if (it != _variables.soundOverrides.end()) {
|
||||||
|
|
|
@ -110,6 +110,14 @@ public:
|
||||||
return _thirdSectionInfoEnabledValue.events_starting_with(
|
return _thirdSectionInfoEnabledValue.events_starting_with(
|
||||||
thirdSectionInfoEnabled());
|
thirdSectionInfoEnabled());
|
||||||
}
|
}
|
||||||
|
bool tabbedReplacedWithInfo() const {
|
||||||
|
return _tabbedReplacedWithInfo;
|
||||||
|
}
|
||||||
|
void setTabbedReplacedWithInfo(bool enabled);
|
||||||
|
rpl::producer<bool> tabbedReplacedWithInfoValue() const {
|
||||||
|
return _tabbedReplacedWithInfoValue.events_starting_with(
|
||||||
|
tabbedReplacedWithInfo());
|
||||||
|
}
|
||||||
void setSmallDialogsList(bool enabled) {
|
void setSmallDialogsList(bool enabled) {
|
||||||
_variables.smallDialogsList = enabled;
|
_variables.smallDialogsList = enabled;
|
||||||
}
|
}
|
||||||
|
@ -183,6 +191,8 @@ private:
|
||||||
base::Observable<void> _pendingHistoryResize;
|
base::Observable<void> _pendingHistoryResize;
|
||||||
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
base::Observable<ItemVisibilityQuery> _queryItemVisibility;
|
||||||
rpl::event_stream<bool> _thirdSectionInfoEnabledValue;
|
rpl::event_stream<bool> _thirdSectionInfoEnabledValue;
|
||||||
|
bool _tabbedReplacedWithInfo = false;
|
||||||
|
rpl::event_stream<bool> _tabbedReplacedWithInfoValue;
|
||||||
|
|
||||||
Variables _variables;
|
Variables _variables;
|
||||||
TimeMs _lastTimeVideoPlayedAt = 0;
|
TimeMs _lastTimeVideoPlayedAt = 0;
|
||||||
|
|
|
@ -3760,7 +3760,12 @@ void HistoryWidget::topBarClick() {
|
||||||
void HistoryWidget::pushTabbedSelectorToThirdSection() {
|
void HistoryWidget::pushTabbedSelectorToThirdSection() {
|
||||||
if (!_history || !_tabbedPanel) {
|
if (!_history || !_tabbedPanel) {
|
||||||
return;
|
return;
|
||||||
|
} else if (!_canSendMessages) {
|
||||||
|
Auth().data().setTabbedReplacedWithInfo(true);
|
||||||
|
controller()->showPeerInfo(_peer);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
Auth().data().setTabbedReplacedWithInfo(false);
|
||||||
_tabbedSelectorToggle->setColorOverrides(
|
_tabbedSelectorToggle->setColorOverrides(
|
||||||
&st::historyAttachEmojiActive,
|
&st::historyAttachEmojiActive,
|
||||||
&st::historyRecordVoiceFgActive,
|
&st::historyRecordVoiceFgActive,
|
||||||
|
@ -5899,6 +5904,7 @@ void HistoryWidget::fullPeerUpdated(PeerData *peer) {
|
||||||
bool newCanSendMessages = canSendMessages(_peer);
|
bool newCanSendMessages = canSendMessages(_peer);
|
||||||
if (newCanSendMessages != _canSendMessages) {
|
if (newCanSendMessages != _canSendMessages) {
|
||||||
_canSendMessages = newCanSendMessages;
|
_canSendMessages = newCanSendMessages;
|
||||||
|
controller()->historyPeerCanWriteChanged().notify(_peer);
|
||||||
if (!_canSendMessages) {
|
if (!_canSendMessages) {
|
||||||
cancelReply();
|
cancelReply();
|
||||||
}
|
}
|
||||||
|
@ -5937,6 +5943,7 @@ void HistoryWidget::handlePeerUpdate() {
|
||||||
bool newCanSendMessages = canSendMessages(_peer);
|
bool newCanSendMessages = canSendMessages(_peer);
|
||||||
if (newCanSendMessages != _canSendMessages) {
|
if (newCanSendMessages != _canSendMessages) {
|
||||||
_canSendMessages = newCanSendMessages;
|
_canSendMessages = newCanSendMessages;
|
||||||
|
controller()->historyPeerCanWriteChanged().notify(_peer);
|
||||||
if (!_canSendMessages) {
|
if (!_canSendMessages) {
|
||||||
cancelReply();
|
cancelReply();
|
||||||
}
|
}
|
||||||
|
|
|
@ -169,13 +169,10 @@ MainWidget::MainWidget(
|
||||||
checkFloatPlayerVisibility();
|
checkFloatPlayerVisibility();
|
||||||
});
|
});
|
||||||
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
|
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
|
||||||
if (!peer) {
|
updateThirdColumnToCurrentPeer(peer);
|
||||||
_thirdSection.destroy();
|
});
|
||||||
_thirdShadow.destroy();
|
subscribe(_controller->historyPeerCanWriteChanged(), [this](PeerData *peer) {
|
||||||
} else if (Adaptive::ThreeColumn()
|
updateThirdColumnToCurrentPeer(peer);
|
||||||
&& Auth().data().thirdSectionInfoEnabled()) {
|
|
||||||
_controller->showPeerInfo(peer, anim::type::instant);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QCoreApplication::instance()->installEventFilter(this);
|
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() {
|
void MainWidget::updateMediaPlayerPosition() {
|
||||||
_playerPanel->moveToRight(0, 0);
|
_playerPanel->moveToRight(0, 0);
|
||||||
if (_player && _playerVolume) {
|
if (_player && _playerVolume) {
|
||||||
|
|
|
@ -500,6 +500,7 @@ private:
|
||||||
void updateMediaPlaylistPosition(int x);
|
void updateMediaPlaylistPosition(int x);
|
||||||
void updateControlsGeometry();
|
void updateControlsGeometry();
|
||||||
void updateDialogsWidthAnimated();
|
void updateDialogsWidthAnimated();
|
||||||
|
void updateThirdColumnToCurrentPeer(PeerData *peer);
|
||||||
|
|
||||||
void createPlayer();
|
void createPlayer();
|
||||||
void switchToPanelPlayer();
|
void switchToPanelPlayer();
|
||||||
|
|
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
*/
|
*/
|
||||||
#include "window/top_bar_widget.h"
|
#include "window/top_bar_widget.h"
|
||||||
|
|
||||||
|
#include <rpl/combine.h>
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
#include "boxes/add_contact_box.h"
|
#include "boxes/add_contact_box.h"
|
||||||
#include "boxes/confirm_box.h"
|
#include "boxes/confirm_box.h"
|
||||||
|
@ -100,9 +101,11 @@ TopBarWidget::TopBarWidget(
|
||||||
subscribe(Global::RefPhoneCallsEnabledChanged(), [this] {
|
subscribe(Global::RefPhoneCallsEnabledChanged(), [this] {
|
||||||
updateControlsVisibility(); });
|
updateControlsVisibility(); });
|
||||||
|
|
||||||
Auth().data().thirdSectionInfoEnabledValue()
|
rpl::combine(
|
||||||
|
Auth().data().thirdSectionInfoEnabledValue(),
|
||||||
|
Auth().data().tabbedReplacedWithInfoValue())
|
||||||
| rpl::start(
|
| rpl::start(
|
||||||
[this](bool) { updateInfoToggleActive(); },
|
[this](auto&&) { updateInfoToggleActive(); },
|
||||||
lifetime());
|
lifetime());
|
||||||
|
|
||||||
setCursor(style::cur_pointer);
|
setCursor(style::cur_pointer);
|
||||||
|
@ -185,7 +188,8 @@ void TopBarWidget::showMenu() {
|
||||||
|
|
||||||
void TopBarWidget::toggleInfoSection() {
|
void TopBarWidget::toggleInfoSection() {
|
||||||
if (Adaptive::ThreeColumn()
|
if (Adaptive::ThreeColumn()
|
||||||
&& Auth().data().thirdSectionInfoEnabled()) {
|
&& (Auth().data().thirdSectionInfoEnabled()
|
||||||
|
|| Auth().data().tabbedReplacedWithInfo())) {
|
||||||
_controller->closeThirdSection();
|
_controller->closeThirdSection();
|
||||||
} else if (auto peer = App::main()->historyPeer()) {
|
} else if (auto peer = App::main()->historyPeer()) {
|
||||||
if (_controller->canShowThirdSection()) {
|
if (_controller->canShowThirdSection()) {
|
||||||
|
@ -474,7 +478,8 @@ void TopBarWidget::updateAdaptiveLayout() {
|
||||||
|
|
||||||
void TopBarWidget::updateInfoToggleActive() {
|
void TopBarWidget::updateInfoToggleActive() {
|
||||||
auto infoThirdActive = Adaptive::ThreeColumn()
|
auto infoThirdActive = Adaptive::ThreeColumn()
|
||||||
&& Auth().data().thirdSectionInfoEnabled();
|
&& (Auth().data().thirdSectionInfoEnabled()
|
||||||
|
|| Auth().data().tabbedReplacedWithInfo());
|
||||||
auto iconOverride = infoThirdActive
|
auto iconOverride = infoThirdActive
|
||||||
? &st::topBarInfoActive
|
? &st::topBarInfoActive
|
||||||
: nullptr;
|
: nullptr;
|
||||||
|
|
|
@ -63,6 +63,9 @@ public:
|
||||||
base::Observable<PeerData*> &historyPeerChanged() {
|
base::Observable<PeerData*> &historyPeerChanged() {
|
||||||
return _historyPeerChanged;
|
return _historyPeerChanged;
|
||||||
}
|
}
|
||||||
|
base::Observable<PeerData*> &historyPeerCanWriteChanged() {
|
||||||
|
return _historyPeerCanWriteChanged;
|
||||||
|
}
|
||||||
|
|
||||||
void enableGifPauseReason(GifPauseReason reason);
|
void enableGifPauseReason(GifPauseReason reason);
|
||||||
void disableGifPauseReason(GifPauseReason reason);
|
void disableGifPauseReason(GifPauseReason reason);
|
||||||
|
@ -152,6 +155,7 @@ private:
|
||||||
|
|
||||||
base::Observable<PeerData*> _searchInPeerChanged;
|
base::Observable<PeerData*> _searchInPeerChanged;
|
||||||
base::Observable<PeerData*> _historyPeerChanged;
|
base::Observable<PeerData*> _historyPeerChanged;
|
||||||
|
base::Observable<PeerData*> _historyPeerCanWriteChanged;
|
||||||
|
|
||||||
GifPauseReasons _gifPauseReasons = 0;
|
GifPauseReasons _gifPauseReasons = 0;
|
||||||
base::Observable<void> _gifPauseLevelChanged;
|
base::Observable<void> _gifPauseLevelChanged;
|
||||||
|
|
Loading…
Reference in New Issue