mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Allow disabling fast reply button.
This commit is contained in:
@@ -450,6 +450,14 @@ HistoryInner::HistoryInner(
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
Core::App().settings().cornerReplyValue(
|
||||
) | rpl::on_next([=](bool value) {
|
||||
_useCornerReply = value;
|
||||
if (!value) {
|
||||
_replyButtonManager->updateButton({});
|
||||
}
|
||||
}, lifetime());
|
||||
|
||||
controller->adaptive().chatWideValue(
|
||||
) | rpl::on_next([=](bool wide) {
|
||||
_isChatWide = wide;
|
||||
@@ -4324,6 +4332,9 @@ auto HistoryInner::replyButtonParameters(
|
||||
QPoint position,
|
||||
const HistoryView::TextState &replyState) const
|
||||
-> HistoryView::ReplyButton::ButtonParameters {
|
||||
if (!_useCornerReply) {
|
||||
return {};
|
||||
}
|
||||
const auto top = itemTop(view);
|
||||
if (top < 0
|
||||
|| _mouseAction == MouseAction::Dragging
|
||||
|
||||
@@ -537,6 +537,7 @@ private:
|
||||
bool _dragStateUserpic = false;
|
||||
bool _pressWasInactive = false;
|
||||
bool _recountedAfterPendingResizedItems = false;
|
||||
bool _useCornerReply = false;
|
||||
bool _useCornerReaction = false;
|
||||
bool _acceptsHorizontalScroll = false;
|
||||
bool _horizontalScrollLocked = false;
|
||||
|
||||
@@ -527,6 +527,16 @@ ListWidget::ListWidget(
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
if (_replyButtonManager) {
|
||||
Core::App().settings().cornerReplyValue(
|
||||
) | rpl::on_next([=](bool value) {
|
||||
_useCornerReply = value;
|
||||
if (!value) {
|
||||
_replyButtonManager->updateButton({});
|
||||
}
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
_delegate->listChatWideValue(
|
||||
) | rpl::on_next([=](bool wide) {
|
||||
_isChatWide = wide;
|
||||
@@ -3626,6 +3636,9 @@ ReplyButton::ButtonParameters ListWidget::replyButtonParameters(
|
||||
not_null<const Element*> view,
|
||||
QPoint position,
|
||||
const TextState &replyState) const {
|
||||
if (!_useCornerReply) {
|
||||
return {};
|
||||
}
|
||||
const auto top = itemTop(view);
|
||||
if (top < 0
|
||||
|| _mouseAction == MouseAction::Dragging
|
||||
|
||||
@@ -788,6 +788,7 @@ private:
|
||||
|
||||
std::unique_ptr<HistoryView::Reactions::Manager> _reactionsManager;
|
||||
rpl::variable<HistoryItem*> _reactionsItem;
|
||||
bool _useCornerReply = false;
|
||||
bool _useCornerReaction = false;
|
||||
|
||||
std::unique_ptr<ReplyButton::Manager> _replyButtonManager;
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace HistoryView::ReplyButton {
|
||||
namespace {
|
||||
|
||||
constexpr auto kToggleDuration = crl::time(120);
|
||||
constexpr auto kButtonShowDelay = crl::time(300);
|
||||
constexpr auto kButtonShowDelay = crl::time(0);
|
||||
constexpr auto kButtonHideDelay = crl::time(300);
|
||||
|
||||
[[nodiscard]] float64 ScaleForState(ButtonState state) {
|
||||
@@ -344,7 +344,11 @@ void Manager::removeStaleButtons() {
|
||||
}
|
||||
|
||||
void Manager::clearAppearAnimations() {
|
||||
_buttonHiding.clear();
|
||||
for (const auto &button : base::take(_buttonHiding)) {
|
||||
if (!button->isHidden()) {
|
||||
button->repaint();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace HistoryView::ReplyButton
|
||||
|
||||
@@ -68,6 +68,10 @@ public:
|
||||
[[nodiscard]] float64 currentScale() const;
|
||||
[[nodiscard]] float64 currentOpacity() const;
|
||||
|
||||
void repaint() const {
|
||||
_update(_geometry);
|
||||
}
|
||||
|
||||
private:
|
||||
void updateGeometry(Fn<void(QRect)> update);
|
||||
void applyState(ButtonState state, Fn<void(QRect)> update);
|
||||
|
||||
Reference in New Issue
Block a user