mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 15:43:55 +02:00
Moved Ui::SelectScrollManager to lib_ui.
This commit is contained in:
parent
bbc72f752a
commit
0e6c036fa2
6 changed files with 5 additions and 91 deletions
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "ui/chat/select_scroll_manager.h" // Has base/timer.h.
|
#include "ui/dragging_scroll_manager.h" // Has base/timer.h.
|
||||||
#include "ui/widgets/tooltip.h"
|
#include "ui/widgets/tooltip.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
#include "history/view/history_view_top_bar_widget.h"
|
#include "history/view/history_view_top_bar_widget.h"
|
||||||
|
@ -457,7 +457,7 @@ private:
|
||||||
QPoint _touchStart, _touchPrevPos, _touchPos;
|
QPoint _touchStart, _touchPrevPos, _touchPos;
|
||||||
base::Timer _touchSelectTimer;
|
base::Timer _touchSelectTimer;
|
||||||
|
|
||||||
Ui::SelectScrollManager _selectScroll;
|
Ui::DraggingScrollManager _selectScroll;
|
||||||
|
|
||||||
rpl::variable<bool> _sharingDisallowed = false;
|
rpl::variable<bool> _sharingDisallowed = false;
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "ui/rp_widget.h"
|
#include "ui/rp_widget.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "ui/chat/select_scroll_manager.h" // Has base/timer.h.
|
#include "ui/dragging_scroll_manager.h" // Has base/timer.h.
|
||||||
#include "ui/widgets/tooltip.h"
|
#include "ui/widgets/tooltip.h"
|
||||||
#include "mtproto/sender.h"
|
#include "mtproto/sender.h"
|
||||||
#include "data/data_messages.h"
|
#include "data/data_messages.h"
|
||||||
|
@ -635,7 +635,7 @@ private:
|
||||||
|
|
||||||
Ui::Animations::Simple _spoilerOpacity;
|
Ui::Animations::Simple _spoilerOpacity;
|
||||||
|
|
||||||
Ui::SelectScrollManager _selectScroll;
|
Ui::DraggingScrollManager _selectScroll;
|
||||||
|
|
||||||
rpl::event_stream<FullMsgId> _requestedToEditMessage;
|
rpl::event_stream<FullMsgId> _requestedToEditMessage;
|
||||||
rpl::event_stream<FullMsgId> _requestedToReplyToMessage;
|
rpl::event_stream<FullMsgId> _requestedToReplyToMessage;
|
||||||
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of Telegram Desktop,
|
|
||||||
the official desktop application for the Telegram messaging service.
|
|
||||||
|
|
||||||
For license and copyright information please follow this link:
|
|
||||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
||||||
*/
|
|
||||||
#include "ui/chat/select_scroll_manager.h"
|
|
||||||
|
|
||||||
#include "ui/widgets/scroll_area.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
|
|
||||||
SelectScrollManager::SelectScrollManager()
|
|
||||||
: _timer([=] { scrollByTimer(); }) {
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectScrollManager::scrollByTimer() {
|
|
||||||
const auto d = (_delta > 0)
|
|
||||||
? std::min(_delta * 3 / 20 + 1, kMaxScrollSpeed)
|
|
||||||
: std::max(_delta * 3 / 20 - 1, -kMaxScrollSpeed);
|
|
||||||
_scrolls.fire_copy(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectScrollManager::checkDeltaScroll(
|
|
||||||
const QPoint &point,
|
|
||||||
int top,
|
|
||||||
int bottom) {
|
|
||||||
const auto diff = point.y() - top;
|
|
||||||
_delta = (diff < 0)
|
|
||||||
? diff
|
|
||||||
: (point.y() >= bottom)
|
|
||||||
? (point.y() - bottom + 1)
|
|
||||||
: 0;
|
|
||||||
if (_delta) {
|
|
||||||
_timer.callEach(15);
|
|
||||||
} else {
|
|
||||||
_timer.cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void SelectScrollManager::cancel() {
|
|
||||||
_timer.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
rpl::producer<int> SelectScrollManager::scrolls() {
|
|
||||||
return _scrolls.events();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Ui
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
This file is part of Telegram Desktop,
|
|
||||||
the official desktop application for the Telegram messaging service.
|
|
||||||
|
|
||||||
For license and copyright information please follow this link:
|
|
||||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
||||||
*/
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "base/timer.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
|
|
||||||
class ScrollArea;
|
|
||||||
|
|
||||||
class SelectScrollManager final {
|
|
||||||
public:
|
|
||||||
SelectScrollManager();
|
|
||||||
|
|
||||||
void checkDeltaScroll(const QPoint &point, int top, int bottom);
|
|
||||||
void cancel();
|
|
||||||
|
|
||||||
rpl::producer<int> scrolls();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void scrollByTimer();
|
|
||||||
|
|
||||||
base::Timer _timer;
|
|
||||||
int _delta = 0;
|
|
||||||
rpl::event_stream<int> _scrolls;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace Ui
|
|
|
@ -186,8 +186,6 @@ PRIVATE
|
||||||
ui/chat/pinned_bar.h
|
ui/chat/pinned_bar.h
|
||||||
ui/chat/requests_bar.cpp
|
ui/chat/requests_bar.cpp
|
||||||
ui/chat/requests_bar.h
|
ui/chat/requests_bar.h
|
||||||
ui/chat/select_scroll_manager.cpp
|
|
||||||
ui/chat/select_scroll_manager.h
|
|
||||||
ui/controls/call_mute_button.cpp
|
ui/controls/call_mute_button.cpp
|
||||||
ui/controls/call_mute_button.h
|
ui/controls/call_mute_button.h
|
||||||
ui/controls/chat_service_checkbox.cpp
|
ui/controls/chat_service_checkbox.cpp
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit c7826b8dff84a54a5a3b5d550492810a5f09680e
|
Subproject commit 6e6ba5a14947242ae0de3296fd650a3b3338728e
|
Loading…
Add table
Reference in a new issue