mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
Removed Q_SLOTS from HistoryInner.
This commit is contained in:
parent
cb8f49aea0
commit
ececdcb9c0
2 changed files with 17 additions and 21 deletions
|
@ -168,6 +168,8 @@ HistoryInner::HistoryInner(
|
|||
HistoryView::MakePathShiftGradient(
|
||||
controller->chatStyle(),
|
||||
[=] { update(); }))
|
||||
, _touchSelectTimer([=] { onTouchSelect(); })
|
||||
, _touchScrollTimer([=] { onTouchScrollTimer(); })
|
||||
, _scrollDateCheck([this] { scrollDateCheck(); })
|
||||
, _scrollDateHideTimer([this] { scrollDateHideByTimer(); }) {
|
||||
Instance = this;
|
||||
|
@ -180,13 +182,7 @@ HistoryInner::HistoryInner(
|
|||
controller->setChatStyleTheme(_theme);
|
||||
}, lifetime());
|
||||
|
||||
_touchSelectTimer.setSingleShot(true);
|
||||
connect(&_touchSelectTimer, SIGNAL(timeout()), this, SLOT(onTouchSelect()));
|
||||
|
||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||
connect(&_touchScrollTimer, SIGNAL(timeout()), this, SLOT(onTouchScrollTimer()));
|
||||
|
||||
_trippleClickTimer.setSingleShot(true);
|
||||
|
||||
notifyIsBotChanged();
|
||||
|
||||
|
@ -891,7 +887,7 @@ void HistoryInner::onTouchScrollTimer() {
|
|||
if (_touchSpeed.isNull() || !hasScrolled) {
|
||||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
_touchScroll = false;
|
||||
_touchScrollTimer.stop();
|
||||
_touchScrollTimer.cancel();
|
||||
} else {
|
||||
_touchTime = nowTime;
|
||||
}
|
||||
|
@ -966,7 +962,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
if (e->type() == QEvent::TouchCancel) { // cancel
|
||||
if (!_touchInProgress) return;
|
||||
_touchInProgress = false;
|
||||
_touchSelectTimer.stop();
|
||||
_touchSelectTimer.cancel();
|
||||
_touchScroll = _touchSelect = false;
|
||||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
mouseActionCancel();
|
||||
|
@ -996,7 +992,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
_touchStart = _touchPos;
|
||||
} else {
|
||||
_touchScroll = false;
|
||||
_touchSelectTimer.start(QApplication::startDragTime());
|
||||
_touchSelectTimer.callOnce(QApplication::startDragTime());
|
||||
}
|
||||
_touchSelect = false;
|
||||
_touchStart = _touchPrevPos = _touchPos;
|
||||
|
@ -1007,7 +1003,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
if (_touchSelect) {
|
||||
mouseActionUpdate(_touchPos);
|
||||
} else if (!_touchScroll && (_touchPos - _touchStart).manhattanLength() >= QApplication::startDragDistance()) {
|
||||
_touchSelectTimer.stop();
|
||||
_touchSelectTimer.cancel();
|
||||
_touchScroll = true;
|
||||
touchUpdateSpeed();
|
||||
}
|
||||
|
@ -1037,7 +1033,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
if (_touchScrollState == Ui::TouchScrollState::Manual) {
|
||||
_touchScrollState = Ui::TouchScrollState::Auto;
|
||||
_touchPrevPosValid = false;
|
||||
_touchScrollTimer.start(15);
|
||||
_touchScrollTimer.callEach(15);
|
||||
_touchTime = crl::now();
|
||||
} else if (_touchScrollState == Ui::TouchScrollState::Auto) {
|
||||
_touchScrollState = Ui::TouchScrollState::Manual;
|
||||
|
@ -1053,7 +1049,7 @@ void HistoryInner::touchEvent(QTouchEvent *e) {
|
|||
mouseActionFinish(_touchPos, Qt::LeftButton);
|
||||
}
|
||||
if (weak) {
|
||||
_touchSelectTimer.stop();
|
||||
_touchSelectTimer.cancel();
|
||||
_touchSelect = false;
|
||||
}
|
||||
} break;
|
||||
|
@ -1161,7 +1157,8 @@ void HistoryInner::mouseActionStart(const QPoint &screenPos, Qt::MouseButton but
|
|||
_mouseAction = MouseAction::Selecting;
|
||||
_mouseSelectType = TextSelectType::Paragraphs;
|
||||
mouseActionUpdate(_mousePosition);
|
||||
_trippleClickTimer.start(QApplication::doubleClickInterval());
|
||||
_trippleClickTimer.callOnce(
|
||||
QApplication::doubleClickInterval());
|
||||
}
|
||||
}
|
||||
} else if (App::pressedItem()) {
|
||||
|
@ -1530,7 +1527,7 @@ void HistoryInner::mouseDoubleClickEvent(QMouseEvent *e) {
|
|||
mouseMoveEvent(e);
|
||||
|
||||
_trippleClickPoint = e->globalPos();
|
||||
_trippleClickTimer.start(QApplication::doubleClickInterval());
|
||||
_trippleClickTimer.callOnce(QApplication::doubleClickInterval());
|
||||
}
|
||||
}
|
||||
if (!ClickHandler::getActive()
|
||||
|
|
|
@ -150,6 +150,8 @@ public:
|
|||
QPoint tooltipPos() const override;
|
||||
bool tooltipWindowActive() const override;
|
||||
|
||||
void onParentGeometryChanged();
|
||||
|
||||
// HistoryView::ElementDelegate interface.
|
||||
static not_null<HistoryView::ElementDelegate*> ElementDelegate();
|
||||
|
||||
|
@ -171,13 +173,10 @@ protected:
|
|||
void keyPressEvent(QKeyEvent *e) override;
|
||||
void contextMenuEvent(QContextMenuEvent *e) override;
|
||||
|
||||
public Q_SLOTS:
|
||||
void onParentGeometryChanged();
|
||||
|
||||
private:
|
||||
void onTouchSelect();
|
||||
void onTouchScrollTimer();
|
||||
|
||||
private:
|
||||
class BotAbout;
|
||||
using SelectedItems = std::map<HistoryItem*, TextSelection, std::less<>>;
|
||||
enum class MouseAction {
|
||||
|
@ -400,7 +399,7 @@ private:
|
|||
bool _pressWasInactive = false;
|
||||
|
||||
QPoint _trippleClickPoint;
|
||||
QTimer _trippleClickTimer;
|
||||
base::Timer _trippleClickTimer;
|
||||
|
||||
Element *_dragSelFrom = nullptr;
|
||||
Element *_dragSelTo = nullptr;
|
||||
|
@ -412,7 +411,7 @@ private:
|
|||
bool _touchSelect = false;
|
||||
bool _touchInProgress = false;
|
||||
QPoint _touchStart, _touchPrevPos, _touchPos;
|
||||
QTimer _touchSelectTimer;
|
||||
base::Timer _touchSelectTimer;
|
||||
|
||||
Ui::TouchScrollState _touchScrollState = Ui::TouchScrollState::Manual;
|
||||
bool _touchPrevPosValid = false;
|
||||
|
@ -421,7 +420,7 @@ private:
|
|||
crl::time _touchSpeedTime = 0;
|
||||
crl::time _touchAccelerationTime = 0;
|
||||
crl::time _touchTime = 0;
|
||||
QTimer _touchScrollTimer;
|
||||
base::Timer _touchScrollTimer;
|
||||
|
||||
base::unique_qptr<Ui::PopupMenu> _menu;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue