mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +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);
|
||||
}
|
||||
|
||||
void Controller::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
_replyArea->tryProcessKeyInput(e);
|
||||
}
|
||||
|
||||
rpl::lifetime &Controller::lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
|
|
|
@ -161,6 +161,7 @@ public:
|
|||
void togglePinnedRequested(bool pinned);
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
|
|
|
@ -681,6 +681,10 @@ bool ReplyArea::ignoreWindowMove(QPoint position) const {
|
|||
return _controls->isRecordingPressed();
|
||||
}
|
||||
|
||||
void ReplyArea::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
_controls->tryProcessKeyInput(e);
|
||||
}
|
||||
|
||||
void ReplyArea::showPremiumToast(not_null<DocumentData*> emoji) {
|
||||
// #TODO stories
|
||||
}
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
[[nodiscard]] rpl::producer<bool> hasSendTextValue() const;
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||
|
||||
private:
|
||||
class Cant;
|
||||
|
|
|
@ -107,6 +107,10 @@ bool View::ignoreWindowMove(QPoint position) const {
|
|||
return _controller->ignoreWindowMove(position);
|
||||
}
|
||||
|
||||
void View::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
_controller->tryProcessKeyInput(e);
|
||||
}
|
||||
|
||||
SiblingView View::sibling(SiblingType type) const {
|
||||
return _controller->sibling(type);
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ public:
|
|||
void togglePinnedRequested(bool pinned);
|
||||
|
||||
[[nodiscard]] bool ignoreWindowMove(QPoint position) const;
|
||||
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
|
|
|
@ -4886,14 +4886,20 @@ bool OverlayWidget::isSaveMsgShown() const {
|
|||
}
|
||||
|
||||
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 modifiers = e->modifiers();
|
||||
const auto ctrl = modifiers.testFlag(Qt::ControlModifier);
|
||||
if (_stories && key == Qt::Key_Space && _down != Over::Video) {
|
||||
_stories->togglePaused(!_stories->paused());
|
||||
return;
|
||||
}
|
||||
if (_streamed) {
|
||||
if (_stories) {
|
||||
if (key == Qt::Key_Space && _down != Over::Video) {
|
||||
_stories->togglePaused(!_stories->paused());
|
||||
return;
|
||||
}
|
||||
} else if (_streamed) {
|
||||
// Ctrl + F for full screen toggle is in eventFilter().
|
||||
const auto toggleFull = (modifiers.testFlag(Qt::AltModifier) || ctrl)
|
||||
&& (key == Qt::Key_Enter || key == Qt::Key_Return);
|
||||
|
@ -4962,9 +4968,9 @@ void OverlayWidget::handleKeyPress(not_null<QKeyEvent*> e) {
|
|||
zoomIn();
|
||||
} else if (key == Qt::Key_Minus || key == Qt::Key_Underscore) {
|
||||
zoomOut();
|
||||
} else if (key == Qt::Key_I) {
|
||||
update();
|
||||
}
|
||||
} else if (_stories) {
|
||||
_stories->tryProcessKeyInput(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -690,6 +690,7 @@ private:
|
|||
base::Timer _dropdownShowTimer;
|
||||
|
||||
bool _receiveMouse = true;
|
||||
bool _processingKeyPress = false;
|
||||
|
||||
bool _touchPress = false;
|
||||
bool _touchMove = false;
|
||||
|
|
Loading…
Add table
Reference in a new issue