mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Auto-focus story reply on input start.
This commit is contained in:
parent
da5bce00d4
commit
0b7af5bfe3
8 changed files with 29 additions and 7 deletions
|
@ -1448,6 +1448,10 @@ bool Controller::ignoreWindowMove(QPoint position) const {
|
||||||
|| _header->ignoreWindowMove(position);
|
|| _header->ignoreWindowMove(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Controller::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||||
|
_replyArea->tryProcessKeyInput(e);
|
||||||
|
}
|
||||||
|
|
||||||
rpl::lifetime &Controller::lifetime() {
|
rpl::lifetime &Controller::lifetime() {
|
||||||
return _lifetime;
|
return _lifetime;
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,7 @@ public:
|
||||||
void togglePinnedRequested(bool pinned);
|
void togglePinnedRequested(bool pinned);
|
||||||
|
|
||||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||||
|
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||||
|
|
||||||
[[nodiscard]] rpl::lifetime &lifetime();
|
[[nodiscard]] rpl::lifetime &lifetime();
|
||||||
|
|
||||||
|
|
|
@ -681,6 +681,10 @@ bool ReplyArea::ignoreWindowMove(QPoint position) const {
|
||||||
return _controls->isRecordingPressed();
|
return _controls->isRecordingPressed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReplyArea::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||||
|
_controls->tryProcessKeyInput(e);
|
||||||
|
}
|
||||||
|
|
||||||
void ReplyArea::showPremiumToast(not_null<DocumentData*> emoji) {
|
void ReplyArea::showPremiumToast(not_null<DocumentData*> emoji) {
|
||||||
// #TODO stories
|
// #TODO stories
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,7 @@ public:
|
||||||
[[nodiscard]] rpl::producer<bool> hasSendTextValue() const;
|
[[nodiscard]] rpl::producer<bool> hasSendTextValue() const;
|
||||||
|
|
||||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||||
|
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class Cant;
|
class Cant;
|
||||||
|
|
|
@ -107,6 +107,10 @@ bool View::ignoreWindowMove(QPoint position) const {
|
||||||
return _controller->ignoreWindowMove(position);
|
return _controller->ignoreWindowMove(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void View::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||||
|
_controller->tryProcessKeyInput(e);
|
||||||
|
}
|
||||||
|
|
||||||
SiblingView View::sibling(SiblingType type) const {
|
SiblingView View::sibling(SiblingType type) const {
|
||||||
return _controller->sibling(type);
|
return _controller->sibling(type);
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,6 +83,7 @@ public:
|
||||||
void togglePinnedRequested(bool pinned);
|
void togglePinnedRequested(bool pinned);
|
||||||
|
|
||||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||||
|
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||||
|
|
||||||
[[nodiscard]] rpl::lifetime &lifetime();
|
[[nodiscard]] rpl::lifetime &lifetime();
|
||||||
|
|
||||||
|
|
|
@ -4886,14 +4886,20 @@ bool OverlayWidget::isSaveMsgShown() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OverlayWidget::handleKeyPress(not_null<QKeyEvent*> e) {
|
void OverlayWidget::handleKeyPress(not_null<QKeyEvent*> e) {
|
||||||
|
if (_processingKeyPress) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_processingKeyPress = true;
|
||||||
|
const auto guard = gsl::finally([&] { _processingKeyPress = false; });
|
||||||
const auto key = e->key();
|
const auto key = e->key();
|
||||||
const auto modifiers = e->modifiers();
|
const auto modifiers = e->modifiers();
|
||||||
const auto ctrl = modifiers.testFlag(Qt::ControlModifier);
|
const auto ctrl = modifiers.testFlag(Qt::ControlModifier);
|
||||||
if (_stories && key == Qt::Key_Space && _down != Over::Video) {
|
if (_stories) {
|
||||||
_stories->togglePaused(!_stories->paused());
|
if (key == Qt::Key_Space && _down != Over::Video) {
|
||||||
return;
|
_stories->togglePaused(!_stories->paused());
|
||||||
}
|
return;
|
||||||
if (_streamed) {
|
}
|
||||||
|
} else if (_streamed) {
|
||||||
// Ctrl + F for full screen toggle is in eventFilter().
|
// Ctrl + F for full screen toggle is in eventFilter().
|
||||||
const auto toggleFull = (modifiers.testFlag(Qt::AltModifier) || ctrl)
|
const auto toggleFull = (modifiers.testFlag(Qt::AltModifier) || ctrl)
|
||||||
&& (key == Qt::Key_Enter || key == Qt::Key_Return);
|
&& (key == Qt::Key_Enter || key == Qt::Key_Return);
|
||||||
|
@ -4962,9 +4968,9 @@ void OverlayWidget::handleKeyPress(not_null<QKeyEvent*> e) {
|
||||||
zoomIn();
|
zoomIn();
|
||||||
} else if (key == Qt::Key_Minus || key == Qt::Key_Underscore) {
|
} else if (key == Qt::Key_Minus || key == Qt::Key_Underscore) {
|
||||||
zoomOut();
|
zoomOut();
|
||||||
} else if (key == Qt::Key_I) {
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
} else if (_stories) {
|
||||||
|
_stories->tryProcessKeyInput(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -690,6 +690,7 @@ private:
|
||||||
base::Timer _dropdownShowTimer;
|
base::Timer _dropdownShowTimer;
|
||||||
|
|
||||||
bool _receiveMouse = true;
|
bool _receiveMouse = true;
|
||||||
|
bool _processingKeyPress = false;
|
||||||
|
|
||||||
bool _touchPress = false;
|
bool _touchPress = false;
|
||||||
bool _touchMove = false;
|
bool _touchMove = false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue