mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-30 23:38:25 +00:00
Hide send message in Info for current chat.
This commit is contained in:
parent
3db696d52f
commit
e1ba9f8ff8
@ -335,7 +335,7 @@ bool StickersListWidget::Footer::event(QEvent *e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
return TWidget::event(e);
|
||||
return InnerFooter::event(e);
|
||||
}
|
||||
|
||||
void StickersListWidget::Footer::updateSelected() {
|
||||
|
@ -843,7 +843,7 @@ void DialogsWidget::setSearchInPeer(PeerData *peer, UserData *from) {
|
||||
if (searchInPeerUpdated) {
|
||||
_searchInPeer = newSearchInPeer;
|
||||
from = nullptr;
|
||||
controller()->searchInPeerChanged().notify(_searchInPeer, true);
|
||||
controller()->searchInPeer = _searchInPeer;
|
||||
updateJumpToDateVisibility();
|
||||
} else if (!_searchInPeer) {
|
||||
from = nullptr;
|
||||
|
@ -578,7 +578,7 @@ bool HistoryInner::event(QEvent *e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QWidget::event(e);
|
||||
return TWidget::event(e);
|
||||
}
|
||||
|
||||
void HistoryInner::onTouchScrollTimer() {
|
||||
|
@ -1817,7 +1817,8 @@ void HistoryWidget::showHistory(const PeerId &peerId, MsgId showAtMsgId, bool re
|
||||
App::main()->dlgUpdated(wasHistory ? wasHistory->peer : nullptr, wasMsgId);
|
||||
emit historyShown(_history, _showAtMsgId);
|
||||
|
||||
controller()->historyPeerChanged().notify(_peer, true);
|
||||
controller()->historyCanWrite = _canSendMessages;
|
||||
controller()->historyPeer = _peer;
|
||||
update();
|
||||
}
|
||||
|
||||
@ -5913,7 +5914,7 @@ void HistoryWidget::fullPeerUpdated(PeerData *peer) {
|
||||
bool newCanSendMessages = canSendMessages(_peer);
|
||||
if (newCanSendMessages != _canSendMessages) {
|
||||
_canSendMessages = newCanSendMessages;
|
||||
controller()->historyPeerCanWriteChanged().notify(_peer);
|
||||
controller()->historyCanWrite = _canSendMessages;
|
||||
if (!_canSendMessages) {
|
||||
cancelReply();
|
||||
}
|
||||
@ -5952,7 +5953,7 @@ void HistoryWidget::handlePeerUpdate() {
|
||||
bool newCanSendMessages = canSendMessages(_peer);
|
||||
if (newCanSendMessages != _canSendMessages) {
|
||||
_canSendMessages = newCanSendMessages;
|
||||
controller()->historyPeerCanWriteChanged().notify(_peer);
|
||||
controller()->historyCanWrite = _canSendMessages;
|
||||
if (!_canSendMessages) {
|
||||
cancelReply();
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
#include "ui/widgets/discrete_sliders.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/effects/widget_fade_wrap.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "window/main_window.h"
|
||||
#include "mainwindow.h"
|
||||
@ -44,7 +45,10 @@ NarrowWrap::NarrowWrap(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<Memento*> memento)
|
||||
: Window::SectionWidget(parent, controller) {
|
||||
: Window::SectionWidget(parent, controller)
|
||||
, _topShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
||||
_topShadow->hideFast();
|
||||
_topShadow->raise();
|
||||
setInternalState(geometry(), memento);
|
||||
}
|
||||
|
||||
@ -52,7 +56,10 @@ NarrowWrap::NarrowWrap(
|
||||
QWidget *parent,
|
||||
not_null<Window::Controller*> controller,
|
||||
not_null<MoveMemento*> memento)
|
||||
: Window::SectionWidget(parent, controller) {
|
||||
: Window::SectionWidget(parent, controller)
|
||||
, _topShadow(this, object_ptr<Ui::PlainShadow>(this, st::shadowFg)) {
|
||||
_topShadow->hideFast();
|
||||
_topShadow->raise();
|
||||
restoreState(memento);
|
||||
}
|
||||
|
||||
@ -102,9 +109,11 @@ rpl::producer<int> NarrowWrap::desiredHeightForContent() const {
|
||||
|
||||
QPixmap NarrowWrap::grabForShowAnimation(
|
||||
const Window::SectionSlideParams ¶ms) {
|
||||
// if (params.withTopBarShadow) _topShadow->hide();
|
||||
anim::SetDisabled(true);
|
||||
if (params.withTopBarShadow) _topShadow->hide();
|
||||
auto result = myGrab(this);
|
||||
// if (params.withTopBarShadow) _topShadow->show();
|
||||
if (params.withTopBarShadow) _topShadow->show();
|
||||
anim::SetDisabled(false);
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -112,6 +121,10 @@ void NarrowWrap::doSetInnerFocus() {
|
||||
// _content->setInnerFocus();
|
||||
}
|
||||
|
||||
bool NarrowWrap::hasTopBarShadow() const {
|
||||
return !_topShadow->isHidden() && !_topShadow->animating();
|
||||
}
|
||||
|
||||
bool NarrowWrap::showInternal(
|
||||
not_null<Window::SectionMemento*> memento) {
|
||||
if (auto infoMemento = dynamic_cast<Memento*>(memento.get())) {
|
||||
|
@ -26,6 +26,8 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
namespace Ui {
|
||||
class PlainShadow;
|
||||
class SettingsSlider;
|
||||
template <typename Widget>
|
||||
class WidgetFadeWrap;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Info {
|
||||
@ -58,9 +60,7 @@ public:
|
||||
return peer();
|
||||
}
|
||||
|
||||
bool hasTopBarShadow() const override {
|
||||
return true;
|
||||
}
|
||||
bool hasTopBarShadow() const override;
|
||||
|
||||
QPixmap grabForShowAnimation(
|
||||
const Window::SectionSlideParams ¶ms) override;
|
||||
@ -99,7 +99,7 @@ private:
|
||||
void showContent(object_ptr<ContentWidget> content);
|
||||
object_ptr<TopBar> createTopBar();
|
||||
|
||||
object_ptr<Ui::PlainShadow> _topShadow = { nullptr };
|
||||
object_ptr<Ui::WidgetFadeWrap<Ui::PlainShadow>> _topShadow = { nullptr };
|
||||
object_ptr<ContentWidget> _content = { nullptr };
|
||||
object_ptr<TopBar> _topBar = { nullptr };
|
||||
|
||||
|
@ -120,16 +120,24 @@ object_ptr<Ui::RpWidget> InnerWidget::setupMuteToggle(
|
||||
void InnerWidget::setupMainUserButtons(
|
||||
Ui::VerticalLayout *wrap,
|
||||
not_null<UserData*> user) const {
|
||||
auto sendMessage = wrap->add(object_ptr<Button>(
|
||||
auto sendMessage = wrap->add(object_ptr<Ui::SlideWrap<Button>>(
|
||||
wrap,
|
||||
Lang::Viewer(lng_profile_send_message) | ToUpperValue(),
|
||||
st::infoMainButton));
|
||||
sendMessage->clicks()
|
||||
object_ptr<Button>(
|
||||
wrap,
|
||||
Lang::Viewer(lng_profile_send_message) | ToUpperValue(),
|
||||
st::infoMainButton)));
|
||||
_controller->historyPeer.value()
|
||||
| rpl::map([user](PeerData *peer) { return peer == user; })
|
||||
| rpl::start([sendMessage](bool peerHistoryShown) {
|
||||
sendMessage->toggleAnimated(!peerHistoryShown);
|
||||
}, sendMessage->lifetime());
|
||||
sendMessage->entity()->clicks()
|
||||
| rpl::start([this, user](auto&&) {
|
||||
_controller->showPeerHistory(
|
||||
user,
|
||||
Ui::ShowWay::Forward);
|
||||
}, sendMessage->lifetime());
|
||||
sendMessage->finishAnimations();
|
||||
|
||||
auto addContact = wrap->add(object_ptr<Ui::SlideWrap<Button>>(
|
||||
wrap,
|
||||
|
@ -23,6 +23,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
#include <rpl/filter.h>
|
||||
#include <rpl/never.h>
|
||||
#include <rpl/before_next.h>
|
||||
#include <rpl/after_next.h>
|
||||
#include <rpl/combine.h>
|
||||
#include "styles/style_info.h"
|
||||
#include "profile/profile_userpic_button.h"
|
||||
@ -274,10 +275,16 @@ LabeledLine::LabeledLine(
|
||||
auto layout = entity();
|
||||
auto nonEmptyText = std::move(text)
|
||||
| rpl::before_next([this](const TextWithEntities &value) {
|
||||
toggleAnimated(!value.text.isEmpty());
|
||||
}) | rpl::filter([this](const TextWithEntities &value) {
|
||||
return !value.text.isEmpty();
|
||||
});
|
||||
if (value.text.isEmpty()) {
|
||||
hideAnimated();
|
||||
}
|
||||
})
|
||||
| rpl::filter([this](const TextWithEntities &value) {
|
||||
return !value.text.isEmpty();
|
||||
})
|
||||
| rpl::after_next([this](const TextWithEntities &value) {
|
||||
showAnimated();
|
||||
});
|
||||
layout->add(object_ptr<Ui::FlatLabel>(
|
||||
this,
|
||||
std::move(nonEmptyText),
|
||||
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "mainwidget.h"
|
||||
|
||||
#include <rpl/combine.h>
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_history.h"
|
||||
#include "ui/special_buttons.h"
|
||||
@ -168,12 +169,12 @@ MainWidget::MainWidget(
|
||||
subscribe(_controller->floatPlayerAreaUpdated(), [this] {
|
||||
checkFloatPlayerVisibility();
|
||||
});
|
||||
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
|
||||
updateThirdColumnToCurrentPeer(peer);
|
||||
});
|
||||
subscribe(_controller->historyPeerCanWriteChanged(), [this](PeerData *peer) {
|
||||
updateThirdColumnToCurrentPeer(peer);
|
||||
});
|
||||
rpl::combine(
|
||||
_controller->historyPeer.value(),
|
||||
_controller->historyCanWrite.value())
|
||||
| rpl::start([this](PeerData *peer, bool canWrite) {
|
||||
updateThirdColumnToCurrentPeer(peer, canWrite);
|
||||
}, lifetime());
|
||||
|
||||
QCoreApplication::instance()->installEventFilter(this);
|
||||
|
||||
@ -3545,11 +3546,13 @@ void MainWidget::updateDialogsWidthAnimated() {
|
||||
}
|
||||
}
|
||||
|
||||
void MainWidget::updateThirdColumnToCurrentPeer(PeerData *peer) {
|
||||
void MainWidget::updateThirdColumnToCurrentPeer(
|
||||
PeerData *peer,
|
||||
bool canWrite) {
|
||||
if (Adaptive::ThreeColumn()
|
||||
&& Auth().data().tabbedSelectorSectionEnabled()
|
||||
&& peer) {
|
||||
if (!peer->canWrite()) {
|
||||
if (!canWrite) {
|
||||
_controller->showPeerInfo(
|
||||
peer,
|
||||
anim::type::instant,
|
||||
@ -3750,7 +3753,7 @@ int MainWidget::backgroundFromY() const {
|
||||
}
|
||||
|
||||
void MainWidget::onHistoryShown(History *history, MsgId atMsgId) {
|
||||
updateControlsGeometry();
|
||||
// updateControlsGeometry();
|
||||
dlgUpdated(history ? history->peer : nullptr, atMsgId);
|
||||
}
|
||||
|
||||
|
@ -505,7 +505,9 @@ private:
|
||||
void updateMediaPlaylistPosition(int x);
|
||||
void updateControlsGeometry();
|
||||
void updateDialogsWidthAnimated();
|
||||
void updateThirdColumnToCurrentPeer(PeerData *peer);
|
||||
void updateThirdColumnToCurrentPeer(
|
||||
PeerData *peer,
|
||||
bool canWrite);
|
||||
|
||||
void createPlayer();
|
||||
void switchToPanelPlayer();
|
||||
|
@ -71,6 +71,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include <gsl/gsl>
|
||||
|
||||
#ifndef _DEBUG
|
||||
#include <rpl/rpl.h>
|
||||
#endif // _DEBUG
|
||||
|
||||
#include "base/variant.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/algorithm.h"
|
||||
|
@ -71,12 +71,12 @@ void AbstractButton::mouseReleaseEvent(QMouseEvent *e) {
|
||||
onStateChanged(was, StateChangeSource::ByPress);
|
||||
if (was & StateFlag::Over) {
|
||||
_modifiers = e->modifiers();
|
||||
_clicks.fire({});
|
||||
if (_clickedCallback) {
|
||||
_clickedCallback();
|
||||
} else {
|
||||
emit clicked();
|
||||
}
|
||||
_clicks.fire({});
|
||||
} else {
|
||||
setOver(false, StateChangeSource::ByHover);
|
||||
}
|
||||
|
@ -116,6 +116,9 @@ bool Disabled() {
|
||||
|
||||
void SetDisabled(bool disabled) {
|
||||
AnimationsDisabled = disabled;
|
||||
if (disabled && _manager) {
|
||||
_manager->timeout();
|
||||
}
|
||||
}
|
||||
|
||||
} // anim
|
||||
|
@ -66,7 +66,9 @@ RippleButton::RippleButton(QWidget *parent, const style::RippleAnimation &st) :
|
||||
, _st(st) {
|
||||
}
|
||||
|
||||
void RippleButton::setForceRippled(bool rippled, SetForceRippledWay way) {
|
||||
void RippleButton::setForceRippled(
|
||||
bool rippled,
|
||||
anim::type animated) {
|
||||
if (_forceRippled != rippled) {
|
||||
_forceRippled = rippled;
|
||||
if (_forceRippled) {
|
||||
@ -80,7 +82,7 @@ void RippleButton::setForceRippled(bool rippled, SetForceRippledWay way) {
|
||||
_ripple->lastStop();
|
||||
}
|
||||
}
|
||||
if (way == SetForceRippledWay::SkipAnimation && _ripple) {
|
||||
if (animated == anim::type::instant && _ripple) {
|
||||
_ripple->lastFinish();
|
||||
}
|
||||
update();
|
||||
|
@ -53,12 +53,9 @@ class RippleButton : public AbstractButton {
|
||||
public:
|
||||
RippleButton(QWidget *parent, const style::RippleAnimation &st);
|
||||
|
||||
// Displays full ripple circle constantly.
|
||||
enum class SetForceRippledWay {
|
||||
Default,
|
||||
SkipAnimation,
|
||||
};
|
||||
void setForceRippled(bool rippled, SetForceRippledWay way = SetForceRippledWay::Default);
|
||||
void setForceRippled(
|
||||
bool rippled,
|
||||
anim::type animated = anim::type::normal);
|
||||
bool forceRippled() const {
|
||||
return _forceRippled;
|
||||
}
|
||||
|
@ -170,6 +170,7 @@ FlatLabel::FlatLabel(
|
||||
, _text(st.width ? st.width : QFIXED_MAX)
|
||||
, _st(st)
|
||||
, _contextCopyText(lang(lng_context_copy_text)) {
|
||||
textUpdated();
|
||||
std::move(text)
|
||||
| rpl::start([this](const QString &value) {
|
||||
setText(value);
|
||||
@ -184,6 +185,7 @@ FlatLabel::FlatLabel(
|
||||
, _text(st.width ? st.width : QFIXED_MAX)
|
||||
, _st(st)
|
||||
, _contextCopyText(lang(lng_context_copy_text)) {
|
||||
textUpdated();
|
||||
std::move(text)
|
||||
| rpl::start([this](const TextWithEntities &value) {
|
||||
setMarkedText(value);
|
||||
@ -455,7 +457,7 @@ bool FlatLabel::event(QEvent *e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return QWidget::event(e);
|
||||
return RpWidget::event(e);
|
||||
}
|
||||
|
||||
void FlatLabel::touchEvent(QTouchEvent *e) {
|
||||
|
@ -21,6 +21,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
#include "window/top_bar_widget.h"
|
||||
|
||||
#include <rpl/combine.h>
|
||||
#include <rpl/combine_previous.h>
|
||||
#include "styles/style_window.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
@ -72,15 +73,28 @@ TopBarWidget::TopBarWidget(
|
||||
_menuToggle->setClickedCallback([this] { showMenu(); });
|
||||
_infoToggle->setClickedCallback([this] { toggleInfoSection(); });
|
||||
|
||||
subscribe(_controller->searchInPeerChanged(), [this](PeerData *peer) {
|
||||
_searchInPeer = peer;
|
||||
auto historyPeer = App::main() ? App::main()->historyPeer() : nullptr;
|
||||
_search->setForceRippled(historyPeer && historyPeer == _searchInPeer);
|
||||
});
|
||||
subscribe(_controller->historyPeerChanged(), [this](PeerData *peer) {
|
||||
_search->setForceRippled(peer && peer == _searchInPeer, Ui::IconButton::SetForceRippledWay::SkipAnimation);
|
||||
update();
|
||||
});
|
||||
rpl::combine(
|
||||
_controller->historyPeer.value(),
|
||||
_controller->searchInPeer.value())
|
||||
| rpl::combine_previous(std::make_tuple(nullptr, nullptr))
|
||||
| rpl::map([](
|
||||
const std::tuple<PeerData*, PeerData*> &previous,
|
||||
const std::tuple<PeerData*, PeerData*> ¤t) {
|
||||
auto peer = std::get<0>(current);
|
||||
auto searchPeer = std::get<1>(current);
|
||||
auto peerChanged = (peer != std::get<0>(previous));
|
||||
auto searchInPeer
|
||||
= (peer != nullptr) && (peer == searchPeer);
|
||||
return std::make_tuple(searchInPeer, peerChanged);
|
||||
})
|
||||
| rpl::start([this](
|
||||
bool searchInHistoryPeer,
|
||||
bool peerChanged) {
|
||||
auto animated = peerChanged
|
||||
? anim::type::instant
|
||||
: anim::type::normal;
|
||||
_search->setForceRippled(searchInHistoryPeer, animated);
|
||||
}, lifetime());
|
||||
|
||||
subscribe(Adaptive::Changed(), [this]() { updateAdaptiveLayout(); });
|
||||
if (Adaptive::OneColumn()) {
|
||||
|
@ -84,7 +84,6 @@ private:
|
||||
|
||||
not_null<Window::Controller*> _controller;
|
||||
|
||||
PeerData *_searchInPeer = nullptr;
|
||||
int _selectedCount = 0;
|
||||
bool _canDelete = false;
|
||||
bool _canForward = false;
|
||||
|
@ -20,6 +20,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/variable.h>
|
||||
#include "base/flags.h"
|
||||
|
||||
class MainWidget;
|
||||
@ -53,19 +54,13 @@ public:
|
||||
|
||||
// This is needed for History TopBar updating when searchInPeer
|
||||
// is changed in the DialogsWidget of the current window.
|
||||
base::Observable<PeerData*> &searchInPeerChanged() {
|
||||
return _searchInPeerChanged;
|
||||
}
|
||||
rpl::variable<PeerData*> searchInPeer;
|
||||
|
||||
// This is needed while we have one HistoryWidget and one TopBarWidget
|
||||
// for all histories we show in a window. Once each history is shown
|
||||
// in its own HistoryWidget with its own TopBarWidget this can be removed.
|
||||
base::Observable<PeerData*> &historyPeerChanged() {
|
||||
return _historyPeerChanged;
|
||||
}
|
||||
base::Observable<PeerData*> &historyPeerCanWriteChanged() {
|
||||
return _historyPeerCanWriteChanged;
|
||||
}
|
||||
rpl::variable<PeerData*> historyPeer;
|
||||
rpl::variable<bool> historyCanWrite;
|
||||
|
||||
void enableGifPauseReason(GifPauseReason reason);
|
||||
void disableGifPauseReason(GifPauseReason reason);
|
||||
@ -180,10 +175,6 @@ private:
|
||||
|
||||
not_null<MainWindow*> _window;
|
||||
|
||||
base::Observable<PeerData*> _searchInPeerChanged;
|
||||
base::Observable<PeerData*> _historyPeerChanged;
|
||||
base::Observable<PeerData*> _historyPeerCanWriteChanged;
|
||||
|
||||
GifPauseReasons _gifPauseReasons = 0;
|
||||
base::Observable<void> _gifPauseLevelChanged;
|
||||
base::Observable<void> _floatPlayerAreaUpdated;
|
||||
|
Loading…
Reference in New Issue
Block a user