mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-03-06 14:27:46 +00:00
Moved Ui::SelectScrollManager to lib_ui.
This commit is contained in:
parent
bbc72f752a
commit
0e6c036fa2
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "ui/rp_widget.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/scroll_area.h"
|
||||
#include "history/view/history_view_top_bar_widget.h"
|
||||
@ -457,7 +457,7 @@ private:
|
||||
QPoint _touchStart, _touchPrevPos, _touchPos;
|
||||
base::Timer _touchSelectTimer;
|
||||
|
||||
Ui::SelectScrollManager _selectScroll;
|
||||
Ui::DraggingScrollManager _selectScroll;
|
||||
|
||||
rpl::variable<bool> _sharingDisallowed = false;
|
||||
|
||||
|
@ -9,7 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
#include "ui/rp_widget.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 "mtproto/sender.h"
|
||||
#include "data/data_messages.h"
|
||||
@ -635,7 +635,7 @@ private:
|
||||
|
||||
Ui::Animations::Simple _spoilerOpacity;
|
||||
|
||||
Ui::SelectScrollManager _selectScroll;
|
||||
Ui::DraggingScrollManager _selectScroll;
|
||||
|
||||
rpl::event_stream<FullMsgId> _requestedToEditMessage;
|
||||
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/requests_bar.cpp
|
||||
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.h
|
||||
ui/controls/chat_service_checkbox.cpp
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit c7826b8dff84a54a5a3b5d550492810a5f09680e
|
||||
Subproject commit 6e6ba5a14947242ae0de3296fd650a3b3338728e
|
Loading…
Reference in New Issue
Block a user