2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Pass modifiers inside InputField submitted signal.

Also use non-MOC connections for all InputFields.
Also use Ctrl/Cmd + Enter to submit fast share box.
Fixes #4769.
This commit is contained in:
John Preston
2018-05-31 15:20:28 +03:00
parent b3059248d4
commit bfc748cd31
36 changed files with 272 additions and 332 deletions

View File

@@ -495,7 +495,7 @@ Notification::Notification(Manager *manager, History *history, PeerData *peer, P
updateNotifyDisplay();
_hideTimer.setSingleShot(true);
connect(&_hideTimer, SIGNAL(timeout()), this, SLOT(onHideByTimer()));
connect(&_hideTimer, &QTimer::timeout, [=] { startHiding(); });
_close->setClickedCallback([this] {
unlinkHistoryInManager();
@@ -576,15 +576,11 @@ bool Notification::checkLastInput(bool hasReplyingNotifications) {
return false;
}
void Notification::onReplyResize() {
void Notification::replyResized() {
changeHeight(st::notifyMinHeight + _replyArea->height() + st::notifyBorderWidth);
}
void Notification::onReplySubmit(bool ctrlShiftEnter) {
sendReply();
}
void Notification::onReplyCancel() {
void Notification::replyCancel() {
unlinkHistoryInManager();
}
@@ -777,9 +773,9 @@ void Notification::showReplyField() {
// Catch mouse press event to activate the window.
QCoreApplication::instance()->installEventFilter(this);
connect(_replyArea, SIGNAL(resized()), this, SLOT(onReplyResize()));
connect(_replyArea, SIGNAL(submitted(bool)), this, SLOT(onReplySubmit(bool)));
connect(_replyArea, SIGNAL(cancelled()), this, SLOT(onReplyCancel()));
connect(_replyArea, &Ui::InputField::resized, [=] { replyResized(); });
connect(_replyArea, &Ui::InputField::submitted, [=] { sendReply(); });
connect(_replyArea, &Ui::InputField::cancelled, [=] { replyCancel(); });
_replySend.create(this, st::notifySendReply);
_replySend->moveToRight(st::notifyBorderWidth, st::notifyMinHeight);
@@ -788,7 +784,7 @@ void Notification::showReplyField() {
toggleActionButtons(false);
onReplyResize();
replyResized();
update();
}
@@ -868,10 +864,6 @@ void Notification::stopHiding() {
Widget::hideStop();
}
void Notification::onHideByTimer() {
startHiding();
}
HideAllButton::HideAllButton(Manager *manager, QPoint startPosition, int shift, Direction shiftDirection) : Widget(manager, startPosition, shift, shiftDirection) {
setCursor(style::cur_pointer);

View File

@@ -164,8 +164,6 @@ protected:
};
class Notification : public Widget {
Q_OBJECT
public:
Notification(Manager *manager, History *history, PeerData *peer, PeerData *author, HistoryItem *item, int forwardedCount, QPoint startPosition, int shift, Direction shiftDirection);
@@ -194,16 +192,12 @@ protected:
void mousePressEvent(QMouseEvent *e) override;
bool eventFilter(QObject *o, QEvent *e) override;
private slots:
void onHideByTimer();
void onReplyResize();
void onReplySubmit(bool ctrlShiftEnter);
void onReplyCancel();
private:
void refreshLang();
void updateReplyGeometry();
bool canReply() const;
void replyResized();
void replyCancel();
void unlinkHistoryInManager();
void toggleActionButtons(bool visible);

View File

@@ -720,7 +720,7 @@ Editor::Editor(QWidget*, const QString &path)
_select->resizeToWidth(st::windowMinWidth);
_select->setQueryChangedCallback([this](const QString &query) { _inner->filterRows(query); _scroll->scrollToY(0); });
_select->setSubmittedCallback([this](bool) { _inner->chooseRow(); });
_select->setSubmittedCallback([this](Qt::KeyboardModifiers) { _inner->chooseRow(); });
_inner->prepare();
resizeToWidth(st::windowMinWidth);